Nov 18, 2019
03:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 18, 2019
03:59 AM
Hello everybody,
I have analyzed a little and found that PSRAM is used by the flash code (so called RAM code) and by the CMSIS RTOS it loads and executes own code from the PSRAM therefore there is only 16-20 kb left.
Is there any way to allocate more stack? e.g. load RTOS to the RAM (even better to ROM)
Thanks,
madmat
I have analyzed a little and found that PSRAM is used by the flash code (so called RAM code) and by the CMSIS RTOS it loads and executes own code from the PSRAM therefore there is only 16-20 kb left.
Is there any way to allocate more stack? e.g. load RTOS to the RAM (even better to ROM)
Thanks,
madmat
2 Replies
Nov 19, 2019
05:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 19, 2019
05:15 AM
Hi,
You can modify the default linker file to fit your needs.
Regards,
Jesus
You can modify the default linker file to fit your needs.
Regards,
Jesus
Nov 20, 2019
12:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 20, 2019
12:06 AM
Hi Jesus,
I have made following changes to the linker_script.ld:
stack_size = DEFINED(stack_size) ? stack_size : 0x4000;
this means (I found myself) that inside ELF image stack section would become 16 kb, but when i create thread I put there 32kb stack size. In this case the loader allocates for the stack first 16 kb (little more) and it is followed by the flash (RAM code) and then coming RTOS.
In another words i have PSRAM:
PSRAM_1(!RX) : ORIGIN = 0x1FFE8000, LENGTH = 0x18000
size 96 kb, I reserve ~16kb for the stack, but inside the main thread I allocate 32 kb.
0x1FFE8000 - 0x1FFEC000 - reserved stack
0x1FFEC000 - 0x1FFExxxx - Flash loader
0x1FFExxxx - 0x1FFFFFFF - RTOS stuff
in this case it some time works when at time of stack initialization at address 0x1FFF0000 there is no important flash (RAM) code, otherwise it wont flash,
in case wen it flashes (later this code I guess is not used), and also the important parts of the RTOS were not corrupted by the stack, the application works fine, but this happens not too often
How I can modify linker script to load the RTOS somewhere else, or some another way to allocate 32kb of stack not so weird as I do now?
Thanks,
madmat
I have made following changes to the linker_script.ld:
stack_size = DEFINED(stack_size) ? stack_size : 0x4000;
this means (I found myself) that inside ELF image stack section would become 16 kb, but when i create thread I put there 32kb stack size. In this case the loader allocates for the stack first 16 kb (little more) and it is followed by the flash (RAM code) and then coming RTOS.
In another words i have PSRAM:
PSRAM_1(!RX) : ORIGIN = 0x1FFE8000, LENGTH = 0x18000
size 96 kb, I reserve ~16kb for the stack, but inside the main thread I allocate 32 kb.
0x1FFE8000 - 0x1FFEC000 - reserved stack
0x1FFEC000 - 0x1FFExxxx - Flash loader
0x1FFExxxx - 0x1FFFFFFF - RTOS stuff
in this case it some time works when at time of stack initialization at address 0x1FFF0000 there is no important flash (RAM) code, otherwise it wont flash,
in case wen it flashes (later this code I guess is not used), and also the important parts of the RTOS were not corrupted by the stack, the application works fine, but this happens not too often
How I can modify linker script to load the RTOS somewhere else, or some another way to allocate 32kb of stack not so weird as I do now?
Thanks,
madmat