cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151C6 RAM variables initialization

parketny
Associate II
Posted on September 13, 2013 at 13:05

Hi all,

I am creating code for the STM32L151C6U6 Microcontroller with IAR EW for ARM V6.60. I am now facing a serious problem that seems to lie in the ''__iar_data_init3'' startup function. For this special case (Optimizationlevel = low, code size near 32kB) all static RAM variables are not initialized correctly. When removing some code or changing the optimization level, i.e. reducing the code size, it works again. When using exactly the same code on the STM32L151CBU6 (128kB) it also works. I would now like to know whether this is a problem coming from IAR or from STM. In the latter case I would assume that someone before has witnessed this behaviour?

Regards,

Tobias

#stm32l151c6
1 REPLY 1
Posted on September 13, 2013 at 14:10

Sounds more like you haven't conveyed the ROM/FLASH size to the linker properly, the statics will follow after the code. You should review the .MAP and .HEX files to understand the true scope of the image placed in FLASH. You'll need to understand the linker output to see where the issue is coming from.

You should check the right target part is selected, that the scope of the FLASH and RAM are correctly specified, this will be somewhere in the project options (sorry I'm a Keil guy), scatter file or linker script.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..