We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello there,
I am having a stack overflow on a cortex-M3, using RL-ARM. I have my memory allocated as follows:
main stack size: 1042 bytes (0x0000 0412, configured in startup_stm32f10x_cl.s) heap size: 1042 bytes (0x0000 0412, configured in startup_stm32f10x_cl.s) individual task stacks: init task: 160 bytes task 1: 512 bytes task 2: 348 bytes task 3: 348 bytes task 4: 210 bytes task 5: 200 bytes task 6: 200 bytes
I have a task called "init" that exists to start the other tasks. init is getting passed to os_sys_init_user. The problem is that program execution never gets into the body of init (if I put a breakpoint on the first line of init, it never gets there).
Some other features of how I have things set up:
I am using os_sys_init_user (rather than os_sys_init) to start *all* of my tasks, including init, to make it easy for me to fine-tune the size of each task's stack. In RTX_Config.c, I have the following settings:
Number of concurrent running tasks: 7 Number of tasks with user-provided stack: 7 Task stack size [bytes]: 20 Check for stack overflow: checked Run in privileged mode: checked Number of user timers: 5
I figure if I am using user-provided stack for every task, the task size value in RTX_Config.c shouldn't matter (20 seemed to be the min value it would let me use). Is that assumption correct? I've tried upping the size of the main stack size in startup_stm32f10x_cl.s, and I've tried upping the size of the user-defined stack allocated to init. In both cases I program execution ended up in os_stk_overflow.
What can I do to fix this overflow? Any thoughts would be greatly appreciated.
thanks, David Merrill
Finally, if I have "check for stack overflow" enabled, will this monitor overflow on all (9) stacks?
No.
Please refer to:
http://www.keil.com/support/man/docs/rlarm/rlarm_ar_cfgtask.htm
* In addition to OS_TASKCNT user tasks, the system creates one system task os_idle_demon. This task is always required by the RTX kernel. Total number of concurrent running tasks is OS_TASKCNT+1 (number of user tasks plus one system task).
http://www.keil.com/support/man/docs/rlarm/rlarm_ar_stack_man.htm
The other stack spaces need to be configured from the ARM startup file.
Maybe see these:
http://www.keil.com/forum/docs/thread14201.asp
http://www.keil.com/forum/docs/thread14778.asp
http://www.keil.com/forum/docs/thread14294.asp
http://www.keil.com/support/man/docs/rlarm/rlarm_ar_cfgstack.htm
On the full context task switch, the RTX kernel stores all ARM registers on the stack. Full task context storing requires 64 bytes of stack.