STM32 TrustZone improvements (when tested with wolfIP)#775
Open
dgarske wants to merge 2 commits intowolfSSL:masterfrom
Open
STM32 TrustZone improvements (when tested with wolfIP)#775dgarske wants to merge 2 commits intowolfSSL:masterfrom
dgarske wants to merge 2 commits intowolfSSL:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates STM32H5 TrustZone configuration to better support running a non-secure wolfIP application by loosening GPIO and RAM security/privilege settings where needed.
Changes:
- Clear GPIO secure-configuration (SECCFGR) for additional ports used by the non-secure app and enable GPIOG clocking.
- Rework GTZC MPCBB configuration: keep SRAM1 secure while making SRAM2/SRAM3 non-secure and unprivileged.
- Expand the SAU non-secure RAM region to include SRAM2 in addition to SRAM3.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| hal/stm32h5.c | Clears GPIO SECCFGR across ports used by wolfIP NS app and enables GPIOG clock to allow NS GPIO configuration. |
| hal/stm32_tz.c | Adjusts GTZC MPCBB and SAU configuration so SRAM2+SRAM3 are NS/unpriv, while SRAM1 remains secure for wolfBoot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+652
to
+660
| * Clear SECCFGR for every pin on the ports the wolfIP NS app uses | ||
| * (RMII + USART3 + LED), then enable GPIOG's clock (the existing | ||
| * code only covered A/B/C/D). PD8 (USART3 TX) is already cleared | ||
| * above, but covering all of GPIOD is harmless. */ | ||
| GPIO_SECCFGR(GPIOA_BASE) = 0u; | ||
| GPIO_SECCFGR(GPIOB_BASE) = 0u; | ||
| GPIO_SECCFGR(GPIOC_BASE) = 0u; | ||
| GPIO_SECCFGR(GPIOD_BASE) = 0u; | ||
| GPIO_SECCFGR(GPIOG_BASE) = 0u; |
Comment on lines
200
to
+205
|
|
||
| #define SET_GTZC1_MPCBBx_SECCFGR_VCTR(bank,n,val) \ | ||
| (*((volatile uint32_t *)(GTZC1_MPCBB##bank##_SECCFGR) + n )) = val | ||
| /* PRIVCFGR_VCTR sits 0x100 after SECCFGR_VCTR in each MPCBB block. */ | ||
| #define SET_GTZC1_MPCBBx_PRIVCFGR_VCTR(bank,n,val) \ | ||
| (*((volatile uint32_t *)(GTZC1_MPCBB##bank##_SECCFGR) + 64 + n )) = val |
Comment on lines
231
to
240
| for (i = 0; i < 4; i++) { | ||
| SET_GTZC1_MPCBBx_SECCFGR_VCTR(2, i, 0xFFFFFFFF); | ||
| SET_GTZC1_MPCBBx_SECCFGR_VCTR(2, i, 0x0); | ||
| SET_GTZC1_MPCBBx_PRIVCFGR_VCTR(2, i, 0x0); | ||
| } | ||
|
|
||
| /* Configure SRAM3 as non-secure (320 KB) */ | ||
| /* Configure SRAM3 as non-secure (320 KB) and unprivileged. */ | ||
| for (i = 0; i < 20; i++) { | ||
| SET_GTZC1_MPCBBx_SECCFGR_VCTR(3, i, 0x0); | ||
| SET_GTZC1_MPCBBx_PRIVCFGR_VCTR(3, i, 0x0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.