[gnoduino] Add gcc & udev patches to contrib section



commit 12d54d07fc97e1bcd3c0f72fe40d9202ab2d3786
Author: Pascal de Bruijn <pmjdebruijn pcode nl>
Date:   Mon May 6 21:40:05 2013 +0200

    Add gcc & udev patches to contrib section

 contrib/gcc47_avr.patch                          |  155 ++++++++++++++++++++++
 contrib/gcc47_avr_pr50925_fno-caller-saves.patch |   21 +++
 contrib/gnoduino.rules                           |    8 +
 3 files changed, 184 insertions(+), 0 deletions(-)
---
diff --git a/contrib/gcc47_avr.patch b/contrib/gcc47_avr.patch
new file mode 100644
index 0000000..8d5600f
--- /dev/null
+++ b/contrib/gcc47_avr.patch
@@ -0,0 +1,155 @@
+Description: patch to work with libc 1.8.0 and gcc 4.7
+Bug: http://andybrown.me.uk/wk/2012/04/28/avr-gcc-4-7-0-and-avr-libc-1-8-0-compiled-for-windows/
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677294
+Author: Andy Brown <http://andybrown.me.uk/wk/>
+Index: arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp
+===================================================================
+--- arduino.orig/hardware/arduino/cores/arduino/HardwareSerial.cpp     2012-11-05 13:55:44.000000000 -0500
++++ arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp  2012-11-05 14:12:07.112590603 -0500
+@@ -1,3 +1,5 @@
++#define __AVR_LIBC_DEPRECATED_ENABLE__
++
+ /*
+   HardwareSerial.cpp - Hardware serial library for Wiring
+   Copyright (c) 2006 Nicholas Zambetti.  All right reserved.
+Index: arduino/hardware/arduino/cores/arduino/IPAddress.cpp
+===================================================================
+--- arduino.orig/hardware/arduino/cores/arduino/IPAddress.cpp  2012-10-02 15:24:21.000000000 -0400
++++ arduino/hardware/arduino/cores/arduino/IPAddress.cpp       2012-11-05 14:12:07.112590603 -0500
+@@ -4,42 +4,42 @@
+ 
+ IPAddress::IPAddress()
+ {
+-    memset(_address, 0, sizeof(_address));
++    memset(_address.a8, 0, sizeof(_address));
+ }
+ 
+ IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
+ {
+-    _address[0] = first_octet;
+-    _address[1] = second_octet;
+-    _address[2] = third_octet;
+-    _address[3] = fourth_octet;
++    _address.a8[0] = first_octet;
++    _address.a8[1] = second_octet;
++    _address.a8[2] = third_octet;
++    _address.a8[3] = fourth_octet;
+ }
+ 
+ IPAddress::IPAddress(uint32_t address)
+ {
+-    memcpy(_address, &address, sizeof(_address));
++      _address.a32=address;
+ }
+ 
+ IPAddress::IPAddress(const uint8_t *address)
+ {
+-    memcpy(_address, address, sizeof(_address));
++    memcpy(_address.a8, address, sizeof(_address));
+ }
+ 
+ IPAddress& IPAddress::operator=(const uint8_t *address)
+ {
+-    memcpy(_address, address, sizeof(_address));
++    memcpy(_address.a8, address, sizeof(_address));
+     return *this;
+ }
+ 
+ IPAddress& IPAddress::operator=(uint32_t address)
+ {
+-    memcpy(_address, (const uint8_t *)&address, sizeof(_address));
++      _address.a32=address;
+     return *this;
+ }
+ 
+ bool IPAddress::operator==(const uint8_t* addr)
+ {
+-    return memcmp(addr, _address, sizeof(_address)) == 0;
++    return memcmp(addr, _address.a8, sizeof(_address)) == 0;
+ }
+ 
+ size_t IPAddress::printTo(Print& p) const
+@@ -47,10 +47,10 @@
+     size_t n = 0;
+     for (int i =0; i < 3; i++)
+     {
+-        n += p.print(_address[i], DEC);
++        n += p.print(_address.a8[i], DEC);
+         n += p.print('.');
+     }
+-    n += p.print(_address[3], DEC);
++    n += p.print(_address.a8[3], DEC);
+     return n;
+ }
+ 
+Index: arduino/hardware/arduino/cores/arduino/IPAddress.h
+===================================================================
+--- arduino.orig/hardware/arduino/cores/arduino/IPAddress.h    2012-10-02 15:24:21.000000000 -0400
++++ arduino/hardware/arduino/cores/arduino/IPAddress.h 2012-11-05 14:12:07.112590603 -0500
+@@ -32,12 +32,16 @@
+ 
+ class IPAddress : public Printable {
+ private:
+-    uint8_t _address[4];  // IPv4 address
++      union {
++              uint8_t a8[4];  // IPv4 address
++              uint32_t a32;
++      } _address;
++      
+     // Access the raw byte array containing the address.  Because this returns a pointer
+     // to the internal structure rather than a copy of the address this function should only
+     // be used when you know that the usage of the returned uint8_t* will be transient and not
+     // stored.
+-    uint8_t* raw_address() { return _address; };
++    uint8_t* raw_address() { return _address.a8; }
+ 
+ public:
+     // Constructors
+@@ -48,13 +52,13 @@
+ 
+     // Overloaded cast operator to allow IPAddress objects to be used where a pointer
+     // to a four-byte uint8_t array is expected
+-    operator uint32_t() { return *((uint32_t*)_address); };
+-    bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == 
(*((uint32_t*)addr._address)); };
++    operator uint32_t() { return _address.a32; }
++    bool operator==(const IPAddress& addr) { return _address.a32 == addr._address.a32; };
+     bool operator==(const uint8_t* addr);
+ 
+     // Overloaded index operator to allow getting and setting individual octets of the address
+-    uint8_t operator[](int index) const { return _address[index]; };
+-    uint8_t& operator[](int index) { return _address[index]; };
++    uint8_t operator[](int index) const { return _address.a8[index]; };
++    uint8_t& operator[](int index) { return _address.a8[index]; };
+ 
+     // Overloaded copy operators to allow initialisation of IPAddress objects from other types
+     IPAddress& operator=(const uint8_t *address);
+Index: arduino/hardware/arduino/cores/arduino/Print.cpp
+===================================================================
+--- arduino.orig/hardware/arduino/cores/arduino/Print.cpp      2012-11-05 13:55:44.000000000 -0500
++++ arduino/hardware/arduino/cores/arduino/Print.cpp   2012-11-05 14:12:07.112590603 -0500
+@@ -41,7 +41,7 @@
+ 
+ size_t Print::print(const __FlashStringHelper *ifsh)
+ {
+-  const char PROGMEM *p = (const char PROGMEM *)ifsh;
++  const char * __attribute__((progmem)) p = (const char * ) ifsh;
+   size_t n = 0;
+   while (1) {
+     unsigned char c = pgm_read_byte(p++);
+Index: arduino/libraries/Ethernet/Ethernet.cpp
+===================================================================
+--- arduino.orig/libraries/Ethernet/Ethernet.cpp       2012-10-02 15:24:21.000000000 -0400
++++ arduino/libraries/Ethernet/Ethernet.cpp    2012-11-05 14:12:07.112590603 -0500
+@@ -61,9 +61,9 @@
+ {
+   W5100.init();
+   W5100.setMACAddress(mac);
+-  W5100.setIPAddress(local_ip._address);
+-  W5100.setGatewayIp(gateway._address);
+-  W5100.setSubnetMask(subnet._address);
++  W5100.setIPAddress(local_ip._address.a8);
++  W5100.setGatewayIp(gateway._address.a8);
++  W5100.setSubnetMask(subnet._address.a8);
+   _dnsServerAddress = dns_server;
+ }
+ 
diff --git a/contrib/gcc47_avr_pr50925_fno-caller-saves.patch 
b/contrib/gcc47_avr_pr50925_fno-caller-saves.patch
new file mode 100644
index 0000000..154ee1c
--- /dev/null
+++ b/contrib/gcc47_avr_pr50925_fno-caller-saves.patch
@@ -0,0 +1,21 @@
+Description: patch to work around an obscure gcc 4.7 bug (pr50925)
+Author: Pascal de Bruijn <pmjdebruijn pcode nl>
+diff -Nurpd a/src/compiler.py b/src/compiler.py
+--- a/src/compiler.py  2013-01-04 18:47:02.000000000 +0100
++++ b/src/compiler.py  2013-01-14 21:27:48.206606929 +0100
+@@ -82,6 +82,7 @@ defc = [
+       "-Os",
+       "-ffunction-sections",
+       "-fdata-sections",
++      "-fno-caller-saves",
+       ]
+ 
+ defcpp = [
+@@ -93,6 +94,7 @@ defcpp = [
+       "-fno-exceptions",
+       "-ffunction-sections",
+       "-fdata-sections",
++      "-fno-caller-saves",
+       ]
+ 
+ defar = [
diff --git a/contrib/gnoduino.rules b/contrib/gnoduino.rules
new file mode 100644
index 0000000..36ebcae
--- /dev/null
+++ b/contrib/gnoduino.rules
@@ -0,0 +1,8 @@
+# USBtinyISP
+SUBSYSTEM=="usb", ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", GROUP="dialout", MODE="660"
+
+# USBasp
+SUBSYSTEM=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="dialout", MODE="660"
+
+# AVRISP mkII
+SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2104", GROUP="dialout", MODE="660"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]