Placing HAL functions into ITCM RAM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-18 11:05 PM
Hello,
Is there a simple way how to tell CubeMX to place HAL drivers (all or selected modules) into ITCM RAM instead of FLASH? Or it is possible only by manual writing directive to each function?
If manual way is the only one, is it at least possible to tell CubeMX to keep directives when re-generating project code?
Thank you in advance.
Anton
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-19 01:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-19 12:50 AM
I think you have to modify your linker file. If you use IAR you can try to use the linker 'place in' directive like described here:
define symbol __ICFEDIT_region_ITCMR_start__ = 0x00000000;
define symbol __ICFEDIT_region_ITCMR_end__ = 0x0000FFFF;
define region ITCMR_region = mem:[from __ICFEDIT_region_ITCMR_start__ to __ICFEDIT_region_ITCMR_end__ ];
place in ITCMR_region { readonly object STM32H7xx_HAL_*.o };
According to the IAR linker manual the object keyword allows to use wildcards like STM32H7xx_HAL_*.o
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-19 01:20 AM
Unfortunately I'm using STM32CubeIDE. Is something similar possible also for GCC?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-19 01:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-29 12:45 AM
Thanks a lot. This will make it much simpler.
I have one additional question. So far I used directive: __attribute__((section(".itcm_text"))) in front of definition of each function I wanted to put into ITCMRAM. In linker script I have following:
/* Copy specific fast-executing code to ITCM RAM */
itcm_data = LOADADDR(.itcm_text);
.itcm_text :
{
. = ALIGN(4);
itcm_text_start = .;
*(.itcm_text)
*(.itcm_text*)
. = ALIGN(4);
itcm_text_end = .;
} >ITCM_RAM AT> FLASH
To add whole files I extended the script:
/* Copy specific fast-executing code to ITCM RAM */
itcm_data = LOADADDR(.itcm_text);
.itcm_text :
{
. = ALIGN(4);
itcm_text_start = .;
*(.itcm_text)
*(.itcm_text*)
./Target/build/file1.o (.text .text*)
./Target/build/file2.o (.text .text*)
./Target/build/file3.o (.text .text*)
./Target/build/file4.o (.text .text*)
. = ALIGN(4);
itcm_text_end = .;
} >ITCM_RAM AT> FLASH
Should I remove __attribute__((section(".itcm_text"))) in files placed in linker script? I can I keep it?
Thank you in advance