ATmegaxxxx - add __AVR_HAVE_RAMPZ__

This commit is contained in:
Phillip Stevens 2020-04-11 12:24:22 +10:00
parent 670c00d3a5
commit 520456577a

View file

@ -216,7 +216,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_3_BYTE_PC__)
* #if defined(__AVR_3_BYTE_PC__) && defined(__AVR_HAVE_RAMPZ__)
* #define __RAMPZ__ 0x3B
* #define __EIND__ 0x3C
* #endif
@ -224,7 +224,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_3_BYTE_PC__)
#if defined(__AVR_3_BYTE_PC__) && defined(__AVR_HAVE_RAMPZ__)
/* 3-Byte PC Save */
#define portSAVE_CONTEXT() \
__asm__ __volatile__ ( "push __tmp_reg__ \n\t" \
@ -326,7 +326,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_3_BYTE_PC__)
#if defined(__AVR_3_BYTE_PC__) && defined(__AVR_HAVE_RAMPZ__)
/* 3-Byte PC Restore */
#define portRESTORE_CONTEXT() \
__asm__ __volatile__ ( "lds r26, pxCurrentTCB \n\t" \
@ -445,7 +445,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_3_BYTE_PC__)
#if defined(__AVR_3_BYTE_PC__) && defined(__AVR_HAVE_RAMPZ__)
/* 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.
@ -485,8 +485,7 @@ uint16_t usAddress;
*pxTopOfStack = portFLAGS_INT_ENABLED;
pxTopOfStack--;
#if defined(__AVR_3_BYTE_PC__)
#if defined(__AVR_3_BYTE_PC__) && defined(__AVR_HAVE_RAMPZ__)
/* If we have an ATmega256x, we are also saving the RAMPZ and EIND registers.
* We should default those to 0.
*/
@ -494,7 +493,6 @@ uint16_t usAddress;
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) 0x00; /* RAMPZ */
pxTopOfStack--;
#endif
/* Now the remaining registers. The compiler expects R1 to be 0. */