MPC5604B - Mapping Constant Data in a Specific Flash Section

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

MPC5604B - Mapping Constant Data in a Specific Flash Section

927 Views
florian_d
Contributor I

Hi Everyone,

 

I'm working on a MPC5604B and I'm trying to customize the default Flash linker file in order to map my Interrupts Table appart from the default code section.

I shortened the default internal_flash section from 0x0007C000 to 0x0007B000 in order to reserve space for my ISR table. So now my .lcf file defines these two areas:

internal_flash:           org = 0x00003000,   len = 0x0007B000     (default area for flash code)
flash_isr_handler:        org = 0x0007E000,   len = 0x00001000     (my specific area for ISR table)

 

Then in the "Sections" part of the linker file, I set-up the relocation of my interrupt vector table into my dedicated area:

GROUP : {

     .mydatainflash (CONST) ALIGN(2048) : {

          *(.__initialized_flash_isr_handle)

          *(.__uninitialized_flash_isr_handle)

       }

    } > flash_isr_handler*/

 

However, when my program starts, It gets stucks in the IVOR2 Exception: "Data Storage Interrupt Handler", as if it would be trying to perform a kind of initialization of my table without the relevant permissions / access.

 

What is the solution to put Constant data in a specific Flash area appart from the rest of the code ?

 

 

Other information that might interrest you:

I get no problem when I locate my interrupt vector table in the internal_flash area like this - but it does not suit my needs:

    GROUP : {

      .text : {}

      .text_vle (VLECODE) ALIGN(0x08): {

         *(.text)

         *(.text_vle)

       }

       .rodata (CONST) : {

         *(.rdata)

         *(.rodata)

       }

       /** This works fine: */

       .__initialized_flash_isr_handle   ALIGN(2048) : {}

       .__uninitialized_flash_isr_handle ALIGN(2048) : {}

       .ctors : {}

       .dtors : {}

       extab : {}

       extabindex : {}

    } > internal_flash

 

 

My Interrupt Vectors Table is defined like that:

#pragma push /* Save the current state */
#pragma section data_type ".__initialized_flash_isr_handle" ".__uninitialized_flash_isr_handle"

 

const INTSInterruptFn INTSSwInterruptsTable[INTS_U8_NUMBER_OF_ISR] =

{

   interrupt_handler,    /* Vector - 0    software interrupt 0 */

    [...]

   interrupt_handler    /* Vector - 216  Reserved  */

};

#pragma pop

 

You wan find attached my whole linker file that make the problem occur.

Original Attachment has been moved to: FLASH.lcf.zip

Labels (1)
0 Kudos
1 Reply

346 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

look at these two examples. MPC5644A - Constant in flash shows, how to place constant data to flash. There are only changes in MPC5644.lcf file and main.c file.

Second example shows, how to place Interrupt Vector Table to the flash memory.

There are some points which has to be configured:

1)    In linker file is created section flash_handler which has to be aligned to 2KB and LOAD directive __flash_handler. Internal flash section  is moved to 5000.

2)    In file vector_MPC5606BK.c is changed pragma section.

3)    In the end of file IntcInterrupts.c is INTCInterruptsHandlerTable replaced by vectorTableIsr.

4)    In main function is set interrupt priority and base priority is set to 0.

If you have any question, please feel free to write me back.

Regards,

Martin

0 Kudos