Skip to content

Commit

Permalink
cpu/stm32: fix riotboot settings for L4
Browse files Browse the repository at this point in the history
The family is not called `stm32l4` but `l4`. A minimum `RIOTBOOT_LEN` of `0x2000` is required.
  • Loading branch information
gschorcht committed May 19, 2023
1 parent b98a422 commit a632910
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cpu/stm32/stm32_riotboot.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ ifneq (,$(filter $(CPU_FAM),f2 f4 f7))
# flash, to get evenly sized and distributed slots.
SLOT0_LEN ?= $(shell printf "0x%x" $$((($(ROM_LEN:%K=%*1024)-2*$(RIOTBOOT_LEN)) / $(NUM_SLOTS))))
SLOT1_LEN ?= $(SLOT0_LEN)
else ifeq (stm32l4,$(CPU_FAM))
else ifeq (l4,$(CPU_FAM))
# "The Vector table must be naturally aligned to a power of two whose alignment
# value is greater than or equal to number of Exceptions supported x 4"
# CPU_IRQ_NUMOFF for stm32l4 boards is < 91+16 so (107*4 bytes = 428 bytes ~= 0x200)
# CPU_IRQ_NUMOFF for stm32l4 boards is < 95+16 so (111*4 bytes = 444 bytes ~= 0x200)
# RIOTBOOT_HDR_LEN can be set to 0x200
RIOTBOOT_HDR_LEN ?= 0x200

# Slot size is determined by "((total_flash_size - RIOTBOOT_LEN) / 2)".
# If RIOTBOOT_LEN uses an odd number of flashpages, the remainder of the
# flash cannot be divided by two slots while staying FLASHPAGE_SIZE aligned.
RIOTBOOT_LEN ?= 0x2000
else ifeq (stm32wb,$(CPU_FAM))
# "The Vector table must be naturally aligned to a power of two whose alignment
# value is greater than or equal to number of Exceptions supported x 4"
Expand Down

0 comments on commit a632910

Please sign in to comment.