Skip to content

Commit b1ff1e3

Browse files
dgarskedanielinux
authored andcommitted
Minor improvements. STM32H5 non-secure flash watermark. Fixing layout of linker script. Still getting fault on calls to smse functions like wcs_get_random.
1 parent 7f193af commit b1ff1e3

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ keys: $(PRIVATE_KEY)
431431

432432
clean:
433433
$(Q)rm -f src/*.o hal/*.o hal/spi/*.o test-app/*.o src/x86/*.o
434+
$(Q)rm -f src/wc_secure_calls.o
434435
$(Q)rm -f $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/*.o $(WOLFBOOT_LIB_WOLFTPM)/src/*.o $(WOLFBOOT_LIB_WOLFTPM)/hal/*.o $(WOLFBOOT_LIB_WOLFTPM)/examples/pcr/*.o
435436
$(Q)rm -f $(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/port/Renesas/*.o
436437
$(Q)rm -f wolfboot.bin wolfboot.elf wolfboot.map test-update.rom wolfboot.hex

docs/Targets.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,8 @@ The example configuration for this scenario is available in [/config/examples/st
914914

915915
`STM32_Programmer_CLI -c port=swd -ob TZEN=0xB4`
916916

917-
- set the option bytes to enable flash secure protection of first 384KB:
918-
`STM32_Programmer_CLI -c port=swd -ob SECWM1_PSTRT=0x0 SECWM1_PEND=0x2F SECWM2_PEND=0x0 SECWM2_PSTRT=0x2F`
917+
- set the option bytes to enable flash secure protection of first 384KB and remainder as non-secure:
918+
`STM32_Programmer_CLI -c port=swd -ob SECWM1_PSTRT=0x0 SECWM1_PEND=0x2F SECWM2_PSTRT=0x2F SECWM2_PEND=0x0`
919919

920920
- flash the wolfboot image to the secure partition:
921921
`STM32_Programmer_CLI -c port=swd -d wolfboot.bin 0x0C000000`
@@ -984,6 +984,7 @@ Any version except the first one will also turn on the orange LED.
984984

985985
### STM32H5 Debugging
986986

987+
987988
OpenOCD: `openocd -s /usr/local/share/openocd/scripts -f board/st_nucleo_h5.cfg`
988989

989990
```sh

hal/stm32h5.ld

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
MEMORY
22
{
3-
FLASH (rx) : ORIGIN = @WOLFBOOT_ORIGIN@, LENGTH = @BOOTLOADER_PARTITION_SIZE@ - 0x1C000
3+
/* If FLASH_KEYVAULT or FLASH_NSC length is adjusted FLASH length needs adjusted too */
4+
FLASH (rx) : ORIGIN = @WOLFBOOT_ORIGIN@, LENGTH = @BOOTLOADER_PARTITION_SIZE@ - 0x1C000 - 0x4000
45
RAM (rwx) : ORIGIN = 0x30000000, LENGTH = 0x20000
56
RAM_KV (rw): ORIGIN = 0x30020000, LENGTH = 0x10000
67
RAM_HEAP (rw): ORIGIN = 0x30030000, LENGTH = 0x10000 /* 64KB Heap for wolfcrypt/PKCS11 */
7-
FLASH_KEYVAULT(rw): ORIGIN = @WOLFBOOT_ORIGIN@ + 0x44000, LENGTH = 0x18000
8-
FLASH_NSC(rx): ORIGIN = @WOLFBOOT_ORIGIN@ + 0x5C000, LENGTH = 0x8000
8+
FLASH_KEYVAULT(rw): ORIGIN = @WOLFBOOT_ORIGIN@ + LENGTH(FLASH), LENGTH = 0x1C000
9+
FLASH_NSC(rx): ORIGIN = @WOLFBOOT_ORIGIN@ + LENGTH(FLASH) + LENGTH(FLASH_KEYVAULT), LENGTH = 0x4000
910
}
1011

1112
SECTIONS
@@ -31,7 +32,7 @@ SECTIONS
3132
. = ALIGN(32);
3233
*(.gnu.sgstubs*) /* Secure Gateway stubs */
3334
. = ALIGN(4);
34-
} >FLASH_NSC
35+
} > FLASH_NSC
3536

3637
_stored_data = .;
3738
.data : AT (_stored_data)

src/libwolfboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static uint8_t NVM_CACHE[NVM_CACHE_SIZE] XALIGNED(16);
200200
static int nvm_cached_sector = 0;
201201
static uint8_t get_base_offset(uint8_t *base, uintptr_t off)
202202
{
203-
return *(base - off); /* ignore array bounds error */
203+
return *(uint8_t*)((uintptr_t)base - off); /* ignore array bounds error */
204204
}
205205

206206
void WEAKFUNCTION hal_cache_invalidate(void)

0 commit comments

Comments
 (0)