Various small fixes for nrf5340 TrustZone PKCS11

pull/655/head
Mattia Moffa 2025-12-24 18:58:33 +01:00
parent 2fc6fe8335
commit b8f70ad57d
3 changed files with 23 additions and 5 deletions

View File

@ -68,10 +68,11 @@
#define USE_IPC_RECV 0
#endif
/* SHM: Shared Memory between network and application cores */
/* first 64KB (0x10000) is used by wolfBoot and limited in nrf5340.ld */
/* SHM: Shared Memory between network and application cores.
* Reserve most of single-cycle RAM for wolfBoot;
* use end of RAM (0x3F800 - 0x7FFFF) as shared memory */
#ifndef SHARED_MEM_ADDR
#define SHARED_MEM_ADDR (0x20000000UL + (64 * 1024))
#define SHARED_MEM_ADDR 0x2003F800
#endif
/* Shared memory states (mask, easier to check) */
@ -875,13 +876,21 @@ static void periph_unsecure()
/* Unsecure RTC0 */
SPU_PERIPHID_PERM(RTC0_PERIPHID) &= ~SPU_PERIPHID_PERM_SECATTR;
/* Unsecure QSPI */
SPU_PERIPHID_PERM(QSPI_PERIPHID) &= ~SPU_PERIPHID_PERM_SECATTR;
}
#endif
void hal_prepare_boot(void)
{
/* Write protect bootloader region of flash */
/* Write protect bootloader region of flash.
* Not needed in TrustZone configs because the application
* runs in non-secure mode and the bootloader partition is marked as
* secure. */
#ifndef TZEN
hal_flash_protect(WOLFBOOT_ORIGIN, BOOTLOADER_PARTITION_SIZE);
#endif
if (enableShm) {
#ifdef TARGET_nrf5340_net

View File

@ -371,6 +371,8 @@ void uart_write_sz(const char* c, unsigned int sz);
/* QSPI */
#ifdef TARGET_nrf5340_app
#define QSPI_PERIPHID 43
#if TZ_SECURE()
#define QSPI_BASE (0x5002B000)
#else

View File

@ -306,7 +306,11 @@ ifeq ($(QSPI_FLASH),1)
ifeq ($(ARCH),RENESAS_RX)
APP_OBJS+=../hal/spi/spi_drv_renesas_rx.o
else
APP_OBJS+=../hal/spi/spi_drv_$(SPI_TARGET).o
ifeq ($(TZEN),1)
APP_OBJS+=../hal/spi/spi_drv_$(SPI_TARGET)_ns.o
else
APP_OBJS+=../hal/spi/spi_drv_$(SPI_TARGET).o
endif
endif
endif
@ -596,6 +600,9 @@ delta-extra-data: image.bin
../hal/$(TARGET)_ns.o: ../hal/$(TARGET).c FORCE
$(Q)$(CC) $(CFLAGS) -c -o $(@) ../hal/$(TARGET).c -DNONSECURE_APP
../hal/spi/spi_drv_$(SPI_TARGET)_ns.o: ../hal/spi/spi_drv_$(SPI_TARGET).c FORCE
$(Q)$(CC) $(CFLAGS) -c -o $(@) ../hal/spi/spi_drv_$(SPI_TARGET).c -DNONSECURE_APP
%.o:%.c
@echo "\t[CC-$(ARCH)] $@"
$(Q)$(CC) $(CFLAGS) -c $(OUTPUT_FLAG) $@ $^