How to place code generated from subsystem into RAM on Ti C2000?
Ältere Kommentare anzeigen
I am trying to plase parts of the code generated from one of the subsystems into RAM to speed up execution. The help provided in Control Data and Function Placement in Memory by Inserting Pragmas is not sufficient.
Is there a better explanation on how to add #pragma CODE_SECTION(myCriticalTask, "ramfuncs") to the generated function?
Do I need to edit linker command file?
Do I need to add code to copy function from flash to RAM on power up?
Thanks.
Akzeptierte Antwort
Weitere Antworten (3)
Valeriy
am 11 Mär. 2026
0 Stimmen
5 Kommentare
Umar
am 11 Mär. 2026
Hi @Valeriy,
Glad you're making progress! The reason you're only seeing the Simulink package options (MemConst, MemVolatile, etc.) is that the tic2000demospkg package hasn't been loaded into your model yet — the dropdown only shows sections from packages that are actively registered with the model.
Here's how to fix it:
Step 1 — Load the package into your model
Open the Embedded Coder app, then go to C Code → Code Interface → Embedded Coder Dictionary. Inside the dictionary window, look for a "Manage Packages" option. If tic2000demospkg doesn't appear in the list, click Refresh to scan for installed packages, then load it.
Step 2 — Check "Function with separate data"
Looking at your screenshot, I can see the "Function with separate data" checkbox is unchecked. You'll want to tick that box — without it, the memory section fields for subsystem data either stay limited or inherit from the model level, and some options won't show up. Once checked, you'll get the full set of memory section dropdowns for both initialize/terminate and execution functions.
After both steps, code_ramfuncs should appear in the dropdown and you can apply it directly to the subsystem.
Let me know if it shows up after the refresh!
Umar
am 15 Mär. 2026
Hi @Valeriy,
Please let me know if you need any further assistance.
Valeriy
am 19 Mär. 2026
Valeriy
am 20 Mär. 2026
Umar
am 21 Mär. 2026
Hi Valeriy,
Glad you got it working! It looks like you found the last couple of details yourself — great troubleshooting. Could you post your findings as a formal Answer so the thread is properly closed? Specifically the location of the 'Manage Packages' button and using the System Initialize block for the memcpy statement. It will be very helpful for anyone else hitting the same issue. Thanks!
Valeriy
am 23 Mär. 2026
0 Stimmen
Ganesh Thambhahalli Satyen
am 5 Jun. 2026 um 4:18
0 Stimmen
Hi,
The accepted answer is appropriate. To know more about this technique and other ways to enhance execution speed:
- Load Data/Code to Flash and Run from RAM (https://mathworks.com/help/ti-c2000/gs/load-data-code-to-flash.html) —
step-by-step walkthrough of using tic2000demospkg, the code_ramfuncs / const_data_ramfuncs memory sections, and applying
them to subsystems
- Enhance Code Execution Speed in TI C2000 Simulink Applications
of complementary techniques (CRL, FastRTS, TMU, inlining, data type selection) that stack well with RAM placement
Regards,
Ganesh
Kategorien
Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


