Repository navigation
Name the memory section of stack and TCB of timer task - #798
aymenjebalibmw wants to merge 1 commit into
Conversation
This allows to link the named memory section to a dedicated partition of the RAM. For example for performance reasons, we can link the stack region into a low latency RAM memory. This feature is also useful to protect Task Stacks from overflowing each others, considering that we protect by MPU each stack.
|
This would introduce compiler dependent code into the code ThreadX sources. Wouldn't it be better to perform the placement directly in the linker script instead? |
Linker regular expression on LLVM didn't work to catch the required symbol. I can change it to something like this, so in tx_user.h the proper compiler pragma/attribute can be specified:
|
|
You might need to compile with the -fdata-sections flags to get each symbol into a different section. Then, I think you should be able to isolate it directly in the linker script. As for the section name macro this would not be fully portable sadly since some compilers using pragmas instead of variable attributes require the pragma to be before the symbol definition. |
yes we do use |
|
not needed, |
|
Shit!!! closing was too quick. there is no way arround the named memory section for the feature I need. The issue as afollowing, we would like to have contiguous address space with no gaps for the TCBs and place them into one unique MPU region, the stacks are all together inside one other region. |
|
Thanks for working this through on hardware, and no harm done on the quick close — @blanchardj-dev's call is right, and the linker script is the answer here. The set of symbols you cannot reach from your own code is closed: your application's TCBs and stacks are your own variables, so you place those yourself and match them with a wildcard. ThreadX adds exactly two, Grouping them with your own sections, gap-free, is what the script is for: The order you write is the order you get, so there is no RAM sub-partitioning and no manual sizing. If you would rather have no kernel-owned stack in the MPU map at all, |
|
Hi @fdesbiens Thanks for your feedback. The TX_TIMER_PROCESS_IN_ISR configuration is not recommended for safety critical applications. There are good reasons that compilers support named memory sections. When you look into memap concept of AUTOSAR, you will see enough good reasons for that. We apply the patch for our project. |
|
Thanks @aymenjebalibmw. Fair on For safety-critical, there may be a better fit than section placement. If you are on Cortex-R52, the module manager port shipped in v6.5.2.202603_rel, and there is a protection-boundary example for an S32Z280 EVB in the tree at The honest limit: isolation is per module, not per thread. Two threads in one module share a data region and can still overwrite each other's stacks. One task per module restores per-task isolation, at the cost of reprogramming regions on every context switch. If your freedom-from-interference argument is at partition level, modules are the right tool; if you need one MPU region per task stack, no ThreadX port offers that today and that part is yours to write either way. If you stay non-module, Separately, and not an answer to this: ZoneX, the suite's Armv8-R partitioning hypervisor, declares partitions from a manifest rather than assembling them in a linker script, which is the instinct behind your MemMap point. It is at v0.1.0 and explicitly not production software, but if that direction interests you, feedback at this stage is worth a lot. Either way, carrying your patch locally is fine. The licence is MIT, and it is two symbols in one file whose names do not move between releases. Thanks for raising it, and for the hardware validation. |
This allows to link the named memory section to a dedicated partition of the RAM. For example for performance reasons, we can link the stack region into a low latency RAM memory. This feature is also useful to protect Task Stacks from overflowing each others, considering that we protect by MPU each stack.
PR checklist