cancel
Showing results for 
Search instead for 
Did you mean: 

Placing functions in ITCM RAM with IAR toolchain

mhaun
Associate II
Posted on January 20, 2016 at 20:18

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?

1 REPLY 1
ryan2
Associate II
Posted on March 09, 2016 at 22:48

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6WN&d=%2Fa%2F0X0000000bpn%2FUckftiIOEfqYSNLBBDM3MjWvE48qbkvBwDH72P19nmk&asPdf=false