Home > other >  STM32 ucos transplant a doubt
STM32 ucos transplant a doubt

Time:09-18

In the task stack initialization function, save the location of the LR, task stack placed R14 (LR)=0 xfffffffel;
Added/* R14 (LR) (init value will cause the fault if (2) */
Meaning is not use LR values,
But, after the completion of task switching is not to the stack using LR address back to the task is interrupted last place? Why use an illegal value?
Please guide each master, thank you!

OS_STK * OSTaskStkInit (void task (*) (void * p_arg), void * p_arg, OS_STK * ptos, INT16U opt)
{
OS_STK * STK.


(void) opt;/* 'opt' is not 2, prevent warning */
STK=ptos;/* Load stack pointer */

/* Registers stacked as if auto - saved on exception */
* (STK)=(INT32U) 0 x01000000l;/* xPSR */
* (STK)=(INT32U) task; Entry Point/* */
* (STK)=(INT32U) 0 xfffffffel; /* R14 (LR) (init value will cause the fault if (2) */
* (STK)=(INT32U) 0 x12121212l; R12/* */
* (STK)=(INT32U) 0 x03030303l;/* */R3
* (STK)=(INT32U) 0 x02020202l;/* */R2
* (STK)=(INT32U) 0 x01010101l; R1/* */
* (STK)=(INT32U) p_arg;/* R0: argument */
}

CodePudding user response:

PENDSV abnormal returns, pop-up LR PC hardware in turn from the task stack register values, then LR assigned to the PC, right?
  • Related