Forum Discussion
Altera_Forum
Honored Contributor
19 years agohi soin :
I have read the function OSTaskStkInit in os_cpu_c.c, but i can't unstand some code 1: stk = frame_pointer - 13; 2: stk[12] = (INT32U)task; /* task address (ra) */ 3: stk[11] = (INT32U) pdata; /* first register argument (r4) */ 4:#if OS_THREAD_SAFE_NEWLIB stk[10] = (INT32U) local_impure_ptr; /* value of _impure_ptr for this thread */# endif /* OS_THREAD_SAFE_NEWLIB */ 5: stk[0] = ((INT32U)&OSStartTsk) + 4;/* exception return address (ea) */ i undstand these codes simulate the complier's action. in line 1: why 13 , only initialize 4 of 13 at most, stk[9]...stk[1] is for what ? in line 5:why need initialize ea