We're seeing two flash related issues when attempting to use the bootloader in AN12218 on a S32K144.
1. Sometimes the JumpToApplication() fails on
if(userSP == 0xFFFFFFFF){
return;
}
When I view it in the Memory Browser, 0x1000 shows up as 0xFFFFFFFF. If I power cycle without downloading again, the Memory Browser then reports 0x20007000 as expected and the system can boot.
2. When booting into a loaded application sometimes the system Hard-Faults. Our small test application sometimes works, but our larger real application never does. I added in a Verification of the flash writes in mem_man.c and it often fails. When we get the failures the application usually hard-faults.
/* Program phrase */
FlashProgram(&flashSSDConfig, flash_prog_address, data_size, BP->F.PhraseData, FlashCommandSequence);
uint32_t failAddress = 0x0;
flash_drv_status_t result = FlashProgramCheck(&flashSSDConfig, flash_prog_address, data_size, BP->F.PhraseData, &failAddress, 0x1U, FlashCommandSequence);
if(result != FTFx_OK)
{
// light the error LED.
led_turn_on(ERR_LED);
}
Thank you for your assistance.