We're trying to implement a small (<12KB) bootloader for the RM46L852 using HalCoGen 4.03 with the GCC toolchain.
The standard HalcoGen UART project (that can print text strings via the UART) is used as a base, and then we call the F021 flash API as described in the F021 documentation PDF.
The application is flashed to address 0. In main() it copies itself to the top 16KB of RAM via assembly code called from main(), and jumps to that position and continues execution (absolute jump from instruction in flash to the 'following' instruction in RAM, without reset)..
Everything up to the call to main is unmodified HalCoGen code.
We can print via UART and also successfully execute erase and program operations on FlashBank7 - running from RAM at 192MHz. Printing the value of the PC also confirms running from RAM.
BUT... when we change to use FlashBank0, the call to Fapi_setActiveFlashBank(Fapi_FlashBank0) never returns...!
We have also tried to run at 180 MHZ and even lower, with no change. (Can the FAPI run at 192MHz?)
Disassembling the .ELF file to see the Fapi_xxx functions seems to indicate that the code is relocated correctly, so function calls/jumps are relative and accesses to RAM variables are in the 0x8000000 + stacks area.
What can cause Fapi_setActiveFlashBank(Fapi_FlashBank0) to fail ?
Is this way of using HalcoGen + Fapi simply not possible for some reason?
Kind Regards
Niels G.