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->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?
What address is the above code accessing? The FVP memory map is below, unlikely to match the MCU you are using exactly
Other details on the FVP:
Thanks, that makes a lot of sense. Code is accessing addresses starting from 0x40020000 which are not used by MPS2.
Is there any common workaround to easily remap the addresses? Or some other approach to get the code running?
I'm trying to use FVP for running unit tests. I don't need any simulated behavior from the accessed address spaces. If I could just write and read those registers, and retarget stdout somewhere to get the results, I would be more than happy. I've previously used Keil simulator to do this on Cortex-M3 but it seems not to be an option anymore for Cortex-M33.
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.
View all questions in Simulation Models forum