Locating pointer table to specific RAM address

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

Locating pointer table to specific RAM address

Jump to solution
1,102 Views
rmaier
Contributor III

How does one go about specifying a specific address for a variable (in my case pointer table)?

I can get the pointer table to be placed at the specific RAM address, but it is not initialized with the correct data (or any data?).

 

I start by adding a section in MEMORY

MEMORY
{
  FLASH_1      (RX)  : ORIGIN = 0x00000000LENGTH = 0x00000400
  FLASH_CONFIG (RX)  : ORIGIN = 0x00000400LENGTH = 0x00000010
  FLASH_2      (RX)  : ORIGIN = 0x00000410LENGTH = 0x0001BBF0
  CAL_FLASH    (RX)  : ORIGIN = 0x0001C000LENGTH = 0x00020000
  PTR_TABLE    (RW)  : ORIGIN = 0x1FFFF000LENGTH = 0x00000200
  SRAM         (RW)  : ORIGIN = 0x1FFFF200LENGTH = 0x00003E00
}

 

Then, I reserve the memory:

.ptrTable :  AT(__DATA_ROM)
  {
    . = ALIGN(4);
    _ptrTableSection = ./* create a global symbol at PtrTable */
    *(.ptrTable)
    . = ALIGN(4);
  } > PTR_TABLE

 

Finally, the romp:

.romp : AT(_romp_at)
  {
  __S_romp = _romp_at;
    
    LONG(__DATA_ROM);
    LONG(_ptrTableSection);
    LONG(SIZEOF(.ptrTable));
    LONG(__DATA_ROM + SIZEOF(.ptrTable));
    LONG(_sdata);
    LONG(___data_size);
    LONG(0);
    LONG(0);
    LONG(0);
  } > SRAM

 

For now, my work around is to define the pointer table as ROM data then copy this over at runtime manually to the RAM pointer table. There must be a better way of doing this. What am I doing wrong here?

Thanks,

Robert

 

 

0 Kudos
1 Solution
1,083 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm afraid that you will need some routine for copying data from Flash vector table into RAM. Technically it is the very same process as initialized variables. 

 

The easiest way is left existing startup code and  move your RAM vector table into your section: 

jiri_kral_0-1619007620914.png

jiri_kral_1-1619007665110.png

Startup will copy data from Flash into RAM and setup VTOR register. 

 

Jiri 

 

 

 

View solution in original post

0 Kudos
2 Replies
1,075 Views
rmaier
Contributor III

Thanks for your help Jiri. Much appreciated.

 

Robert

0 Kudos
1,084 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm afraid that you will need some routine for copying data from Flash vector table into RAM. Technically it is the very same process as initialized variables. 

 

The easiest way is left existing startup code and  move your RAM vector table into your section: 

jiri_kral_0-1619007620914.png

jiri_kral_1-1619007665110.png

Startup will copy data from Flash into RAM and setup VTOR register. 

 

Jiri 

 

 

 

0 Kudos