mcp5554 run code from ram

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

mcp5554 run code from ram

1,186 Views
franme
Contributor I

hi i would you like to write with an external tool a code into ram and run it without change the memory flash. I write a simple code for blink a led( work fine into flash), i modify the lcf file to place this code in the ram, i use the ICDPPCNEXUS to write it. the code is correctly write into the ram( if i jump with PC i see the main code ), after i change the PC to jump on start and play run, the PC re jump into flash. if i load the PE algoritm, the code work fine from the ram. I don't know were is the problem. can help me

 

/* lcf file for MPC5554 (debug RAM version) */

 

/* 2 MB Flash, 64KB SRAM */

MEMORY
{
mail_box : org = 0x40000000, len = 0x00000100
resetvector: org = 0x40000100, len = 0x00000100
init: org = 0x40001000, len = 0x00001000
exception_handlers: org = 0x40002000, len = 0x00001000
pseudo_rom: org = 0x40003000, len = 0x00003000
internal_ram: org = 0x40006000, len = 0x00001400
heap : org = 0x40007400, len = 0x00000400 /* Heap start location */
stack : org = 0x40007800, len = 0x00000400 /* Start location for Stack */
}

 


SECTIONS
{
.__bam_bootarea: {} > resetvector

GROUP : {
.init LOAD (0x40001000): {}
.init_vle (VLECODE) LOAD (_e_init): {
*(.init)
*(.init_vle)
}
} > init

.__exception_handlers LOAD (0x40002000): {} > exception_handlers

GROUP : {
.text (TEXT) ALIGN(0x1000) : {}
.text_vle (VLECODE) ALIGN(0x1000): {
*(.text)
*(.text_vle)
}
.rodata (CONST) : {
*(.rdata)
*(.rodata)
}
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}
} > pseudo_rom

GROUP : {
.__uninitialized_intc_handlertable ALIGN(0x10) : {}
.data : {}
.sdata : {}
.sbss : {}
.sdata2 : {}
.sbss2 : {}
.bss : {}
} > internal_ram
}

/* Freescale CodeWarrior compiler address designations */

_stack_addr = ADDR(stack)+SIZEOF(stack);
_stack_end = ADDR(stack);
_heap_addr = ADDR(heap);
_heap_end = ADDR(heap)+SIZEOF(heap);

/* Exceptions Handlers Location (used in Exceptions.c for IVPR initialization) */

EXCEPTION_HANDLERS = ADDR(exception_handlers);


/* L2 SRAM Location (used for L2 SRAM initialization) */

L2SRAM_LOCATION = 0x40000000;

Tags (1)
0 Kudos
8 Replies

1,157 Views
franme
Contributor I

sometimes work if i load the algoritm to program the flash with PEmicro

0 Kudos

1,166 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

No changes of linker file is needed, but user software should disable watchdog unless it will boot again from flash. Here you may see example for reference:

https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5554EVB-PinToggleStationery-CW210/ta-...

 

 

0 Kudos

1,161 Views
franme
Contributor I
hi david thank you for your help I started from a similar example, and today I have use your example, I select the ram option and i load the elf with ICDPPCNEXUS -> load a single debug file the program load all and the PC value indicate the __start point. i run the code and after some time i stop it the new value of pc is in the flash.  i don't know the problem.  can you help me thanks
0 Kudos

1,110 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Which address do you see in such case in the PC?

Does not it point to BAM address space i.e.0xFFFF_C000–0xFFFF_FFFF?

0 Kudos

1,096 Views
franme
Contributor I

hi david

if i go with single step the pc jump to 0x0000f000

if I play go and after stop the pc value loop near to 0xFFFFFxxx

you have any idea

Thank you

0 Kudos

1,083 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

At this point you could check SIU_RSR register to investigate reset reason. Probably device is reset for some reason.

0 Kudos

1,065 Views
franme
Contributor I

hi david 

I don't find the register RSR, I use your example in ram, i load it in ram the pc value is --start. but when i start the execution, the pc go to flash. 

i don't use any scripts to reset o load in the ram. i disable the watchdog in the debug windows nothing else

i know the micro very little, is it necessary other configuration for run in the ram?

thank you

Francesco

0 Kudos

1,014 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

If you are using PeMicro debugger, it should run debugger script at the beginning that is disabling watchdog, what I think is the root cause.

davidtosenovjan_0-1613667092489.png

 

0 Kudos