Hello everyone,
I'm trying to develop a TrustZone application using the MCUXpresso IDE and the LPCXpresso55S69 board. I can add the TrustZone examples as a project, build them directly, and run them without any issues. However, problems start when I make any changes.
If I press the "Update Code" option—due to a pin/timer/secure area modification or even without making any changes—the previously working application begins to show errors when I try to debug. Initially, it gives a null pointer error, and if I try to run the program, I encounter a hard fault, as shown in the example images.
What could be the reason for this issue, and how can I resolve it? I get this error directly even without making any modifications to the example. Additionally, is there a way to create separate secure and non-secure projects for TrustZone and link them correctly? This way, I wouldn’t have to manipulate the examples.
SDK Version: 2.16
Board: LPCXpresso55S69
MCUXpresso IDE: 24.9.25
Hi @yidaen,
I made some test with examples hello_world_s/hello_world_ns, this because both examples work together, and when I have both code open and upload the hello_world_s it works as expected. It would start with the code in the memory section that is secure, then it would jump to the code that is written in a not secure memory section.
When you make the tests, are you using both examples (hello_world_s/hello_world_ns)?
Hi @Pablo_Ramos
Thank you very much for your support; indeed, both projects are as follows.
If I add the projects using the "import SDK examples" option and then build and run them directly, I encounter no issues, and the project functions as expected. However, the problem arises when I use the "update code" option. As seen, there are many warnings in the default code state.
The key point here is that the issue only appears when the TrustZone codes are updated. If I don’t update the TrustZone codes, I don't encounter this issue. Additionally, if I open any other project containing TrustZone, I continue to receive this error. So, the problem seems to be in the code generation for TrustZone.
When I look into the source of the error, I see an issue related to floating points. When I check my UFSR register, as shown in the first image, I notice that the NCOP flag is set. The hard fault occurs during a floating-point operation. Could there be an error related to hardware activation for floating points in the new version of TrustZone?
Hi @yidaen,
Sorry for taking a while to get back to you.
Making some test I notice that there is a conflict on the versions of config tool and the example. This occasioning changes in the code regardless of whether you modify anything.
I recommend you make the modifications to the example through code.
An apology for the inconvenience this might bring.