Robert Lewis

Where to add code for ROM vector table copy to RAM?

Discussion created by Robert Lewis on Oct 23, 2012
Latest reply on Nov 1, 2012 by Robert Lewis

Hi

 

I rebuilt the mqx 3.8.1 for the k40, with the user_config.h with MQX_ROM_VECTORS   0

Then I changed the intflash.lcf to the code below, as per the appnotes and rebuilt the bsp.

 

But in what module do I add the code to copy the ROM vector table to RAM, is that in mqx_main.c in the bsp sources directory, or do I do that in my code? I am assuming that the table should be setup before the NVIC is set up? Which would put that into one of the bsp init modules, but which one?

 

Should I delete the first -->4th line because it is in the MEMORY {} array (this was dropped in from the appnote)?

 

Shouldn't the VectorRam start at 0x1FFF_8000 for the k40x256, the appnote uses 0x1FFF_0400

 

I am new to the lcf file and really do not have a good understanding of what is essential and what is not. Any help would be appreciated.

 

Thank you

 

Robert

/////////////////////////////////////////////////////////////////////////////////////////////

 

   vectorrom   (RX): ORIGIN = 0x00010000, LENGTH = 0x00000400

   cfmprotrom  (RX): ORIGIN = 0x00010400, LENGTH = 0x00000020

   rom         (RX): ORIGIN = 0x00010420, LENGTH = 0x0002FBE0  # Code + Const data  

   ram         (RW): ORIGIN = 0x1FFF8000, LENGTH = 0x00010000  # SRAM - RW data

 

 

   # kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap)

   end_of_kd   (RW): ORIGIN = 0x20007FF0, LENGTH = 0x00000000

  

   # Boot stack reused by MQX Kernel data

   bstack      (RW): ORIGIN = 0x20007A00, LENGTH = 0x00000200  # Boot stack

   end_bstack  (RW): ORIGIN = 0x20007BFF, LENGTH = 0x00000000

}

KEEP_SECTION { .vectortable }

MEMORY {

   interrupts (RX) : ORIGIN = 0x00010000, LENGTH = 0x00000400

   vectorram (RWX) : ORIGIN = 0x1FFF0000, LENGTH = 0x00000400

   data (RW) : ORIGIN = 0x1FFF0400, LENGTH = 0x0002FC00

}

.interrupts :

{

___VECTOR_ROM = .;

* (.vectortable)

. = ALIGN (0x4);

} > interrupts

.vectorram : {

___VECTOR_RAM = .;

} > vectorram

 

 

Outcomes