In summary, I am getting a data-abort (imprecise I think) from a call to Fapi_initializeFlashBanks, and I believe this code works, so (I think) the CPU is in an improper state prior to this call. What conditions are necessary prior to this call, or what can I look at to trouble-shoot this?
The details: I am storing user-configuration variables in 1 upper segment of flash, so this block of code is trying to erase only that segment. This code used to work -- before I implemented a bootloader, which allows the user to upgrade the firmware without JTAG, so this new bootloader code has new Flash-manipulation code that must be leaving the flash-controller, or something, in the wrong state. I have tried various things: calling Fapi_initializeFlashBanks from RAM or Flash, disabling or enabling the ARM FlashECC, all of which have no effect. Also I am calling Fapi_initializeFlashBanks from System mode. I have read through your F021 Flash API guide and it states to call Fapi_initializeFlashBanks before anything else.
Also in the abort-handler, the ESM-registers are all zero, and the CPSR-A flag is set, which I think means it is an imprecise data abort.
Thanks,
Jim