FreeRTOS Heap - CubeMx Bug?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-08-09 3:40 AM
Dear,
In CubeMx I have 3 statically allocated tasks wit stack size 256 words for each one, and also I have some Heap for dynamic allocation.
My Question:
Why in Cube I can not set TOTAL_HEAP_SIZE for example to 1000 (for my dynamic allocation pvPortMalloc) and stacks with size 256? The TOTAL_HEAP_SIZE should not affect to stack size is not it?
Also you can check problem on short video there: https://www.youtube.com/watch?v=ookcCYnF4k4&feature=youtu.be
If I know statically allocated memory, by definition, does not come out of the heap. The amount of memory available for use as the heap is the total memory available, minus statically allocated memory (minus the .data section, etc.).
- Labels:
-
FreeRTOS
-
STM32CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-08-09 8:07 AM
FreeRTOS dynamically-allocated stacks and pvPortMalloc come from single pool TOTAL_HEAP_SIZE.
static stacks etc. not from this pool.
Can you clarify your question??
Are you saying CubeMX doesn't work properly for this case?
Warning: Using heap via malloc-functions in FreeRTOS tasks with STM-provided sbrk function always fails (pvPortMalloc OK);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-08-10 7:56 AM
Hi,
Maybe just a reminder:
- TOTAL_HEAP_SIZE is a number of Bytes (== 8 bits)
- Stack size is a number of Words (== 32 bits here)
- respecting FreeRTOS implementation (cf https://www.freertos.org/a00110.html)
Meaning:
- a total heap size of 1000 Bytes, is equivalent to 250 Words (of 32bits)
- the stack size of a task then can only have a value between configMINIMAL_STACK_SIZE (frequently 128) and configTOTAL_HEAP_SIZE/4 (here 1000/4=250)
It may help in the current example.
Regards,
Fred
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-08-10 8:34 AM
This is the main problem with ST's software developers - absolutely blatant incompetency.
Go learn what a "static allocation" means...
https://www.freertos.org/Static_Vs_Dynamic_Memory_Allocation.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-08-10 11:14 AM
Sorry for my previous post, completely out of scope. My mistake.
For sure, what I wrote only applies to dynamic tasks, it should in fact, as it is not right now: CubeMx Is wrongly applying that limit linked to the heap size to static tasks, while it should not, as analysed in the original post of JAN R.
This is a bug to be corrected in the next CubeMx release.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-08-10 12:02 PM
Now You're acting like You should! =)
Though "statically allocated tasks" were among the first words in the first sentence of original post and "statically allocated memory" repeated twice further down...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2019-08-12 12:08 AM
Thank you very much,
Do you have any estimate for date of release next CubeMX?
