GCC: MSP430F449: Fix pxPortInitialiseStack on EABI (#947)

According to the MSP430 EABI [1] section 3.3,

Arguments are assigned, in declared order, to the first available
register single, pair, or quad from the following list into which it
fits (with the following special exceptions). For MSP430 and
MSP430X, the argument registers are: R12, R13, R14, R15

Therefore, pvParameters should be passed in R12, as it is the first
argument, not R15. Keep passing the parameter in R15 for the
MSP430 EABI, if anyone is still using it.

[1] https://www.ti.com/lit/an/slaa534a/slaa534a.pdf
This commit is contained in:
Forty-Bot 2024-01-29 00:37:43 -05:00 committed by GitHub
parent b1ee2e6e14
commit 1860c9ad09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -183,16 +183,23 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) 0xbbbb;
pxTopOfStack--;
#ifdef __MSPGCC__
*pxTopOfStack = ( StackType_t ) 0xcccc;
#else
/* The MSP430 EABI expects the function parameter in R12. */
*pxTopOfStack = ( StackType_t ) pvParameters;
#endif
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) 0xdddd;
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) 0xeeee;
pxTopOfStack--;
/* When the task starts is will expect to find the function parameter in
* R15. */
#ifdef __MSPGCC__
/* The mspgcc ABI expects the function parameter in R15. */
*pxTopOfStack = ( StackType_t ) pvParameters;
#else
*pxTopOfStack = ( StackType_t ) 0xffff;
#endif
pxTopOfStack--;
/* The code generated by the mspgcc compiler does not maintain separate