Well, I guess it will be related to RAM initialization. If you use FLASH target, this code is executed in INIT_Derivative function in MPC5674F_HWInit.c:
#if defined(ROM_VERSION) && (ROM_VERSION == 1)
/* 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 */
#endif
But because you use RAM target to build the image, it cannot be called because it would overwrite itself.
When BAM loads the image via serial interface, each write of BAM initializes the RAM. But this initializes only the image area, not rest of the RAM.
There are two options:
1. You can enlarge your image with dummy data, so the BAM will initialize also rest of the RAM. This can be recommended only for very small amount of RAM, otherwise the loading of image will take a lot of time.
2. Better option is to use the code above and adjust the addresses to simply init the rest of the RAM at the beginning.
Regards,
Lukas