cancel
Showing results for 
Search instead for 
Did you mean: 

Can I Create Logging Functionality Within the Secure App

cgj004
Associate

STM32 H573 TrustZone Enabled question.

 
I'm executing the STM32 H573 example for TrustZone Enabled (OEMiROT, Secure, and Non Secure Apps).  I know the OEMiROT and Non Secure App prints out and logs info, but I want to be able to do that in the Secure App for logging purposes - errors and debugging.  I tried to use Gemini to create code that does that, but there appears to be many security hoops to jump through to do that, and I have been unsuccessful.  Do you have an example of what I can do to do this?  
 
Gemini creates the following functions and instructs me to place it under the Non Secure App and call it from a Secure App function, but I keep running into the problem of where I'm getting multiple definition of `NS_putc_utility'  error.
 

/**

* @brief Non-Secure Call-able (NSC) function that returns the pointer

* to the Non-Secure World's _write (UART) function.

*

* The __attribute__ flag ensures the compiler generates the security veneer.

*/

__attribute__((cmse_nonsecure_entry))

int32_t NS_putc_utility(int32_t ch)

{

char buffer[1] = {(char)ch};

 

// Call the actual low-level _write function.

// The security veneer is wrapped around this function entry.

return _write(1, buffer, 1);

}

 

0 REPLIES 0