@@ -25,21 +25,26 @@ ifneq (,$(filter $(CPU_FAM),f2 f4 f7))
2525 # flash, to get evenly sized and distributed slots.
2626 SLOT0_LEN ?= $(shell printf "0x% x" $$((($(ROM_LEN:%K=%*1024 ) -2*$(RIOTBOOT_LEN ) ) / $(NUM_SLOTS ) ) ))
2727 SLOT1_LEN ?= $(SLOT0_LEN )
28- else ifeq (stm32l4 ,$(CPU_FAM))
28+ else ifeq (l4 ,$(CPU_FAM))
2929 # "The Vector table must be naturally aligned to a power of two whose alignment
3030 # value is greater than or equal to number of Exceptions supported x 4"
31- # CPU_IRQ_NUMOFF for stm32l4 boards is < 91 +16 so (107 *4 bytes = 428 bytes ~= 0x200)
31+ # CPU_IRQ_NUMOFF for stm32l4 boards is < 95 +16 so (111 *4 bytes = 444 bytes ~= 0x200)
3232 # RIOTBOOT_HDR_LEN can be set to 0x200
3333 RIOTBOOT_HDR_LEN ?= 0x200
34- else ifeq (stm32wb ,$(CPU_FAM))
34+ else ifeq (wb ,$(CPU_FAM))
3535 # "The Vector table must be naturally aligned to a power of two whose alignment
3636 # value is greater than or equal to number of Exceptions supported x 4"
37- # CPU_IRQ_NUMOFF for stm32l4 boards is < 91 +16 so (107 *4 bytes = 428 bytes ~= 0x200)
37+ # CPU_IRQ_NUMOFF for stm32wb boards is < 63 +16 so (79 *4 bytes = 316 bytes ~= 0x200)
3838 # RIOTBOOT_HDR_LEN can be set to 0x200
3939 RIOTBOOT_HDR_LEN ?= 0x200
4040
4141 # Slot size is determined by "((total_flash_size - RIOTBOOT_LEN) / 2)".
4242 # If RIOTBOOT_LEN uses an odd number of flashpages, the remainder of the
4343 # flash cannot be divided by two slots while staying FLASHPAGE_SIZE aligned.
44- RIOTBOOT_LEN ?= 0x2000
44+ # 8KB are currently enough, set it to 16KB if USB-DFU or tinyUSB DFU is used
45+ ifneq (,$(filter usbus_dfu tinyusb_dfu,$(USEMODULE)))
46+ RIOTBOOT_LEN ?= 0x4000
47+ else
48+ RIOTBOOT_LEN ?= 0x2000
49+ endif
4550endif
0 commit comments