Hi,
what about RAM initialization?
By default, the RAM is defined like this in the linker file:
internal_ram: org = 0x40000000, len = 0x00003000 /* 12K */
heap: org = 0x40003000, len = 0x00001000 /* 4K Heap */
stack: org = 0x40004000, len = 0x00001000 /* 4K Stack */
Then these numbers are used for RAM initialization (this can be also found in the linker file):
/* L2 SRAM Location (used for L2 SRAM initialization) */
L2SRAM_LOCATION = ADDR(internal_ram);
/* How many writes with stmw, 128 bytes each, are needed to cover
the whole L2SRAM (used for L2 SRAM initialization) */
L2SRAM_CNT = 0x5000 / 128;
The RAM is then initialized by this code in MPC5602P_HWInit.c:
/* SRAM initialization code*/
lis r11,L2SRAM_LOCATION@h
ori r11,r11,L2SRAM_LOCATION@l
/* Loops to cover L2SRAM, stmw allows 128 bytes (32 GPRS x 4 bytes) writes */
lis r12,L2SRAM_CNT@h
ori r12,r12,L2SRAM_CNT@l
mtctr r12
init_l2sram_loop:
stmw r0, 0(r11) /* Write 32 GPRs to SRAM*/
addi r11,r11,128 /* Inc the ram ptr; 32 GPRs * 4 bytes = 128B */
bdnz init_l2sram_loop /* Loop for L2SRAM_CNT times */
That means: if you moved your internal_ram segment to 0x40000D00, the RAM won't be initialized correctly. It's necessary to update L2SRAM_LOCATION in the linker file.
Regards,
Lukas