diff --git a/test-app/emu-test-apps/stm32l552/Makefile b/test-app/emu-test-apps/stm32l552/Makefile index 838979fb..b2d540fa 100644 --- a/test-app/emu-test-apps/stm32l552/Makefile +++ b/test-app/emu-test-apps/stm32l552/Makefile @@ -1,13 +1,14 @@ CC=arm-none-eabi-gcc OBJCOPY ?= arm-none-eabi-objcopy -CFLAGS := -mcpu=cortex-m33 -mthumb -mcmse -Os -ffreestanding -fdata-sections -ffunction-sections -g -ggdb +CFLAGS := -mcpu=cortex-m33 -mthumb -Os -ffreestanding -fdata-sections -ffunction-sections -g -ggdb CFLAGS += -I. -I../common -I../../../include -DEMU_STM32 CFLAGS += -DIMAGE_HEADER_SIZE=$(IMAGE_HEADER_SIZE) LDFLAGS := -nostdlib -T target.ld -Wl,-gc-sections LDLIBS := -Wl,--start-group -lc -lm -lgcc -lnosys -Wl,--end-group NSC_OBJ := ifeq ($(TZEN),1) + CFLAGS += -DNONSECURE_APP CFLAGS += -DWOLFCRYPT_SECURE_MODE NSC_OBJ := ../../../src/wc_secure_calls.o endif diff --git a/test-app/emu-test-apps/stm32l552/target.ld b/test-app/emu-test-apps/stm32l552/target.ld index a9e53662..d08965e7 100644 --- a/test-app/emu-test-apps/stm32l552/target.ld +++ b/test-app/emu-test-apps/stm32l552/target.ld @@ -1,64 +1,61 @@ -/* Minimal linker script for STM32L552 memory map */ MEMORY { - FLASH (rx) : ORIGIN = 0x08000100, LENGTH = 0x0007FF00 - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000 + FLASH (rx) : ORIGIN = 0x8040400, LENGTH = 0x1f400 + RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x20000 } -_estack = ORIGIN(RAM) + LENGTH(RAM); -_sidata = LOADADDR(.data); - SECTIONS { - .isr_vector : - { - KEEP(*(.isr_vector)) - } > FLASH - .text : { + _start_text = .; + . = ALIGN(8); + KEEP(*(.isr_vector)) + . = ALIGN(8); + *(.init) + *(.fini) *(.text*) *(.rodata*) - *(.ARM.extab* .gnu.linkonce.armextab.*) - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - *(.glue_7) - *(.glue_7t) - *(.eh_frame) + . = ALIGN(8); + _end_text = .; } > FLASH - .preinit_array : + .edidx : { - __preinit_array_start = .; - KEEP(*(.preinit_array*)) - __preinit_array_end = .; + . = ALIGN(4); + *(.ARM.exidx*) } > FLASH - .init_array : - { - __init_array_start = .; - KEEP(*(.init_array*)) - __init_array_end = .; - } > FLASH + _stored_data = .; - .fini_array : + .data : AT (_stored_data) { - __fini_array_start = .; - KEEP(*(.fini_array*)) - __fini_array_end = .; - } > FLASH + _start_data = .; + KEEP(*(.data*)) + . = ALIGN(8); + KEEP(*(.ramcode)) + . = ALIGN(8); + _end_data = .; + } > RAM - .data : + .bss : { - _sdata = .; - *(.data*) - _edata = .; - } > RAM AT > FLASH - - .bss (NOLOAD) : - { - _sbss = .; + _start_bss = .; *(.bss*) *(COMMON) - _ebss = .; + . = ALIGN(8); + _end_bss = .; + _end = .; } > RAM } + +PROVIDE(_start_heap = _end); +PROVIDE(_end_stack = ORIGIN(RAM) + LENGTH(RAM)); + +/* Emu app startup expects these symbols. */ +_estack = _end_stack; +_sidata = _stored_data; +_sdata = _start_data; +_edata = _end_data; +_sbss = _start_bss; +_ebss = _end_bss;