AnsweredAssumed Answered

MPC5748G copy vector table from ROM to RAM

Question asked by Paul Candiago on Oct 22, 2019
Latest reply on Oct 30, 2019 by Paul Candiago

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;
    }

Outcomes