Hello I am using STM32F030K6 microcontroller and I want to put a constant in a fixed address of flash memory. I arrive to do it using following attribute
unsigned int const Type_Value __attribute__((at(0X08007FF0))) = K_MODELLO ;
I modified the ROM1 page so that the scattered file became as follow:
; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; ************************************************************* LR_IROM1 0x08000000 0x00007FF0 { ; load region size_region ER_IROM1 0x08000000 0x00007FF0 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00001000 { ; RW data .ANY (+RW +ZI) } }
It works, but if I try to move the constant in the address 0X08000000 , starting ROM1 from 0X08000008, it doesn't work, I mean that probably the linker overwrite with my constant, some part of the code. Does anyone can help me to understand why I cannot place my constant at 0X08000000 address? Thnaks in advance
But WHY do you want to do this? Won't putting stuff in the front of FLASH break the processor? I mean you understand what's going on there, right?
Make TWO Load Regions, define one with the size and location you want this stuff to reside in, and put a named read only section in it.
Thanks Pier for your reply. I'll do this. B/R