Skip to content

Commit a6fc952

Browse files
dgarskedanielinux
authored andcommitted
Improve C0/G0 secure hide protection feature documentation.
1 parent c4dfa3f commit a6fc952

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

arch.mk

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ ifeq ($(ARCH),ARM)
9292
ifeq ($(TARGET),stm32g0)
9393
CORTEX_M0=1
9494
ARCH_FLASH_OFFSET=0x08000000
95-
96-
# Enable this feature for secure memory support
97-
# Makes the flash sectors for the bootloader unaccessible from the application
98-
# Requires using the STM32CubeProgrammer to set FLASH_SECR -> SEC_SIZE pages
99-
CFLAGS+=-DFLASH_SECURABLE_MEMORY_SUPPORT
10095
endif
10196

10297
ifeq ($(TARGET),stm32f4)

config/examples/stm32g0.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ V?=0
1515
SPMATH?=1
1616
RAM_CODE?=1
1717
DUALBANK_SWAP?=0
18+
19+
# Enable this feature for secure memory support
20+
# Makes the flash sectors for the bootloader unaccessible from the application
21+
# Requires using the STM32CubeProgrammer to set FLASH_SECR -> SEC_SIZE pages
22+
#CFLAGS_EXTRA+=-DFLASH_SECURABLE_MEMORY_SUPPORT
23+
1824
WOLFBOOT_PARTITION_SIZE?=0xB000
1925
WOLFBOOT_SECTOR_SIZE?=0x800
2026
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08008000

docs/Targets.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,15 +382,21 @@ The option `CORTEX_M0` is automatically selected for this target.
382382
The option `NVM_FLASH_WRITEONCE=1` is mandatory on this target, since the IAP driver does not support
383383
multiple writes after each erase operation.
384384

385-
This target also supports secure memory protection on the bootloader region
386-
using the `FLASH_CR:SEC_PROT` and `FLASH_SECT:SEC_SIZE` registers. This is the
385+
#### STM32G0 Secure Hide Protection Feature (Optional)
386+
387+
This part supports a "secure memory protection" feature makes the wolfBoot partition unaccessible after jump to application.
388+
389+
It uses the `FLASH_CR:SEC_PROT` and `FLASH_SECT:SEC_SIZE` registers. This is the
387390
number of 2KB pages to block access to from the 0x8000000 base address.
388391

392+
Command example to enable this for 32KB bootloader:
393+
389394
```
390395
STM32_Programmer_CLI -c port=swd mode=hotplug -ob SEC_SIZE=0x10
391396
```
392397

393-
For RAMFUNCTION support (required for SEC_PROT) make sure `RAM_CODE=1`.
398+
Enabled with `CFLAGS_EXTRA+=-DFLASH_SECURABLE_MEMORY_SUPPORT`.
399+
Requires `RAM_CODE=1` to enable RAMFUNCTION support.
394400

395401
### STM32G0 Programming
396402

@@ -460,10 +466,22 @@ The option `CORTEX_M0` is automatically selected for this target.
460466
The option `NVM_FLASH_WRITEONCE=1` is mandatory on this target, since the IAP driver does not support
461467
multiple writes after each erase operation.
462468

469+
#### STM32C0 Secure Hide Protection Feature (Optional)
470+
471+
This part supports a "secure memory protection" feature makes the wolfBoot partition unaccessible after jump to application.
472+
473+
It uses the `FLASH_CR:SEC_PROT` and `FLASH_SECT:SEC_SIZE` registers. This is the
474+
number of 2KB pages to block access to from the 0x8000000 base address.
475+
476+
Command example to enable this for 10KB bootloader:
477+
463478
```
464-
STM32_Programmer_CLI -c port=swd mode=hotplug -ob SEC_SIZE=0x10
479+
STM32_Programmer_CLI -c port=swd mode=hotplug -ob SEC_SIZE=0x05
465480
```
466481

482+
Enabled with `CFLAGS_EXTRA+=-DFLASH_SECURABLE_MEMORY_SUPPORT`.
483+
Requires `RAM_CODE=1` to enable RAMFUNCTION support.
484+
467485
### STM32C0 Programming
468486

469487
Compile requirements: `make TARGET=stm32c0 NVM_FLASH_WRITEONCE=1`

0 commit comments

Comments
 (0)