From 9c1f6906ad2e10cc8aaefbca0df8a35169ae29c3 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Tue, 22 Jun 2021 17:44:11 -0400 Subject: [PATCH 1/8] Support overriding SOURCES_README --- build.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.conf b/build.conf index 2576910..59edddb 100644 --- a/build.conf +++ b/build.conf @@ -43,7 +43,7 @@ fi GREP=grep #fallback for grep without pearl regexp -SOURCES_README="$(wget -O - ${AVR_SOURCES}/SOURCES.README 2>/dev/null)" +[ -z "$SOURCES_README" ] && SOURCES_README="$(wget -O - ${AVR_SOURCES}/SOURCES.README 2>/dev/null)" [ -z "$GCC_VERSION" ] && GCC_VERSION="$(echo "$SOURCES_README" | $GREP "GCC" | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")" [ -z "$AUTOMAKE_VERSION" ] && AUTOMAKE_VERSION="$(echo "$SOURCES_README" | $GREP "automake" | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")" [ -z "$AUTOCONF_VERSION" ] && AUTOCONF_VERSION="$(echo "$SOURCES_README" | $GREP "autoconf" | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")" From f09ac0b001ffb2474149172184b70ac96d3567f5 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Tue, 22 Jun 2021 17:44:18 -0400 Subject: [PATCH 2/8] Bump build.conf versions --- build.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.conf b/build.conf index 59edddb..9ea2f2b 100644 --- a/build.conf +++ b/build.conf @@ -1,5 +1,5 @@ -AVR_VERSION=3.6.1 -BUILD_NUMBER=arduino7 +AVR_VERSION=3.6.2 +BUILD_NUMBER=arduino8 AVR_SOURCES="http://downloads.arduino.cc/tools/opensource/Atmel-AVR-GNU-Toolchain/${AVR_VERSION}" ATMEL_PACKS_SOURCES="http://packs.download.atmel.com/" @@ -19,15 +19,15 @@ MPC_SOURCES="http://repository.timesys.com/buildsources/m/mpc/" GCC_VERSION=7.3.0 MPFR_VERSION=3.1.0 -ATMEL_ATMEGA_PACK_VERSION=1.4.351 +ATMEL_ATMEGA_PACK_VERSION=1.6.364 ATMEL_ATMEGA_PACK_FILENAME=Atmel.ATmega_DFP.${ATMEL_ATMEGA_PACK_VERSION} ATMEL_ATMEGA_PACK_URL=${ATMEL_PACKS_SOURCES}${ATMEL_ATMEGA_PACK_FILENAME}.atpack -ATMEL_ATTINY_PACK_VERSION=1.4.310 +ATMEL_ATTINY_PACK_VERSION=1.9.337 ATMEL_ATTINY_PACK_FILENAME=Atmel.ATtiny_DFP.${ATMEL_ATTINY_PACK_VERSION} ATMEL_ATTINY_PACK_URL=${ATMEL_PACKS_SOURCES}${ATMEL_ATTINY_PACK_FILENAME}.atpack -ATMEL_DX_PACK_VERSION=1.0.27 +ATMEL_DX_PACK_VERSION=1.8.95 ATMEL_DX_PACK_FILENAME=Atmel.AVR-Dx_DFP.${ATMEL_DX_PACK_VERSION} ATMEL_DX_PACK_URL=${ATMEL_PACKS_SOURCES}${ATMEL_DX_PACK_FILENAME}.atpack From 32e179981bf512f50da2ed82ced4e359467a45e2 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Tue, 22 Jun 2021 17:44:39 -0400 Subject: [PATCH 3/8] Binutils patches merged upstream --- .../00-binutils-data_region_length.patch | 17 ----------------- binutils.build.bash | 1 - 2 files changed, 18 deletions(-) delete mode 100644 binutils-patches/00-binutils-data_region_length.patch diff --git a/binutils-patches/00-binutils-data_region_length.patch b/binutils-patches/00-binutils-data_region_length.patch deleted file mode 100644 index e6d8815..0000000 --- a/binutils-patches/00-binutils-data_region_length.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc -index 26b9b4c9..82d33b98 100644 ---- a/ld/scripttempl/avr.sc -+++ b/ld/scripttempl/avr.sc -@@ -33,10 +33,11 @@ __LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH_ - __SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : $SIGNATURE_LENGTH; - ${USER_SIGNATURE_LENGTH+__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : $USER_SIGNATURE_LENGTH;} - ${RODATA_PM_OFFSET+__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : $RODATA_PM_OFFSET;} -+__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : $DATA_ORIGIN; - MEMORY - { - text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__ -- data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__ -+ data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__ - ${EEPROM_LENGTH+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__} - $FUSE_NAME (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__ - lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__ diff --git a/binutils.build.bash b/binutils.build.bash index 384edf0..6139801 100755 --- a/binutils.build.bash +++ b/binutils.build.bash @@ -40,7 +40,6 @@ fi tar xf avr-binutils.tar.bz2 cd binutils -for p in ../binutils-patches/*.patch; do echo Applying $p; patch -p1 < $p; done autoconf cd ld autoreconf From a9976b613778e0324f265f5fd101e1bf00e71d1a Mon Sep 17 00:00:00 2001 From: leo60228 Date: Tue, 22 Jun 2021 17:46:01 -0400 Subject: [PATCH 4/8] Remove avr-libc patches merged upstream --- avr-libc-patches/02-power.patch | 100 ------------------------------- avr-libc-patches/03-eeprom.patch | 14 ----- 2 files changed, 114 deletions(-) delete mode 100644 avr-libc-patches/02-power.patch delete mode 100644 avr-libc-patches/03-eeprom.patch diff --git a/avr-libc-patches/02-power.patch b/avr-libc-patches/02-power.patch deleted file mode 100644 index 6945615..0000000 --- a/avr-libc-patches/02-power.patch +++ /dev/null @@ -1,100 +0,0 @@ ---- a/include/avr/power.h 2020-05-26 14:04:10.000000000 +0200 -+++ b/include/avr/power.h 2020-05-26 11:29:38.153645260 +0200 -@@ -689,6 +689,11 @@ - #define power_spi_disable() (PRR0 |= (uint8_t)(1 << PRSPI)) - #endif - -+#if defined(__AVR_HAVE_PRR0_PRSPI0) -+#define power_spi_enable() (PRR0 &= (uint8_t)~(1 << PRSPI0)) -+#define power_spi_disable() (PRR0 |= (uint8_t)(1 << PRSPI0)) -+#endif -+ - #if defined(__AVR_HAVE_PRR0_PRT0) - #define power_timer0_enable() (PRR0 &= (uint8_t)~(1 << PRT0)) - #define power_timer0_disable() (PRR0 |= (uint8_t)(1 << PRT0)) -@@ -734,6 +739,11 @@ - #define power_twi_disable() (PRR0 |= (uint8_t)(1 << PRTWI)) - #endif - -+#if defined(__AVR_HAVE_PRR0_PRTWI0) -+#define power_twi_enable() (PRR0 &= (uint8_t)~(1 << PRTWI0)) -+#define power_twi_disable() (PRR0 |= (uint8_t)(1 << PRTWI0)) -+#endif -+ - #if defined(__AVR_HAVE_PRR0_PRTWI1) - #define power_twi1_enable() (PRR0 &= (uint8_t)~(1 << PRTWI1)) - #define power_twi1_disable() (PRR0 |= (uint8_t)(1 << PRTWI1)) -@@ -814,6 +824,11 @@ - #define power_spi_disable() (PRR1 |= (uint8_t)(1 << PRSPI)) - #endif - -+#if defined(__AVR_HAVE_PRR1_PRSPI1) -+#define power_spi1_enable() (PRR1 &= (uint8_t)~(1 << PRSPI1)) -+#define power_spi1_disable() (PRR1 |= (uint8_t)(1 << PRSPI1)) -+#endif -+ - #if defined(__AVR_HAVE_PRR1_PRT1) - #define power_timer1_enable() (PRR1 &= (uint8_t)~(1 << PRT1)) - #define power_timer1_disable() (PRR1 |= (uint8_t)(1 << PRT1)) -@@ -859,6 +874,11 @@ - #define power_transceiver_disable() (PRR1 |= (uint8_t)(1 << PRTRX24)) - #endif - -+#if defined(__AVR_HAVE_PRR1_PRTWI1) -+#define power_twi1_enable() (PRR1 &= (uint8_t)~(1 << PRTWI1)) -+#define power_twi1_disable() (PRR1 |= (uint8_t)(1 << PRTWI1)) -+#endif -+ - #if defined(__AVR_HAVE_PRR1_PRUSART1) - #define power_usart1_enable() (PRR1 &= (uint8_t)~(1 << PRUSART1)) - #define power_usart1_disable() (PRR1 |= (uint8_t)(1 << PRUSART1)) -@@ -924,6 +944,11 @@ - #define power_preamble_rssi_fifo_disable() (PRR2 |= (uint8_t)(1 << PRSF)) - #endif - -+#if defined(__AVR_HAVE_PRR2_PRSPI1) -+#define power_spi1_enable() (PRR2 &= (uint8_t)~(1 << PRSPI1)) -+#define power_spi1_disable() (PRR2 |= (uint8_t)(1 << PRSPI1)) -+#endif -+ - #if defined(__AVR_HAVE_PRR2_PRSPI2) - #define power_spi2_enable() (PRR2 &= (uint8_t)~(1 << PRSPI2)) - #define power_spi2_disable() (PRR2 |= (uint8_t)(1 << PRSPI2)) -@@ -939,11 +964,21 @@ - #define power_tx_modulator_disable() (PRR2 |= (uint8_t)(1 << PRTM)) - #endif - -+#if defined(__AVR_HAVE_PRR2_PRTWI1) -+#define power_twi1_enable() (PRR2 &= (uint8_t)~(1 << PRTWI1)) -+#define power_twi1_disable() (PRR2 |= (uint8_t)(1 << PRTWI1)) -+#endif -+ - #if defined(__AVR_HAVE_PRR2_PRTWI2) - #define power_twi2_enable() (PRR2 &= (uint8_t)~(1 << PRTWI2)) - #define power_twi2_disable() (PRR2 |= (uint8_t)(1 << PRTWI2)) - #endif - -+#if defined(__AVR_HAVE_PRR2_PRUSART2) -+#define power_usart2_enable() (PRR2 &= (uint8_t)~(1 << PRUSART2)) -+#define power_usart2_disable() (PRR2 |= (uint8_t)(1 << PRUSART2)) -+#endif -+ - #if defined(__AVR_HAVE_PRR2_PRXA) - #define power_rx_buffer_A_enable() (PRR2 &= (uint8_t)~(1 << PRXA)) - #define power_rx_buffer_A_disable() (PRR2 |= (uint8_t)(1 << PRXA)) -@@ -1350,6 +1385,7 @@ - || defined(__AVR_ATmega324A__) \ - || defined(__AVR_ATmega324P__) \ - || defined(__AVR_ATmega324PA__) \ -+|| defined(__AVR_ATmega324PB__) \ - || defined(__AVR_ATmega325__) \ - || defined(__AVR_ATmega325A__) \ - || defined(__AVR_ATmega325P__) \ -@@ -1360,6 +1396,7 @@ - || defined(__AVR_ATmega3250PA__) \ - || defined(__AVR_ATmega328__) \ - || defined(__AVR_ATmega328P__) \ -+|| defined(__AVR_ATmega328PB__) \ - || defined(__AVR_ATmega329__) \ - || defined(__AVR_ATmega329A__) \ - || defined(__AVR_ATmega329P__) \ diff --git a/avr-libc-patches/03-eeprom.patch b/avr-libc-patches/03-eeprom.patch deleted file mode 100644 index 9e11101..0000000 --- a/avr-libc-patches/03-eeprom.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/include/avr/eeprom.h 2020-05-26 14:04:10.000000000 +0200 -+++ b/include/avr/eeprom.h 2020-05-26 11:29:38.153645260 +0200 -@@ -112,8 +112,10 @@ - */ - #if defined (__DOXYGEN__) - # define eeprom_is_ready() --#elif defined (__AVR_XMEGA__) && __AVR_XMEGA__ -+#elif defined (NVM_STATUS) - # define eeprom_is_ready() bit_is_clear (NVM_STATUS, NVM_NVMBUSY_bp) -+#elif defined (NVMCTRL_STATUS) -+# define eeprom_is_ready() bit_is_clear (NVMCTRL_STATUS, NVMCTRL_EEBUSY_bp) - #elif defined (DEECR) - # define eeprom_is_ready() bit_is_clear (DEECR, BSY) - #elif defined (EEPE) From 10b61ec9ac2576e00b594eb31d71275d760f7a8d Mon Sep 17 00:00:00 2001 From: leo60228 Date: Tue, 22 Jun 2021 17:46:27 -0400 Subject: [PATCH 5/8] Set additional avr-libc build tools --- avr-libc.build.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avr-libc.build.bash b/avr-libc.build.bash index 089879d..853e24b 100755 --- a/avr-libc.build.bash +++ b/avr-libc.build.bash @@ -91,7 +91,7 @@ CONFARGS=" \ --libdir=$PREFIX/lib \ --disable-doc" -CC="avr-gcc" CXX="avr-g++" CFLAGS="-w -Os $CFLAGS" CXXFLAGS="-w -Os $CXXFLAGS" LDFLAGS="-s $LDFLAGS" ../avr-libc/configure $CONFARGS +AR="avr-ar" AS="avr-as" CC="avr-gcc" CXX="avr-g++" RANLIB="avr-ranlib" CFLAGS="-w -Os $CFLAGS" CXXFLAGS="-w -Os $CXXFLAGS" LDFLAGS="-s $LDFLAGS" ../avr-libc/configure $CONFARGS if [ -z "$MAKE_JOBS" ]; then MAKE_JOBS="2" From c9212db6b2bb131dd9ba668fbfece770d5517d38 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Tue, 22 Jun 2021 17:46:52 -0400 Subject: [PATCH 6/8] Use all-gdb target instead of --disable-binutils --- gdb.build.bash | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gdb.build.bash b/gdb.build.bash index b048c23..696fc67 100755 --- a/gdb.build.bash +++ b/gdb.build.bash @@ -61,7 +61,6 @@ CONFARGS=" \ --disable-nls \ --disable-werror \ --with-guile=guile-2.0 \ - --disable-binutils \ --target=avr" CFLAGS="-w -O2 -g0 $CFLAGS" CXXFLAGS="-w -O2 -g0 $CXXFLAGS" LDFLAGS="-s $LDFLAGS" ../gdb/configure $CONFARGS $EXTRA_CONFARGS @@ -70,7 +69,7 @@ if [ -z "$MAKE_JOBS" ]; then MAKE_JOBS="2" fi -nice -n 10 make -j $MAKE_JOBS +nice -n 10 make -j $MAKE_JOBS all-gdb # New versions of gdb share the same configure/make scripts with binutils. Running make install-gdb to # install just the gdb binaries. From 08a630cb03a89e4eeb713c8c081d1a54f51c40c9 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Tue, 22 Jun 2021 17:47:06 -0400 Subject: [PATCH 7/8] Update URL and versions in README --- Readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 2367c0a..09b1648 100644 --- a/Readme.md +++ b/Readme.md @@ -2,14 +2,14 @@ This is the AVR Toolchain used in the [Arduino IDE](http://arduino.cc/). -As soon as Atmel [ships a newer toolchain](http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/), we pull the source code, **patch it** with some user contributed patches and deliver it with the [Arduino IDE](http://arduino.cc/). +As soon as Atmel [ships a newer toolchain](https://www.microchip.com/mplab/avr-support/avr-and-sam-downloads-archive), we pull the source code, **patch it** with some user contributed patches and deliver it with the [Arduino IDE](http://arduino.cc/). Therefore, the resulting binaries may differ significantly from Atmel's. And you should start blaming us if things are not working as expected :) ### Configuring -Edit the `build.conf` file, currently the only thing worth changing is `AVR_VERSION` on the first line to match whatever the [latest version is](http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain/). +Edit the `build.conf` file, currently the only thing worth changing is `AVR_VERSION` on the first line to match whatever the [latest version is](https://www.microchip.com/mplab/avr-support/avr-and-sam-downloads-archive). -At time of writing, the latest toolchain available is based on Atmel 3.6.1 version, but we replaced gcc component with a newer one, porting Atmel patches. It contains: +At time of writing, the latest toolchain available is based on Atmel 3.6.2 version, but we replaced gcc component with a newer one, porting Atmel patches. It contains: - binutils-2.26 - gcc-7.3.0 (patches here https://github.com/arduino/toolchain-avr/tree/staging/avr-gcc-patches) - avr-libc-2.0.0 From 89ac4c5dcabc61a79e820bb9502e6a17e5d7dfb8 Mon Sep 17 00:00:00 2001 From: leo60228 Date: Tue, 22 Jun 2021 17:47:22 -0400 Subject: [PATCH 8/8] Update gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b170c73..9140fdb 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,7 @@ avr8-headers.zip avr8-headers/ gmp-5.0.2.tar.bz2 mpc-0.9.tar.gz -mpfr-3.0.0.tar.bz2 +mpfr-3.1.0.tar.bz2 avr +atpack +gcc-7.3.0.tar.xz