Hi Roman,
So, when you add the "CONFIG_FLASH=y" setting to any project, you are able to run the application normally, except when you try to do any type of reset, which leads your program to be in an infinite loop at address 0x20005840, is my understanding correct?
Yes, this is correct. I'm only able to restart the program by powering the board off and back on.
Would you please check the Reset status Register (SYS_RST_STATUS) to check if the reset cause is being registered?
I'm currently trying these tests with the zephyr sample hello_world. With or without CONFIG_FLASH=y, and with my custom board or the actual FRDM-RW612, I wasn't able to get a value on SYS_RST_STATUS. I tried pressing the physical reset button (connected to PDn on the SOC), calling tfm_platform_system_reset() after the printf statement, and triggering a hardfault by accessing a NULL pointer, but none of these produced values on the reset status register.
I tried sampling it before reset, after reset in the loop at address 0x20005840, and after reset in the BL2 stage and no matter what SYS_RST_STATUS was 0. I'm not sure if I'm checking it wrong, I use GDB (through west attach) to debug and got the value within the PMU block by printing p *((PMU_Type*)0x40031000u). If it helps to know, the SYS_RST_EN register was always 0x39 when I sampled.
Additionally, have you done all your tests with the non-secure version of the board?
Yes, I build all of these tests clean by removing the build folder then running west build -b frdm_rw612/rw612/ns.
let me know whether this behavior is present or not, with the same configs you are adding to test with your custom board?
Most of my configs are related to peripherals on the flexcomm ports. For my testing on this issue, I've only left changes I made to the TF-M profile. I am using the TF-M medium arotless profile instead of large so I can perform over-the-air firmware updates with the TF-M FWU partition. For this I have 3 extra zephyr KConfig options:
CONFIG_TFM_PROFILE_TYPE_AROTLESS=y
CONFIG_TFM_SFN=y
CONFIG_TFM_ISOLATION_LEVEL=1
And the only thing I've edited in the TF-M module folder is the following profile setting in modules/tee/tf-m/trusted-firmware-m/platform/ext/target/nxp/frdmrw612/config.cmake:
set(TFM_PROFILE "profile_medium_arotless" CACHE STRING "The TF-M profile")
Which was modified from "profile_large"
Thank you for your help, please let me know if I can provide any more information.