Skip to content

Commit

Permalink
Fixed merge of user_settings with new TPM logic
Browse files Browse the repository at this point in the history
  • Loading branch information
danielinux committed Sep 12, 2023
1 parent d5f4dc8 commit e08204b
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 148 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Select config
run: |
cp ${{inputs.config-file}} .config && make include/target.h
cp ${{inputs.config-file}} .config
- name: Build tools
run: |
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ wolfboot.elf: include/target.h $(LSCRIPT) $(OBJS) $(LIBS) $(BINASSEMBLE) FORCE
$(Q)$(LD) $(LDFLAGS) $(LSCRIPT_FLAGS) $(SECURE_LDFLAGS) $(LD_START_GROUP) $(OBJS) $(LIBS) $(LD_END_GROUP) -o $@

$(LSCRIPT): $(LSCRIPT_IN) FORCE
@(test $(LSCRIPT_IN) != NONE) || (echo "Error: no linker script" \
$(Q)(test $(LSCRIPT_IN) != NONE) || (echo "Error: no linker script" \
"configuration found. If you selected Encryption and RAM_CODE, then maybe" \
"the encryption algorithm is not yet supported with bootloader updates." \
&& false)
@(test -r $(LSCRIPT_IN)) || (echo "Error: no RAM/ChaCha linker script found." \
$(Q)(test -r $(LSCRIPT_IN)) || (echo "Error: no RAM/ChaCha linker script found." \
"If you selected Encryption and RAM_CODE, ensure that you have a" \
"custom linker script (i.e. $(TARGET)_chacha_ram.ld). Please read " \
"docs/encrypted_partitions.md for more information" && false)
@cat $(LSCRIPT_IN) | \
$(Q)cat $(LSCRIPT_IN) | \
sed -e "s/@ARCH_FLASH_OFFSET@/$(ARCH_FLASH_OFFSET)/g" | \
sed -e "s/@BOOTLOADER_PARTITION_SIZE@/$(BOOTLOADER_PARTITION_SIZE)/g" | \
sed -e "s/@WOLFBOOT_ORIGIN@/$(WOLFBOOT_ORIGIN)/g" | \
Expand Down
3 changes: 3 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ ifeq ($(ARCH),ARM)
else
WOLFBOOT_ORIGIN=0x08000000
endif
ifneq ($(TZEN),1)
LSCRIPT_IN=hal/$(TARGET)-ns.ld
endif
endif

ifeq ($(TARGET),stm32u5)
Expand Down
10 changes: 5 additions & 5 deletions config/examples/stm32l5-nonsecure-dualbank.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TZEN?=0
TARGET?=stm32l5
SIGN?=ECC256
HASH?=SHA256
DEBUG?=1
DEBUG?=0
VTOR?=1
CORTEX_M0?=0
CORTEX_M33?=1
Expand All @@ -18,8 +18,8 @@ V?=0
SPMATH?=1
RAM_CODE?=0
DUALBANK_SWAP?=1
WOLFBOOT_PARTITION_SIZE?=0x38000
WOLFBOOT_SECTOR_SIZE?=0x800
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08008000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08048000
WOLFBOOT_PARTITION_SIZE?=0x30000
WOLFBOOT_SECTOR_SIZE?=0x2000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08010000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08110000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xFFFFFFFF
6 changes: 3 additions & 3 deletions config/examples/stm32u5-nonsecure-dualbank.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ V?=0
SPMATH?=1
RAM_CODE?=0
DUALBANK_SWAP?=1
WOLFBOOT_PARTITION_SIZE?=0x38000
WOLFBOOT_PARTITION_SIZE?=0x30000
WOLFBOOT_SECTOR_SIZE?=0x2000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08008000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08108000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x08010000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x08110000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xFFFFFFFF
50 changes: 50 additions & 0 deletions hal/stm32l5-ns.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = @BOOTLOADER_PARTITION_SIZE@
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000 /* mapping TCM only */
}

SECTIONS
{
.text :
{
_start_text = .;
KEEP(*(.isr_vector))
*(.text*)
*(.rodata*)
. = ALIGN(4);
_end_text = .;
} > FLASH

.edidx :
{
. = ALIGN(4);
*(.ARM.exidx*)
} > FLASH

_stored_data = .;
.data : AT (_stored_data)
{
_start_data = .;
KEEP(*(.data*))
. = ALIGN(4);
KEEP(*(.ramcode))
. = ALIGN(4);
_end_data = .;
} > RAM

.bss (NOLOAD) :
{
_start_bss = .;
__bss_start__ = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
_end_bss = .;
__bss_end__ = .;
_end = .;
} > RAM
. = ALIGN(4);
}

END_STACK = ORIGIN(RAM) + LENGTH(RAM);
3 changes: 2 additions & 1 deletion hal/stm32l5.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
*cr &= ~FLASH_CR_PG;
i+=8;
}

#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
hal_tz_release_nonsecure_area();
#endif
return 0;
}

Expand Down
Loading

0 comments on commit e08204b

Please sign in to comment.