Hi there,
I try to write a bootloader from scratch for Rm46L852. I use Halcogen to create the low level routines. In Halcogen I disable all drivers except CAN and configure nothing but the CAN Interface and the HCLK. I use the Fapi Version 2.01.01. I link the F021_API_CortexR4_LE_V3D16.lib against my Project using the Project ARM linker Settings (include library file). So far I leave the sys_link.cmd untouched.
Now when I run the initialization for the Fapi the call to Fapi_setActiveFlashBank(Fapi_FlashBank0) hangs in Interrupt vectors undefEntry:
Fapi_StatusType Status = Fapi_initializeFlashBanks(HCLK_FREQ);
if (Status != Fapi_Status_Success) return Status;
Status = Fapi_setActiveFlashBank(Fapi_FlashBank0); // -> hangs in undefEntry
if (Status != Fapi_Status_Success) return Status;
I see from the bootloader sample that I have up and running that I have to do some more tweaks to get the Fapi to work, but I am not able to configure my Project correctly. Also the documentation that Comes with Fapi 2.01.01 does not tell anything about it. I know that
1) I Need to run the bootloader in Supervisor mode. Even though I did not configure this Register SPSR_SVC:M = 10011 which indicates Supervisor mode. So this seems to be OK.
2) I need to somehow copy the FAPI to RAM. I see from the bootloader sample code that there is a function called "_copyAPI2RAM_" in "syscore.asm", a function called "setupFlash" in "system.c" and some entries that define a "FLASH_API" section in "bl_link.cmd" that deal with the issue.
Now I do not find the right mix of what I really need of this in my bootloader. What is really required and what not and what is it good for in the first place, since the Fapi documentaion does not mention anything about that. And I actually do not want to patch the Halcogen maintained files if it is avoidable.
Could you give me some insight into this please?
Regards
Johannes