mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-12 00:57:44 -04:00
ATmegaxxxx - clarify initial stack setup
This commit is contained in:
parent
10fcd90af1
commit
62682ebe5b
1 changed files with 23 additions and 30 deletions
|
@ -542,6 +542,14 @@ uint16_t usAddress;
|
|||
/* The start of the task code will be popped off the stack last, so place
|
||||
it on first. */
|
||||
|
||||
usAddress = ( uint16_t ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
#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
|
||||
|
@ -553,24 +561,9 @@ uint16_t usAddress;
|
|||
* In order to do this properly, we would need to get a full 3-byte pointer to
|
||||
* pxCode. That requires a change to GCC. Not likely to happen any time soon.
|
||||
*/
|
||||
usAddress = ( uint16_t ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = 0;
|
||||
pxTopOfStack--;
|
||||
#else
|
||||
usAddress = ( uint16_t ) pxCode;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
|
||||
usAddress >>= 8;
|
||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||
pxTopOfStack--;
|
||||
#endif
|
||||
|
||||
/* Next simulate the stack as if after a call to portSAVE_CONTEXT().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue