LPC4078, uVision V4.74.0.22
I have 3 tasks in my system all of which I start with user defined stacks. I start one with os_sys_init_user() and the other two with os_tsk_create_user(). I therefore didn't expect that changing OS_STKSIZE would have any effect on my static memory use but it does.
OS_STKSIZE defines the number of 32bit entries used for RTX task stacks. When I increase this value the static RAM allocated to rtx_config.o changes by that amount.
I also have OS_PRIVCNT set to 3. ie I have declared that all 3 tasks have user provided stacks.
What is this RAM used for?
1) User Main task. You provided this stack 2) 2 Other User tasks. You provided stack for both of these. 3) 1 idle task. It needs a stack and uses the standard stack pool, what ever size it is.
static Memory allocated for stacks is (There is always at least 1 allocated)
(OS_TASK_CNT - OS_PRIV_CNT + 1) * OS_STKSIZE * 4;
If you provide all of the stacks for you tasks, then you just need to make OS_STKSIZE large enough to handle the idle task and no larger.
Many thanks Robert,
I've done some experiments and need around 600 bytes to run the idle task containing just
for (;;);
I'm surprised it is this high. I don't think that interrupts use task stacks so I'm at a loss to know what the 600 bytes is used for. To be sure my delivered code runs reliably I've doubled the figure.