AnsweredAssumed Answered

placing data in an absolute address in flash(ROM)

Question asked by Koorosh Hajiani on Jun 21, 2017
Latest reply on Jun 26, 2017 by Koorosh Hajiani

Hi,

I'm trying to place a variable called my_checksum in an absolute flash location. Target is S32K144EVB and I'm using design studio 1.3. Here is what I did:

In the linker file used for this project which is attached.I added  m_chksum to memory areas:

 

/* Specify the memory areas */

MEMORY

{

/* Flash */

m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400

m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010

m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00070000/*0x0007FBF0*/

/*this was added*/

m_chksum (RX) : ORIGIN = 0x00070410, LENGTH = 0x00000008

/* SRAM_L */

m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000

 

/* SRAM_U */

m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000

}

 

and added the section below:

 

/* koor added*/

.myBufBlock :

{

. = ALIGN(4);

KEEP(*(.myBufBlock)) /* keep my variable even if not referenced */

. = ALIGN(4);

} > m_chksum

 

In the main.c I added the line below, just before main()

 

__attribute__((section (".myBufBlock"))) unsigned long my_chksum=0X12345678 ;

 

looking at the MAP file it places my_chksum at  0x1fff8400                my_chksum

which is the start of the code _ram in .data section .

 

Any idea why is it doing that?

The target is a 512k part and I am not exceeding that .when I build the code and run , everything seems normal except the address of my_chksum variable.

 

Thanks,

Koorosh Hajiani

Original Attachment has been moved to: S32K1xx_flash.ld.zip

Outcomes