TFM and hardfault with NonSecure application
Hi,
We are currently using an stm32l5 in our product and experimenting with a stm32L562E-dk and with the official TFM (https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git master branch on the latest commit at this date.) The TFM is unmodified.
We are building the test-app and followed the documentation : https://tf-m-user-guide.trustedfirmware.org/platform/ext/target/stm/stm32l562e_dk/readme.html. The test-app is running well.
The issues arises when we want to modify the test-app :
lib/ext/tfm_test_repo-src/app/main_ns.cAccessing registers such as SCB, NVIC will trigger an Hardfault. (So impossible to call HAL_Init and impossible to build a real application to interract with the TFM).
For example adding in the application :
volatile uint32_t scb = SCB->AIRCR;
LOG_MSG("Non-Secure system starting...\r\n");Will trigger an hardfault (busfault excalated to hardfault) on the register access
After a long investigation, we don't see an explanation as the current protection (MPU, IDAU, SAU, GTZC) shouldn't have an influence and our application and shouldn't trigger this behavior.
While still in the TFM before booting the NonSecure app, they are no problems to access the SCB registers (SCB and SCB_NS).
Do you have any hint or explanation ?
Thank you,
Regards,
Romain
