Locating pointer table to specific RAM address

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Locating pointer table to specific RAM address

ソリューションへジャンプ
2,045件の閲覧回数
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 件の賞賛
返信
1 解決策
2,026件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
2,018件の閲覧回数
rmaier
Contributor III

Thanks for your help Jiri. Much appreciated.

 

Robert

0 件の賞賛
返信
2,027件の閲覧回数
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 件の賞賛
返信