AnsweredAssumed Answered

MCUXpresso linker settings

Question asked by Anuj Tanksali on Jul 3, 2019
Latest reply on Jul 5, 2019 by jeremyzhou

Hello,

 

I am using I.MXRT1064 EVK board. I wanted to place a section in fixed memory address 0x70004000. Currently i manually configure the linker to insert the section in memory location. 

 

I have defined two flash regions in memory settings in MCUXpresso. 0x70004000 to 0x70004400 contains the my image header information and 0x700004400 to 0x70400000 contains my actual application. 

 

I have written the code to place the section by using section name defined below

__attribute__((section(".imageHeader")))
tempstruct imageHeader = TEMPLATE;      

 

tempstruct is a structure and i assign values to structure by defining values in my TEMPLATE

 

currently i manual edit the linker file to insert the .imageheader in section. see below linker information about imageheader.

 

ENTRY(ResetISR)

SECTIONS
{
.text_Flash2 : ALIGN(4)
{
FILL(0xff)

KEEP(*(.imageHeader))
. = 0x400;

*(.text_Flash2*) /* for compatibility with previous releases */
*(.text_HEADER*) /* for compatibility with previous releases */
*(.text.$Flash2*)
*(.text.$HEADER*)
*(.rodata.$Flash2*)
*(.rodata.$HEADER*)
} > HEADER

 

}

 

currently i have to include KEEP keyword to place my structure in the section and  the .bin file generated for the image contains the TEMPLATE values which i have assigned. 

 

If i dont use KEEP then my section imageHeader is not written in the .bin file generated. What could be the reason?

 

 

if I wanted to avoid manual modification of linker and use auto generation of linker file and achieve same result what should i do. My image header should be inserted at address 0x70004000. How do i achieve this using auto generated linker.

 

Regards,

 

Anuj

 

Outcomes