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

RTX OS_STKSIZE changes static memory use

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?

Parents
  • 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.

Reply
  • 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.

Children