AnsweredAssumed Answered

Issue in placing a function to a particular location in flash

Question asked by Mohammed Shibin on Nov 29, 2014

Hai all,

 

I am facing some problems while placing a function in a particular location in flash memory.

 

I have explained the issues below.

 

 

To do this I modified the LCF as follows.

/**********************************************************************/

resetvector:      org = 0x00030000,   len = 0x00000010

init:                  org = 0x00030010,   len = 0x00000FF0 /* ~4K */

exception_handlers_p0: org = 0x00080000,   len = 0x00010000

exception_handlers_p1: org = 0x00090000,   len = 0x00010000

internal_flash:        org = 0x000A0000,   len = 0x00090000 /* 1792 KB*/

myrom_1:                org = 0x00130000,       len = 0x00004000

key_segment:      org = 0x0013FFF8,   len = 0x00000008 /* 8 byte for key*/

/***************************************************************************/

 

/***************************************************************************/

GROUP : {

.rom_symbols1 (VLECODE):

{

      __ROM_SYMBOLS = 0x00130000; /* start address of the new symbol area */

      . = ALIGN (0x4);

      *(.romsymbols1) /* actual data matching pragma directives. */

      . = ALIGN (0x4);

      }

} > myrom_1

     

 

.__key_segment LOAD (0x0013FFF8): {} > key_segment

/***************************************************************************/

 

 

In source code I declared the function as follows.

 

#pragma section RX ".romsymbols1" code_mode=far_abs

__declspec(section ".romsymbols1") void funcInROM_Test_1(int flag,int *); //Function Prototype

 

#pragma push

#pragma section all_types ".__key_segment" ".__key_segment"

unsigned long long key = BOOT_KEY;

#pragma pop

 

 

void funcInROM_Test_1(int flag,int *iData)

{

      const int i = 55;

      if (flag > 0)

      {

            flag ++;

      }

      *iData = 111;

}

 

 

Program compiled successfully and I verified the MAP file. I n MAP file I can see both the functions are placed in locations as I expected. But

 

.rom_symbols1 section layout

Starting        Virtual  File

address  Size   address offset

---------------------------------

00000000 00000c 00130000 0000e1d0 1 .romsymbols1   OBC_Main_c.obj

00000000 00000c 00130000 0000e1d0 2 funcInROM_Test_1     OBC_Main_c.obj

 

 

In memory map section I found the following line.

 

 

Memory map:

.rom_symbols1                 00130000 0000000c 0000e1d0 000ad270 000ad270         34572 0000d270 DP_SPL_6202_FWO_QT(RSM)_PXS3020_1V00.000A0000.bin

 

Starting Address – 0x00130000;

Size – 0x0000000c;

File Offset – 0x0000e1d0;

ROM Address – 0x000ad270;

RAM Buffer Address – 0x000ad270;

S Record Line number – 34572;

Bin file offset – 0x0000d270;

Bin file Name - DP_SPL_6202_FWO_QT(RSM)_PXS3020_1V00.000A0000.bin

 

Here S Record Line number and the corresponding address made me confused. The memory address available at line number 34572 is not matching with 0x00130000. Please check the attachment.  Instead of 0x00130000, it is 0x000ad270.

 

A screenshot of the location 0x00130000 is also attached. Please check it.

 

This made me really confused. Somebody please help me to solve this problem.

I will appreciate any help.

 

Thank you all.

Original Attachment has been moved to: DP_SPL_6202_FWO_QT(RSM)_PXS3020_1V00.MAP.zip

Original Attachment has been moved to: MPC5675K_FLASH.lcf.zip

Original Attachment has been moved to: DP_SPL_6202_FWO_QT(RSM)_PXS3020_1V00.mot.zip

Outcomes