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.
The manual says: "Stack size used by RTX kernel is configured in STARTUP.S. Minimum size is 128 bytes, however 256 bytes is recommended when interrupts are used." However the map file says: " 144 26 32 8 2128 2829 rtx_config.o 64 26 288 0 2128 720 startup_stm32f10x_md_vl.o" This shows that stack size is assigned twice: 1. 2128 by rtx_config.o 2. 2128 by startup_stm32f10x_md_vl.o What is wrong? donald
Looks, that stack reuse is not implemented. I initially thought, that initial stack ( in startup.s) is defined as U64 stack_task1[100/8] U64* stack_init = &stack_task1 U8 stack_init_size = 40/8; This way stack during initialization is not waste of RAM and can be as big as the biggest task stack. Am I right? donald
The stack in the startup file does not look like that - the startup file is in assembler and not in C.
RTX supports user-defined stacks. So any memory block that is properly aligned and have a suitable size can be used as stack. It is then up to you to figure out how you want to make best use of your memory.
Is there a way to reuse initial stack memory after RTX startup? Can I declare variable in init_stack space? Do You know any macro for this purpose? donald
What about stack space of tasks, which were deleted by themselves? In one of examples task_init deletes itself. How much ram is lost, and how much recovered? donald
Is there a way to declare inital stack RAM location? donald
Did you real what i wrote? Have you looked at the actual API? If you use user-supplied stacks when you start a thread, then you can see the stack as just any buffer. So if you know that the thread has ended, then you can start a new thread and supply the exact same stack.
And if you have multiple threads that needs same-size stacks, then RTX have memory functions supporting allocation/release of these memory blocks similar to how you multiple times assigns data to specific indices of an array.
Start experimenting with the API instead of just asking questions. We just can't answer your questions without you understanding the API. And if you understand the API, then the reasons for most of your questions will go a way.
Programming is about combining LEGO pieces in different patterns. No one can describe all possible patterns which means that developers needs to be creative. The RTX manual do describe the individual LEGO pieces you have available.
Thanks for your patience. However my questions don't touch stack space in general, as you answered. I'm only concerned about initial stack defined in startup.s: Stack_Size EQU 0x0000100
AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size
Where is Stack_Mem located? Could You please point me a reference to the manual, where API explains how to get the address (from C/C++ perspective) to assembly allocated initial stack ( in startup.s)? All other questions which I've asked are side effects of this main issue. donald
I haven't seen any feedback to my comment earlier that the normal way is to make the initial stack very small, and perform the majority of initialization within an RTX thread. Do you really need to reclaim these 128 bytes?
Well I have 8kB RAM part and my code need app. 800 bytes more. I'm looking anywhere for savings, but this seems to be painless. However looks impossible. donald
Make your own symbol in the startup file, representing the C variable name you want to use to reclaim stack space.