Hello,
We have a custom hardware with RA4E1 MCU. MCU has 512KB flash and 128KB RAM. There is a bootloader application that we developed and is already working on the device. However, we converted this bootloader application to a TrustZone-enabled project for both the storage of the keys we use here and for code security. Our bootloader application is currently TrustZone-enabled and our device application is a flat application:
-
Bootloader β TrustZone
-
Application β Flat
After the project was finished, I tested it with a simple LED blink application. The bootloader worked successfully and I jumped to the LED blink application. However, when I tried it with the actual application, it did not work. To understand the reason, I converted the LED blink application to a freeRTOS-enabled application. Because our normal application has a freeRTOS feature. I experienced the same error here. Apparently, there is a problem with the freeRTOS feature of the flat application we are trying to jump to. If we give a little more detail, our flash and RAM structure is as follows:
-
Bootloader secure flash β 64kB
-
Bootloader nonsecure flash β 64kB
-
Flat Application flash β 384kB
-
Secure section of RAM β 24kB
-
Non-secure section of RAM β 104kB
I am adding a visual for you to better understand the flash and RAM structure of the MCU. I am also sending the error details I received on the Fault Status screen after jumping. I debugged to understand the part that caused the crash after jumping to the flat application. During the process of starting freeRTOS tasks, the rm_freertos_port_restore_task_stackless() function, depending on the vPortSVCHandler_C() function in the prvPortStartFirstTask() function, causes a problem. In other words, when I check with debug, the rm_freertos_port_restore_task_stackless() function causes a problem at the lowest level. I am also sending this function to you. I am also sending the function at the moment I jumped. Normally, this jump function does not cause any problems if the application I am trying to jump does not have freeRTOS feature. In other words, everything works properly and I see the LEDs blink after the jump. However, when I make the application I am trying to jump a freeRTOS feature application, I get the error I mentioned. Are there any extra things I need to do since my bootloader project has become a TrustZone feature project? Are the PSPLIM and MSPLIM values ββwrong or do I need to set the _S and _NS ones as well? I am seriously confused. Can you please help me? I have no idea what the problem could be and I cannot go beyond trial and error.
Thank you.
Best regards.