aviad rossmann

MPC55XX linker - how to set the location of executable code in the flash

Discussion created by aviad rossmann on Dec 20, 2012
Latest reply on Jan 21, 2014 by Monali Haware

hey,

I'm working on a MPC5553 with CodeWarrior 2.8.

I'm writing a boot loader, therefore i need some of

my code to run from different addresses in the flash.

i understood that the way to relocate code is through the LCF

I've tried to set different memory sections

when i compile, the map file looks ok.

but when i try to debug i can see that some functions

call to empty memory.

 

                                init                    : org = 0x00000008, len = 0x00001000

                                int_flash0      : org = 0x00001008, len = 0x00040000

                                int_flash1      : org = 0x00041008, len = 0x00120000

SECTIONS

{

                /* INIT data */

                .rcw  : { *(.rcw) } > flash_rcw

 

                GROUP :

                {

                                .init       : { *(.init) }

                                .init_vle (VLECODE) ALIGN(0x10): {

                                *(.init)

                                *(.init_vle)}

                }>init

                                /* ROM data */

                GROUP :

                {

                                .text       : {}

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

                                *(.text)

                                *(.text_vle)}

                                .flash_data : {}

                                .flash_data_vle (VLECODE) ALIGN(0x10): {}

                                .rodata  (CONST) : {

                                *(.rdata)

                                *(.rodata) }

                .ctors : {}

                .dtors : {}

/* Exception table IVPR register must align on a 16-bit boundary */

/*  RAM is from 0x4000_0000 to 0x4000_FFFF; IVPR upper 16-bits */

/*  must align to 0x4000_xxxx for internal SRAM */

/*     So "ALIGN(0x10000) has been removed from .xcptn for SRAM  */

                .xcptn                ALIGN(0x100) : {}

                .xcptn_vle  (VLECODE) ALIGN(0x100) : {}

                extabindex : {}

                extab      : {}

/* align __DATA_ROM to .data start */

                __DATA_ROM = (. + 7) & ~7;

                } > int_flash0

 

                GROUP :

                {

                                /* special_code data */

                                .special_code LOAD(ADDR(int_flash1)): {special_code.o }

                  }>int_flash1

Outcomes