I am working on a new project on 32F103 microcontrollers. The code appears to run fine on GD32, RX32 and STM32, but it fails to run on FCM32.

Initial investigation shows the code fails when it tries to initialise the RTC. For the RTC I am using the internal RC oscillator. Trying to enable it freezes the microcontroller. The failing call is


This expands to

(*(__IO uint32_t *) RCC_CSR_LSION_BB = ENABLE)

It appears this issue is documented in the application notes. While I can’t read Chinese, the issue seems to be the FCM32 does not implement bit banding, and this this expression needs to be rewritten.

Executing the code without modifications would write to an illegal memory address triggering a hard fault.

Now I know what the issue is, it seems easy enough to resolve. But that would require patching the HAL library, something I am not going to do at this moment in time.