From b9f06dc5e31d0bc78637142f576b9339bb86ee31 Mon Sep 17 00:00:00 2001 From: Dimitry Kloper Date: Mon, 4 Jan 2016 21:39:48 +0200 Subject: [PATCH 1/2] ATMEGA2560: Fix compilation when CONFIG_DISABLE_SIGNALS is undefined --- arch/avr/include/avr/irq.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/avr/include/avr/irq.h b/arch/avr/include/avr/irq.h index 9e95edbec5f..9c8ec670afc 100644 --- a/arch/avr/include/avr/irq.h +++ b/arch/avr/include/avr/irq.h @@ -117,6 +117,9 @@ struct xcptcontext uint8_t saved_pc1; uint8_t saved_pc0; +# if defined(REG_PC2) + uint8_t saved_pc2; +# endif uint8_t saved_sreg; #endif From 16212f19e77ebadd0589e7d85c3c8530a8fdd00f Mon Sep 17 00:00:00 2001 From: Dimitry Kloper Date: Mon, 4 Jan 2016 21:42:24 +0200 Subject: [PATCH 2/2] AVR: Introduce Atmel Toolchain as a configuration option Atmel's AVR8 toolchain is similar to WinAVR, but at present moment it has one important feature that WinAVR does not. The __flash and __memx allow built in comiler support for transparent program memory pointers. Functions that use such pointers will work both with RAM arrays and flash memory arrays. The compiler generates an appropriate code automatically. For systems with tiny memory like atmega, this is very important and allows to move all static const strings into flash. --- arch/avr/src/avr/Kconfig | 24 ++++++++++++++++++++++++ arch/avr/src/avr/Toolchain.defs | 16 +++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/arch/avr/src/avr/Kconfig b/arch/avr/src/avr/Kconfig index 9591cb6530d..5010dc57b36 100644 --- a/arch/avr/src/avr/Kconfig +++ b/arch/avr/src/avr/Kconfig @@ -27,6 +27,14 @@ config AVR_WINAVR correct cygwin.dll file precedes the path to the WinAVR binaries! +config AVR_ATMEL_AVR_TOOLCHAIN + bool "Atmel AVR Toolchain" + depends on HOST_WINDOWS + ---help--- + Atmel provides GNU Toolchain for AVR development. It can + be obtained by installing Atmel Studio 6 and later or + as standalone package from Atmel. + config AVR_LINUXGCC bool "Linux GCC" depends on HOST_LINUX @@ -59,4 +67,20 @@ config AVR_BUILDROOT endchoice +menu "Atmel AVR Toolchain options" + depends on AVR_ATMEL_AVR_TOOLCHAIN + +config AVR_HAS_MEMX_PTR + bool "Enable in-flash static const stings" + depends on AVR_ATMEL_AVR_TOOLCHAIN + default y + ---help--- + Enabling this option (recommended) will place all constant + strings used for debugging and assertion in program memory + and allow the corresponding routines to get the strings + directly from there. This will dramatically decrease amount + of RAM needed to hold this static data. + +endmenu + endif diff --git a/arch/avr/src/avr/Toolchain.defs b/arch/avr/src/avr/Toolchain.defs index 38e54521d5d..7e9e74210fa 100644 --- a/arch/avr/src/avr/Toolchain.defs +++ b/arch/avr/src/avr/Toolchain.defs @@ -66,6 +66,12 @@ ifeq ($(filter y, \ CONFIG_AVR_TOOLCHAIN ?= WINAVR endif +ifeq ($(filter y, \ + $(CONFIG_AVR_ATMEL_AVR_TOOLCHAIN) \ + ),y) + CONFIG_AVR_TOOLCHAIN ?= ATMEL +endif + # Chip-specific CPU flags ifeq ($(CONFIG_ARCH_CHIP_ATMEGA128),y) @@ -114,9 +120,17 @@ ifeq ($(CONFIG_AVR_TOOLCHAIN),LINUXGCC) LDFLAGS += -nostartfiles -nodefaultlibs endif -# WinAVR toolchain under Windows/Cygwin +# WinAVR or Atmel toolchain under Windows/Cygwin +_WINAVR = 0 ifeq ($(CONFIG_AVR_TOOLCHAIN),WINAVR) +_WINAVR = 1 +endif +ifeq ($(CONFIG_AVR_TOOLCHAIN),ATMEL) +_WINAVR = 1 +endif + +ifeq ($(_WINAVR),1) CROSSDEV ?= avr- ifneq ($(CONFIG_WINDOWS_NATIVE),y) WINTOOL = y