Hi,
I'm developing firmware with LPCXpresso55S28 (Cortex-M33) and Keil µVision v5.34 and would like to debug my code using FVP. The example mentioned in this application note works perfectly.
However, when I use my code or even hello_world example for LPCXpresso55S28, I'm able to launch the debug session but once I access any register, I always get a hard fault.
static inline void POWER_SetBodVbatLevel(power_bod_vbat_level_t level, power_bod_hyst_t hyst, bool enBodVbatReset) { // For example writing to BODVBAT register causes hard fault with FVP PMC->BODVBAT = (PMC->BODVBAT & (~(PMC_BODVBAT_TRIGLVL_MASK | PMC_BODVBAT_HYST_MASK))) | PMC_BODVBAT_TRIGLVL(level) | PMC_BODVBAT_HYST(hyst); PMC->RESETCTRL = (PMC->RESETCTRL & (~PMC_RESETCTRL_BODVBATRESETENABLE_MASK)) | PMC_RESETCTRL_BODVBATRESETENABLE(enBodVbatReset); }
I'm using FVP executable FVP_MPS2_Cortex-M33_MDK.exe which I assume should be compatible. I have tried with every ARMCM33*.txt configuration file with same outcome.
Any idea what might be the problem?
Thanks.
The FVP is the replacement of the older Keil simulator, to support the latest features of the Cortex-M33.
How are the addresses for the peripherals placed? Does the code use a scatter file, or are they hard-wired in the source code? Either way, these would need to be modified for the FVP. This is no different than for porting code from any platform to another.
Thanks again, Ronan! Peripherals are hard-wired in LPC55S28.h which has 27k lines of definitions. I made a copy of it for FVP target and replaced a couple of registers to point to instances in RAM. I can control the "registers" I need and hard fault issues are gone for now.