Skip to content

Commit 4bfe5e7

Browse files
authored
Merge pull request #972 from danielinux/fix-makefile-assignments
make: let user-provided options win over target defaults
2 parents fe7697a + 6b12eec commit 4bfe5e7

12 files changed

Lines changed: 145 additions & 57 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,11 +1439,13 @@ set(KEYGEN_TOOL ${KEYGEN_TOOL} CACHE INTERNAL "")
14391439

14401440
list(APPEND WOLFBOOT_INCLUDE_DIRS ${WOLFBOOT_ROOT} ${WOLFBOOT_ROOT}/include)
14411441

1442-
# set default linker script
1443-
set(WOLFBOOT_LSCRIPT_TEMPLATE hal/${WOLFBOOT_TARGET}.ld)
1444-
# Partition trailers in sectors 1-2, see hal/stm32f4.c
1445-
if(WOLFBOOT_TARGET STREQUAL "stm32f4" AND CUSTOM_PARTITION_TRAILER)
1446-
set(WOLFBOOT_LSCRIPT_TEMPLATE hal/stm32f4-trailer.ld)
1442+
# set default linker script; a user-provided WOLFBOOT_LSCRIPT_TEMPLATE wins
1443+
if(NOT DEFINED WOLFBOOT_LSCRIPT_TEMPLATE)
1444+
set(WOLFBOOT_LSCRIPT_TEMPLATE hal/${WOLFBOOT_TARGET}.ld)
1445+
# Partition trailers in sectors 1-2, see hal/stm32f4.c
1446+
if(WOLFBOOT_TARGET STREQUAL "stm32f4" AND CUSTOM_PARTITION_TRAILER)
1447+
set(WOLFBOOT_LSCRIPT_TEMPLATE hal/stm32f4-trailer.ld)
1448+
endif()
14471449
endif()
14481450

14491451
#---------------------------------------------------------------------------------------------

‎Makefile‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ LDFLAGS:=
3838
SECURE_LDFLAGS:=
3939
LD_START_GROUP:=-Wl,--start-group
4040
LD_END_GROUP:=-Wl,--end-group
41-
LSCRIPT_IN?=hal/$(TARGET).ld
41+
# Linker script: capture the user value (command line, environment, .config)
42+
# here; target defaults in arch.mk/options.mk/board.mk use the
43+
# LSCRIPT_IN_DEFAULT helper (see tools/config.mk), which only assigns when
44+
# LSCRIPT_IN is undefined or empty, so a user value wins. Last-resort
45+
# default is applied after options.mk below.
46+
LSCRIPT_IN_USER:=$(LSCRIPT_IN)
4247
L2SRAM_ADDR?=0xF8F00000
4348
V?=0
4449
DEBUG?=0
@@ -272,6 +277,14 @@ WOLFBOOT_TARGET_BUILD=1
272277
# Parse config options
273278
include options.mk
274279

280+
# Last-resort linker script for targets without a dedicated default in
281+
# arch.mk/options.mk/board.mk; a user-provided LSCRIPT_IN wins over both.
282+
# An empty value (e.g. an LSCRIPT_IN?= persisted by an older 'make config')
283+
# counts as unset.
284+
ifeq ($(strip $(LSCRIPT_IN)),)
285+
LSCRIPT_IN:=hal/$(TARGET).ld
286+
endif
287+
275288
OBJS+=$(WOLFCRYPT_OBJS)
276289
OBJS+=$(PUBLIC_KEY_OBJS)
277290
OBJS+=$(WOLFHSM_OBJS)
@@ -350,7 +363,10 @@ ifeq ($(USE_ARMCLANG),1)
350363
LDFLAGS:=$(ARMCLANG_LDFLAGS) --map --list=wolfboot.map
351364
LDFLAGS+=$(LDFLAGS_EXTRA)
352365
LSCRIPT:=config/target.sct
353-
LSCRIPT_IN:=hal/$(TARGET).sct
366+
# ARMClang needs a .sct scatter file; a user-provided LSCRIPT_IN wins.
367+
ifeq ($(LSCRIPT_IN_USER),)
368+
LSCRIPT_IN:=hal/$(TARGET).sct
369+
endif
354370
LSCRIPT_FLAGS:=--scatter=$(LSCRIPT)
355371
LD_START_GROUP:=
356372
LD_END_GROUP:=
@@ -563,7 +579,10 @@ stage1: stage1/loader_stage1.bin
563579
stage1/loader_stage1.bin: wolfboot.elf
564580
stage1/loader_stage1.bin: FORCE
565581
@echo "\t[BIN] $@"
566-
$(Q)$(MAKE) -C $(dir $@) $(notdir $@)
582+
# A user-provided LSCRIPT_IN is relative to the repo root; the recursive
583+
# make runs from stage1/, so pass it as an absolute path. Target-derived
584+
# stage1 defaults keep their own selection (nothing is passed).
585+
$(Q)$(MAKE) -C $(dir $@) $(notdir $@) $(if $(LSCRIPT_IN_USER),LSCRIPT_IN=$(abspath $(LSCRIPT_IN_USER)))
567586

568587
libwolfboot.a: include/target.h $(OBJS)
569588
@echo "\t[LIB] $@"

‎arch.mk‎

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ ifeq ($(ARCH),AARCH64)
109109
ZYNQMP_PSU_INIT_DIR?=hal/board/zynqmp
110110
CFLAGS+=-DWOLFBOOT_ZYNQMP_FSBL
111111
CFLAGS+=-Ihal/zynqmp -I$(ZYNQMP_PSU_INIT_DIR)
112-
LSCRIPT_IN=hal/zynqmp_ocm.ld
112+
$(call LSCRIPT_IN_DEFAULT,hal/zynqmp_ocm.ld)
113113
OBJS+=hal/zynqmp_psu_shim.o
114114
OBJS+=hal/zynqmp_atf.o
115115
OBJS+=$(ZYNQMP_PSU_INIT_DIR)/psu_init_gpl.o
@@ -510,7 +510,7 @@ ifeq ($(ARCH),ARM)
510510
SPI_TARGET=stm32
511511
# Partition trailers in sectors 1-2, see hal/stm32f4.c
512512
ifeq ($(CUSTOM_PARTITION_TRAILER),1)
513-
LSCRIPT_IN=hal/stm32f4-trailer.ld
513+
$(call LSCRIPT_IN_DEFAULT,hal/stm32f4-trailer.ld)
514514
endif
515515
endif
516516

@@ -682,7 +682,7 @@ ifeq ($(ARCH),ARM)
682682
WOLFBOOT_ORIGIN=0x0C000000
683683
else
684684
WOLFBOOT_ORIGIN=0x08000000
685-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
685+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
686686
endif
687687
endif
688688

@@ -694,7 +694,7 @@ ifeq ($(ARCH),ARM)
694694
WOLFBOOT_ORIGIN=0x0C000000
695695
else
696696
WOLFBOOT_ORIGIN=0x08000000
697-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
697+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
698698
endif
699699
SPI_TARGET=stm32
700700
endif
@@ -704,7 +704,7 @@ ifeq ($(ARCH),ARM)
704704
CFLAGS+=-Ihal
705705
ARCH_FLASH_OFFSET=0x08000000
706706
WOLFBOOT_ORIGIN=0x08000000
707-
LSCRIPT_IN=hal/$(TARGET).ld
707+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET).ld)
708708
SPI_TARGET=stm32
709709
endif
710710

@@ -713,7 +713,7 @@ ifeq ($(ARCH),ARM)
713713
CFLAGS+=-Ihal
714714
ARCH_FLASH_OFFSET=0x08000000
715715
WOLFBOOT_ORIGIN=0x08000000
716-
LSCRIPT_IN=hal/$(TARGET).ld
716+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET).ld)
717717
SPI_TARGET=stm32
718718
endif
719719

@@ -724,7 +724,7 @@ ifeq ($(ARCH),ARM)
724724
# reached through the Secure SBUS alias, which the HAL derives from it.
725725
ARCH_FLASH_OFFSET=0x12000000
726726
WOLFBOOT_ORIGIN=0x12000000
727-
LSCRIPT_IN=hal/$(TARGET).ld
727+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET).ld)
728728
SPI_TARGET=psoc_c3
729729
# Board wiring. Defaults match the PSOC Control C3 evaluation kit; override
730730
# for another variant.
@@ -782,13 +782,13 @@ ifeq ($(ARCH),ARM)
782782
BOOTLOADER_PARTITION_SIZE=$$(( ($(WOLFBOOT_PARTITION_BOOT_ADDRESS) | 0x10000000) - $(WOLFBOOT_ORIGIN) - 0x40))
783783
endif
784784
ifeq ($(TZEN),1)
785-
LSCRIPT_IN=hal/$(TARGET)-tz.ld
785+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-tz.ld)
786786
OBJS+=hal/psoc_e8_tz.o
787787
# wolfHSM NVM in the RRAM user area, Secure.
788788
WOLFBOOT_KEYVAULT_ADDRESS?=0x32040000
789789
WOLFBOOT_KEYVAULT_SIZE?=0x10000
790790
else
791-
LSCRIPT_IN=hal/$(TARGET).ld
791+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET).ld)
792792
endif
793793
# Board wiring, defaulted for KIT_PSE84_AI.
794794
PSOC_E8_UART_SCB?=2
@@ -830,7 +830,7 @@ ifeq ($(ARCH),ARM)
830830
ARCH_FLASH_OFFSET=0x00000000
831831
WOLFBOOT_ORIGIN=0x00000000
832832
ifneq ($(TZEN),1)
833-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
833+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
834834
endif
835835
endif
836836

@@ -842,7 +842,7 @@ ifeq ($(ARCH),ARM)
842842
WOLFBOOT_ORIGIN=0x0C000000
843843
else
844844
WOLFBOOT_ORIGIN=0x08000000
845-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
845+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
846846
endif
847847
SPI_TARGET=stm32
848848
ifneq ($(DEBUG),0)
@@ -868,9 +868,9 @@ ifeq ($(ARCH),ARM)
868868
ARCH_FLASH_OFFSET=0x10000000
869869
WOLFBOOT_ORIGIN=0x10000000
870870
ifeq ($(TZEN),1)
871-
LSCRIPT_IN=hal/$(TARGET).ld
871+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET).ld)
872872
else
873-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
873+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
874874
endif
875875
SPI_TARGET=raspberrypi_pico
876876
CFLAGS+=-DPICO_SDK_PATH=$(PICO_SDK_PATH)
@@ -1426,7 +1426,7 @@ ifeq ($(ARCH),RISCV64)
14261426
OBJS+=src/riscv_sbi.o
14271427
endif
14281428
# Use M-mode specific linker script
1429-
LSCRIPT_IN:=hal/$(TARGET)-m.ld
1429+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-m.ld)
14301430
# Boot mode 2: reserve the last eNVM page for the signed manifest the UBL
14311431
# stub verifies (hal/mpfs250-m.ld); `make wolfboot_envm_signed.bin` fills it.
14321432
ifeq ($(MPFS_ENVM_MANIFEST),1)
@@ -1464,7 +1464,7 @@ ifeq ($(ARCH),RISCV64)
14641464
CFLAGS+=-DWOLFBOOT_DUALBOOT
14651465
ifeq ($(MPFS_L2LIM),1)
14661466
# L2-LIM mode: wolfBoot in on-chip SRAM, loaded by HSS (no DDR)
1467-
LSCRIPT_IN:=hal/$(TARGET)-hss.ld
1467+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-hss.ld)
14681468
else
14691469
# DDR mode (default): full MMU and FDT support
14701470
CFLAGS+=-DMMU
@@ -1486,7 +1486,11 @@ ifeq ($(ARCH),RISCV64)
14861486
# Boot mode 2 UBL stub: LIM-resident, verifies the eNVM wolfBoot manifest
14871487
# in place and jumps; no update path (hal/mpfs250_ubl.c).
14881488
ifeq ($(TARGET),mpfs250_ubl)
1489-
LSCRIPT_IN:=hal/mpfs250_ubl.ld
1489+
# UBL stub has its own layout; overrides the generic M-mode default
1490+
# above (a user-provided LSCRIPT_IN still wins).
1491+
ifeq ($(LSCRIPT_IN_USER),)
1492+
LSCRIPT_IN:=hal/mpfs250_ubl.ld
1493+
endif
14901494
UPDATE_OBJS:=
14911495
# mcycle rate for hal_get_timer_us(): the stub runs at the reset clock
14921496
CFLAGS+=-DRISCV_SMODE_TIMER_FREQ=80000000UL
@@ -1715,7 +1719,7 @@ endif
17151719
ifeq ($(TARGET),mcxw)
17161720
CORTEX_M33=1
17171721
ifneq ($(TZEN),1)
1718-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
1722+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
17191723
endif
17201724
CFLAGS+=\
17211725
-I$(MCUXPRESSO_DRIVERS) \
@@ -1768,7 +1772,7 @@ endif
17681772
ifeq ($(TARGET),mcxn)
17691773
CORTEX_M33=1
17701774
ifneq ($(TZEN),1)
1771-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
1775+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
17721776
endif
17731777
CFLAGS+=\
17741778
-I$(MCUXPRESSO_DRIVERS) \
@@ -1823,7 +1827,7 @@ ifeq ($(TARGET),rw612)
18231827
CORTEX_M33=1
18241828
ARCH_FLASH_OFFSET=0x08000000
18251829
ifneq ($(TZEN),1)
1826-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
1830+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
18271831
endif
18281832
MCUXPRESSO_FLASH_CONFIG?=$(MCUXPRESSO_PROJECT_TEMPLATE)/../flash_config
18291833
CFLAGS+=\
@@ -1864,13 +1868,13 @@ endif
18641868

18651869
ifeq ($(TARGET),nrf5340)
18661870
ifneq ($(TZEN), 1)
1867-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
1871+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
18681872
endif
18691873
endif
18701874

18711875
ifeq ($(TARGET),nrf54l)
18721876
ifneq ($(TZEN), 1)
1873-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
1877+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
18741878
endif
18751879
endif
18761880

@@ -1932,9 +1936,9 @@ ifeq ($(TARGET),imx_rt)
19321936
endif
19331937

19341938
ifeq ($(TARGET_IMX_HAB),1)
1935-
LSCRIPT_IN:=hal/$(TARGET)_hab.ld
1939+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)_hab.ld)
19361940
else
1937-
LSCRIPT_IN:=hal/$(TARGET).ld
1941+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET).ld)
19381942
endif
19391943

19401944
ifeq ($(MCUXPRESSO_CPU),MIMXRT1064DVL6A)
@@ -2396,7 +2400,7 @@ endif
23962400

23972401
ifeq ($(TARGET),lpc55s69)
23982402
ifneq ($(TZEN),1)
2399-
LSCRIPT_IN=hal/$(TARGET)-ns.ld
2403+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET)-ns.ld)
24002404
endif
24012405
CFLAGS+=\
24022406
-I$(MCUXPRESSO_PROJECT_TEMPLATE) \
@@ -2604,9 +2608,9 @@ ifeq ("${FSP}", "1")
26042608
ifeq ($(filter-out $(STAGE1),1),)
26052609
# building stage1
26062610
ifeq ($(FSP_TGL), 1)
2607-
LSCRIPT_IN = ../hal/x86_fsp_tgl_stage1.ld
2611+
$(call LSCRIPT_IN_DEFAULT,../hal/x86_fsp_tgl_stage1.ld)
26082612
else
2609-
LSCRIPT_IN = ../hal/$(TARGET)_stage1.ld
2613+
$(call LSCRIPT_IN_DEFAULT,../hal/$(TARGET)_stage1.ld)
26102614
endif
26112615
# using ../wolfboot.map as stage1 is built from stage1 sub-directory
26122616
LDFLAGS = --defsym main=0x`nm ../wolfboot.elf | grep -w main | awk '{print $$1}'` \
@@ -2649,9 +2653,9 @@ ifeq ("${FSP}", "1")
26492653
else
26502654
# building wolfBoot
26512655
ifeq ($(FSP_TGL), 1)
2652-
LSCRIPT_IN = hal/x86_fsp_tgl.ld.in
2656+
$(call LSCRIPT_IN_DEFAULT,hal/x86_fsp_tgl.ld.in)
26532657
else
2654-
LSCRIPT_IN = hal/$(TARGET).ld.in
2658+
$(call LSCRIPT_IN_DEFAULT,hal/$(TARGET).ld.in)
26552659
endif
26562660
LDFLAGS = --gc-sections --entry=main -T $(LSCRIPT) -Map=wolfboot.map
26572661
CFLAGS += -fno-stack-protector -fno-PIC -fno-pie -mno-mmx -mno-sse -Os -DDEBUG_UART
@@ -3065,14 +3069,18 @@ ifeq ($(ARCH), AURIX)
30653069
# HighTec's ancient ARM ld cannot parse the BSP linker-script fragments.
30663070
# Flatten them at parse time with the wolfHSM port's ld-flatten.sh.
30673071
# Paths are relative to this arch.mk, which is included from both the
3068-
# wolfBoot root and test-app directories.
3072+
# wolfBoot root and test-app directories. A user-provided LSCRIPT_IN
3073+
# is used as-is; only the stock HAL script goes through the flattener
3074+
# (its output lands in config/).
30693075
ARCHMK_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
3070-
LSCRIPT_IN=$(ARCHMK_DIR)config/$(TARGET)_flat.ld
3071-
ifeq ($(filter clean keysclean,$(MAKECMDGOALS)),)
3072-
LD_FLATTEN_OUT:=$(shell $(WOLFHSM_INFINEON_TC3XX)/tchsm-server/ld-flatten.sh \
3073-
$(ARCHMK_DIR)hal/$(TARGET).ld $(LSCRIPT_IN) $(TC3_DIR)/tc3 && echo OK)
3074-
ifneq ($(LD_FLATTEN_OUT),OK)
3075-
$(error ld-flatten.sh failed for hal/$(TARGET).ld)
3076+
ifeq ($(LSCRIPT_IN),)
3077+
LSCRIPT_IN:=$(ARCHMK_DIR)config/$(TARGET)_flat.ld
3078+
ifeq ($(filter clean keysclean,$(MAKECMDGOALS)),)
3079+
LD_FLATTEN_OUT:=$(shell $(WOLFHSM_INFINEON_TC3XX)/tchsm-server/ld-flatten.sh \
3080+
$(ARCHMK_DIR)hal/$(TARGET).ld $(LSCRIPT_IN) $(TC3_DIR)/tc3 && echo OK)
3081+
ifneq ($(LD_FLATTEN_OUT),OK)
3082+
$(error ld-flatten.sh failed for hal/$(TARGET).ld)
3083+
endif
30763084
endif
30773085
endif
30783086
else ifeq ($(HT_LLVM),1)
@@ -3229,9 +3237,9 @@ ifeq ($(ARCH), AURIX)
32293237

32303238
# Linker scripts ship with the port, not in hal/.
32313239
ifeq ($(TARGET), aurix_tc4xx_csrm)
3232-
LSCRIPT_IN=$(TC4_WB_DIR)/csrm/aurix_tc4xx_csrm.ld
3240+
$(call LSCRIPT_IN_DEFAULT,$(TC4_WB_DIR)/csrm/aurix_tc4xx_csrm.ld)
32333241
else
3234-
LSCRIPT_IN=$(TC4_WB_DIR)/aurix_tc4xx.ld
3242+
$(call LSCRIPT_IN_DEFAULT,$(TC4_WB_DIR)/aurix_tc4xx.ld)
32353243
endif
32363244
CFLAGS += \
32373245
-I$(TC4_LLD_DIR) \
@@ -3338,7 +3346,11 @@ ifeq ($(ARCH), AURIX)
33383346
# Full-system CSRM wolfBoot target leaves host release to tchsm-server.
33393347
ifeq ($(AURIX_TC4_FULLSYS),1)
33403348
CFLAGS += -DWOLFBOOT_AURIX_TC4XX_FULLSYS
3341-
LSCRIPT_IN=$(TC4_WB_DIR)/csrm/aurix_tc4xx_csrm_fullsys.ld
3349+
# Full-system layout overrides the per-port default above; a
3350+
# user-provided LSCRIPT_IN still wins.
3351+
ifeq ($(LSCRIPT_IN_USER),)
3352+
LSCRIPT_IN:=$(TC4_WB_DIR)/csrm/aurix_tc4xx_csrm_fullsys.ld
3353+
endif
33423354
endif
33433355
endif
33443356

‎config/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ config:
44
rm -f ../config/target.ld
55
rm -f ../.config
66
rm -f ../include/target.h
7-
@$(foreach q, $(CONFIG_VARS), a=$($q); echo -n $q \? [$$a] :; a=$($q); read SH_$q; test -z $$SH_$q && SH_$q=$$a; echo "$q?=$$SH_$q" >> ../.config;)
7+
@$(foreach q, $(CONFIG_VARS), a=$($q); echo -n $q \? [$$a] :; a=$($q); read SH_$q; test -z $$SH_$q && SH_$q=$$a; test -n "$$SH_$q" && echo "$q?=$$SH_$q" >> ../.config;)
88

‎docs/compile.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,31 @@ trailer sector of room on top — see the sizing guide in
114114
[firmware_update.md](firmware_update.md#independent-partition-sizing).
115115
Not supported with `ENCRYPT` or `PULL_LINKER_DEFINES`.
116116

117+
### Custom linker script
118+
119+
Each target ships a linker script (e.g. `hal/stm32f4.ld`) that is selected by
120+
the build system based on the target and active options (TZEN, encryption,
121+
trailers, ...). To use your own script instead, set `LSCRIPT_IN` to its path,
122+
either in the .config file, in the environment, or on the make command line:
123+
124+
```sh
125+
make TARGET=stm32f4 LSCRIPT_IN=/path/to/my.ld
126+
```
127+
128+
A user-provided `LSCRIPT_IN` wins over the target-specific default; when unset,
129+
the build falls back to the script of the target, then to `hal/$(TARGET).ld`.
130+
The script is processed by the same substitution pipeline as the included ones,
131+
so it can (and should) use the same `@PLACEHOLDERS@` (e.g.
132+
`@WOLFBOOT_PARTITION_BOOT_ADDRESS@`, `@WOLFBOOT_PARTITION_SIZE@`,
133+
`@ARCH_FLASH_OFFSET@`); the substituted output is written to `config/target.ld`.
134+
135+
Notes:
136+
137+
- With ARMClang (`USE_ARMCLANG=1`) the script must be a `.sct` scatter file.
138+
- On two-stage targets (e.g. x86) the same script is used for both stages.
139+
- The script must place the bootloader sections so that they fit the flash
140+
geometry configured above; wolfBoot does not validate the layout.
141+
117142
## Bootloader features
118143

119144
A number of characteristics can be turned on/off during wolfBoot compilation. Bootloader size,

‎hal/boards/stm32wb_nucleo/board.mk‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARCH_FLASH_OFFSET=0x08000000
2-
LSCRIPT_IN=hal/stm32wb.ld
2+
$(call LSCRIPT_IN_DEFAULT,hal/stm32wb.ld)
33

44
CFLAGS+=-DWHAL_CFG_NO_TIMEOUT
55

0 commit comments

Comments
 (0)