This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

stack overflow on os_sys_init_user

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

Parents
  • You need to set the stack size to at least 68 bytes in RTX_Config.c. This stack is still used for the system idle task os_idle_demon.

    When the idle task is created in the os_sys_init_user() function, a stack overflow is detected as the task manager tries to initialize 64-bytes on the idle task's stack.

Reply
  • You need to set the stack size to at least 68 bytes in RTX_Config.c. This stack is still used for the system idle task os_idle_demon.

    When the idle task is created in the os_sys_init_user() function, a stack overflow is detected as the task manager tries to initialize 64-bytes on the idle task's stack.

Children