I am using the fsl_flash Peripheral Driver from SDK 1.2.0 on KDS 3.0. Because this part does not have flex Ram
it only has 1 bank of flash.. Therefore when writing to the flash code must make a detour to RAM. The Driver
provides "RelocateFunction()" to move code to RAM. This works, although it does seem to have a bug (more on that later).
My problem is that the code jumps to the Ram Based function, the chip hangs up immediately.
#define LAUNCH_CMD_SIZE 0x100;
uint32_t pflash = 0x00038400;
pFlashCommandSequence = (pFLASHCOMMANDSEQUENCE)RelocateFunction((uint32_t)command_sequence , LAUNCH_CMD_SIZE ,(uint32_t)FlashCommandSequence);
FlashEraseSector(&flash1_InitConfig0, pflash, FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE, pFlashCommandSequence);
At the bottom of FlashEraseSector:
ret = pFlashCommandSequence(pSSDConfig);
This is where it crashes.
I have tried writing very simple functions to execute in RAM. I cant get that to work.
I tried using the demo aps: Flash_demo_twrk22f120m it worked once and then stopped.
There must be a compiler, linker or debugger setting causing my problem.