same-bank exitSecureArea details on h755
Hello,
I have two applications: one at 0x08000000 and one at 0x08080000. Both run fine individually (when setting the boot config bytes to the fitting offset). Now I want to use the one at 0x08000000 as secure area and escape it by using exitSecureArea. In the debugger, I can observe that the code runs fine until the very call to exitSecureArea. Now my questions are:
1. Is there something else I need to to? This seems to suggest that I need to set the VTOR register. I currently (try to) do it before the call to exitSecureArea.
2. If I need to setup the VTOR register, is my code below correct? Or do I need to do it differently/at a different place?
3. Does exitSecureArea also work when the secure area is not set? I only tried without setting it as not to brick the device.
4. Is there a way to debug this nicely?
typedef struct
{
uint32_t sizeInBytes; /*!< pass 0 for an empty secure area */
uint32_t startAddress; /*!< pass NULL for an empty secure area */
uint32_t removeDuringBankErase; /*!< if 0, keep area during bank/mass erase. else area will be removed */
} RSS_SecureArea_t;
typedef struct
{
/**
* This service is used to exit from secure user software and jump to user main application.
* There is no system reset triggered by this service
*/
// vectors is the base of the other app
// build the other app, but for a different starting address
void (*exitSecureArea)(uint32_t vectors, uint32_t jtagState);
/**
* This service sets Secure user area boundaries.
* This service can be used only when a secure area is set for the first time.
* A system reset is triggered after service completion.
*/
void (*resetAndInitializeSecureAreas)(uint32_t nbAreas, RSS_SecureArea_t *areas); /*!< nbAreas=1 or 2;
1 per bank */
} RSS_API_Table_t;
#define RSS_API ((RSS_API_Table_t*)0x1FF09514)
void main(){
[...]
__disable_irq();
SCB->VTOR = 0x08080000;
__enable_irq();
RSS_API->exitSecureArea(0x08080000, 1);
}
Thanks for your help!
