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;
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:
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?
At this point you could check SIU_RSR register to investigate reset reason. Probably device is reset for some reason.
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
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.