Forum Discussion
Altera_Forum
Honored Contributor
21 years agoNIOSII uCOSII Stack - 2 bytes wide, or 4?
I have just started with some of the examples. The ported uCOS-II code seems to indicate in many places that only a 16bit stack is needed. I am assuming this is incorrect as my programs always crash ...
Altera_Forum
Honored Contributor
21 years agoWhat do you mean by a "16-bit stack"? The stack is just a chunk of memory, like any other. As long as the pointer you pass to the OSCreateTask is actually the end of your allocated stack, there shouldn't be a problem (Although the base address probably needs to be 32-bit aligned. The NIOS processor seems to behave very strangely when trying to access misaligned data)
OS_STK is indeed 4 bytes which IMO is just a pointless recipe for stupid bugs. One of these appears to be that the sizes returned from OSStkChk are measure in bytes, not OS_STKs... By default, tasks created with sys_new_task get an 2K OS_STK stack (= 8KBytes) , but they are NOT created with the OS_STK_CLR and OS_STK_CHK options. You should check that before believing the task usage stats. - Roddy