AnsweredAssumed Answered

Placing functions in ITCM RAM with IAR toolchain

Question asked by haun.mark.001 on Jan 20, 2016
Latest reply on Mar 9, 2016 by lush.ryan
I'm prototyping a DSP application on an STM32F7 Discovery board.  I'd like to move some critical filtering code into ITCM RAM, but not having any success.

In IAR, I name a new section and place some functions there using

#pragma default_function_attributes = @ "mysection"
...some functions...
#pragma default_function_attributes =

The linker file gets extra lines to place mysection at address 0x0 and initialize it:

define region ITCMRAM_region = mem:[from 0x00000000 to 0x00003FFF];
initialize by copy { section mysection };
place in ITCMRAM_region { section mysection };

When I examine the linker map file, I see that it is placing my functions at 0x0, as requested.  But IAR ILINK docs say the "initialize by copy" directive is supposed to create, automatically, an initializer section called mysection_init, which it will use to initialize the RAM segment during startup.  It does not.

I found an Atmel app note for their Cortex M7 part which confirms that this is the right way to go about it, except they had a bunch of extra instructions for enabling ITCM RAM.  As far as I can tell, it's already enabled at reset by default on STM32F7.  At least, in the debugger I can poke the RAM at 0x0 and it seems to "take".  But I apparently have not found the magic incantation to tell IAR to initialize that segment with my code.

FWIW I also get a fair bit of complaining when I attempt to flash the board using the ST-LINK driver in IAR.  But the app seems to execute correctly until it calls the non-existent functions at 0x0 and starts executing random instructions.

Has anyone tried this before?  Any idea what I'm missing?

Outcomes