Moving ISRs to ITCM RAM
Hi folks,
I’m currently trying to move specific ISRs and time-critical DSP functions to ITCM RAM on an STM32F7. I’m having trouble getting my linker script to behave and was hoping someone might have a solution.
Setup:
- STM32F746ZG on a Nucleo-144 board
- SW4STM32 v1.13.1.201701261206 on Win7
There is surprisingly little info out there on getting this to work. Best I was able to find was here, 4-5 posts down: http://www.openstm32.org/tiki-view_forum_thread.php?comments_parentId=2381
Note that this is not about running code from FLASH via the ITCM bus - that is already working just fine, and significantly sped up my code execution vs using AXI - but rather moving specific functions to ITCM RAM to speed up ISRs when they fire.
The relevant sections of my linker script look like:
MEMORY
{
ITCM_RAM (rx) : ORIGIN = 0x00000000, LENGTH = 16K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
FLASH (rx) : ORIGIN = 0x00200000, LENGTH = 1024K /* Access FLASH via ITCM */
}
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* Copy specific fast-executing code into ITCM RAM */
.itcm_text :
{
. = ALIGN(4);
*(.itcm_text) /* Fast-executing code */
*(.itcm_text*) /* Fast-executing code */
. = ALIGN(4);
} >ITCM_RAM AT> FLASH
I then assign the functions to the itcm_text region with __attribute__((section(“.itcm_ram”)))
The compiler and linker try to do something with that section, but nothing actually ends up there. Looking at my output.map file, I see the section has been added but is empty. Excerpt below:
.isr_vector 0x00200000 0x1c8
0x00200000 . = ALIGN (0x4)
*(.isr_vector)
.isr_vector 0x00200000 0x1c8 startup/startup_stm32f746xx.o
0x00200000 g_pfnVectors
0x002001c8 . = ALIGN (0x4)
.itcm_text 0x00000000 0x0 load address 0x002001c8
0x00000000 . = ALIGN (0x4)
*(.itcm_text)
*(.itcm_text*)
0x00000000 . = ALIGN (0x4)
Any thoughts would be much appreciated!