Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

about task stack initialize ?

Altera_Forum
Honored Contributor II
1,142 Views

how to initiaze the task stack when creating a task  

 

need help  

 

hope anybody could relay 

 

thanks
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
307 Views

Hi, 

I think you could use the example "Hello uCoSii"...
0 Kudos
Altera_Forum
Honored Contributor II
307 Views

hi 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
0 Kudos
Reply