MCUXpresso linker settings

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCUXpresso linker settings

1,711 Views
anujtanksali
Contributor II

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

Labels (1)
0 Kudos
3 Replies

1,386 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Anuj Tanksali,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) If I don't use KEEP then my section image header is not written in the .bin file generated. What could be the reason?
-- I'm afraid you can't ignore the KEEP keyword. It's determined by the format of the linker file.
2) Maybe you can try to separate out a new section whose range is between  0x70004000 to 0x70004400 via using the Memory Configuration Editor, then place the image header into this section.
And the method will make you don't worry about the linker file.
You can learn more information about this method via the thread:
https://community.nxp.com/thread/389101


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,386 Views
anujtanksali
Contributor II

Hello jeremyzhou

Thanks for the reply,

I have tried point no 2 above and no memory is allocated in the map for the section defined.

Am using __RODATA(flash2) and then my structure object is defined below this statement.

In configuration linker settings i have added the input section *(.ImageHeader) and placed in flash2 section

flash2 is defined in memory configuration from 0x70000000 to 0x70004000.

Can you please give an example where it works. Requirement is i have a structure which i want to place at fixed memory using auto generated linker file.

Regards,

Anuj 

0 Kudos

1,386 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Anuj Tanksali,

Thanks for your reply.
In the MCUXpresso IDE, I import an ADC demo from the SDK library, then split the flash as the Fig1 illustrates, then use the below code to assign the roarray[5] in the new flash section, from the Fig 2, you can see that the roarray[5] has been assigned to the new flash section

__RODATA(PROGRAM_FLASH_2048_1024)  const int roarray[5] = {10,20,30,40,50};

pastedImage_1.png

Fig1

pastedImage_3.png


Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos