MPC5748G copy vector table from ROM to RAM

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

MPC5748G copy vector table from ROM to RAM

Jump to solution
1,346 Views
pcandiag
Contributor I

I would like to get confirmation if I'm doing this correctly.  I'm trying to Integrate FNET into my S32 Design Studio project.  For FNET to work it needs  to install vectors.  For this to happen the vector table needs to be in RAM.  To move the vector table from ROM to RAM  I think you need to do the following,  

1) Modify file MPC5748G_ram.ld  (I've identified the change I want to make) See cod SNIPET below

CODE SNIPET FROM FILE- MPC5748G_ram.ld 

COD SNIPET 

.intc_vector_table   : ALIGN(4096)
    {
        /* For FreeRTOS C55 v9.0.0 OSInterruptsHandlerTable must be placed at the same location as __VECTOR_RAM */
     OSInterruptsHandlerTable = .;
      /*  __VECTOR_TABLE = .;*/  <---------------------------------------------------------- I WANT TO COMMENT OUT THIS LINE
        __VECTOR_RAM = .;               /* No copy */
        . = ALIGN(4);
        KEEP(*(.intc_vector_table))     /* Startup code */
    } > SRAM
    __RAM_VECTOR_TABLE_SIZE = 0x0;

2) In startup.c, function init_data_bss(void) - See code snippet below,  this code should do the copying of the vector table in FLASH to RAM - Is my understanding correct, will this happen as I think?   Also who calls function init_data_bss(void) I can't seem to find out where this function is called?

Thanks,

Paul C

CODE SNIPET FROM FILE: startup.c,  FUNCTION:Startup.c

if (__VECTOR_RAM != __VECTOR_TABLE)
    {
        /* Copy the vector table from ROM to RAM */
        for (n = 0; n < (((uint32_t)__RAM_VECTOR_TABLE_SIZE)/sizeof(uint32_t)); n++)
        {
            __VECTOR_RAM[n] = __VECTOR_TABLE[n];
        }
        /* Point the VTOR to the position of vector table */
        *vectors[coreId] = (uint32_t)__VECTOR_RAM;
    }

0 Kudos
1 Solution
1,134 Views
raresvasile
NXP Employee
NXP Employee

Hi Paul,

The interrupt table is copied by default in RAM in init_data_bss, which is called in startup_MPC5748G.s before main function entry.

You can check if the vector is placed in ram by looking into INTC->IACKRn register. (n is the active core number).

Hope that this helps,

Rares

View solution in original post

0 Kudos
2 Replies
1,134 Views
candiapa
Contributor I

Rares,

Thanks for the feedback.  Checked the reference manual for the MPC5748G and what you wrote makes sense.

Thanks,

Paul Candiago

0 Kudos
1,135 Views
raresvasile
NXP Employee
NXP Employee

Hi Paul,

The interrupt table is copied by default in RAM in init_data_bss, which is called in startup_MPC5748G.s before main function entry.

You can check if the vector is placed in ram by looking into INTC->IACKRn register. (n is the active core number).

Hope that this helps,

Rares

0 Kudos