From c19e711ba5d4f8ad0c1ed9a54c655b015b1c8e76 Mon Sep 17 00:00:00 2001 From: Phillip Stevens Date: Sat, 11 Apr 2020 12:01:44 +1000 Subject: [PATCH] ATmegaxxxx - discern architecture rather than device --- portable/GCC/ATmegaxxxx/port.c | 10 +++++----- portable/GCC/ATmegaxxxx/portmacro.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/portable/GCC/ATmegaxxxx/port.c b/portable/GCC/ATmegaxxxx/port.c index 370a9b9aa..2a76e9894 100644 --- a/portable/GCC/ATmegaxxxx/port.c +++ b/portable/GCC/ATmegaxxxx/port.c @@ -222,7 +222,7 @@ void wdt_interrupt_reset_enable (const uint8_t value) * * r0 is set to __tmp_reg__ as the compiler expects it to be thus. * - * #if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) + * #if defined(__AVR_3_BYTE_PC__) * #define __RAMPZ__ 0x3B * #define __EIND__ 0x3C * #endif @@ -230,7 +230,7 @@ void wdt_interrupt_reset_enable (const uint8_t value) * The interrupts will have been disabled during the call to portSAVE_CONTEXT() * so we need not worry about reading/writing to the stack pointer. */ -#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +#if defined(__AVR_3_BYTE_PC__) /* 3-Byte PC Save */ #define portSAVE_CONTEXT() \ __asm__ __volatile__ ( "push __tmp_reg__ \n\t" \ @@ -332,7 +332,7 @@ void wdt_interrupt_reset_enable (const uint8_t value) * Opposite to portSAVE_CONTEXT(). Interrupts will have been disabled during * the context save so we can write to the stack pointer. */ -#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +#if defined(__AVR_3_BYTE_PC__) /* 3-Byte PC Restore */ #define portRESTORE_CONTEXT() \ __asm__ __volatile__ ( "lds r26, pxCurrentTCB \n\t" \ @@ -451,7 +451,7 @@ uint16_t usAddress; /* The start of the task code will be popped off the stack last, so place it on first. */ -#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +#if defined(__AVR_3_BYTE_PC__) /* The AVR ATmega2560/ATmega2561 have 256KBytes of program memory and a 17-bit * program counter. When a code address is stored on the stack, it takes 3 bytes * instead of 2 for the other ATmega* chips. @@ -491,7 +491,7 @@ uint16_t usAddress; *pxTopOfStack = portFLAGS_INT_ENABLED; pxTopOfStack--; -#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +#if defined(__AVR_3_BYTE_PC__) /* If we have an ATmega256x, we are also saving the RAMPZ and EIND registers. * We should default those to 0. diff --git a/portable/GCC/ATmegaxxxx/portmacro.h b/portable/GCC/ATmegaxxxx/portmacro.h index 492bf8562..253f1379a 100644 --- a/portable/GCC/ATmegaxxxx/portmacro.h +++ b/portable/GCC/ATmegaxxxx/portmacro.h @@ -132,7 +132,7 @@ extern void vPortYield( void ) __attribute__ ( ( naked ) ); #define portYIELD() vPortYield() /*-----------------------------------------------------------*/ -#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +#if defined(__AVR_3_BYTE_PC__) /* Task function macros as described on the FreeRTOS.org WEB site. */ /* Add .lowtext tag from the avr linker script avr6.x for ATmega2560 and ATmega2561