Skip to content

Commit b607631

Browse files
committed
feat(swan_r5): UF2 support, with UF2 family IDs assigned to stm32 chipsets.
1 parent 38f9153 commit b607631

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

ports/stm/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,11 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf
302302

303303
$(BUILD)/firmware.uf2: $(BUILD)/firmware.hex
304304
$(ECHO) "Create $@"
305-
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f 0x57755a57 -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^
305+
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^
306306

307307
flash: $(BUILD)/firmware.bin
308308
$(ECHO) "Writing $< to the board"
309-
dfu-util -a 0 --dfuse-address 0x08000000 -D $(BUILD)/firmware.bin
309+
dfu-util -a 0 --dfuse-address $(BOOTLOADER_OFFSET) -D $(BUILD)/firmware.bin
310310

311311
include $(TOP)/py/mkrules.mk
312312

ports/stm/boards/swan_r5/mpconfigboard.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LD_DEFAULT = boards/STM32L4R5_default.ld
1414
# UF2 boot option
1515
LD_BOOT = boards/STM32L4R5_boot.ld
1616
UF2_OFFSET = 0x8010000
17+
UF2_BOOTLOADER ?= 1
1718

1819
# Turn all of the below off while trying to get the thing to run
1920
# These modules are implemented in ports/<port>/common-hal:

ports/stm/mpconfigport.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F405xx STM32F407xx))
88
CIRCUITPY_SDIOIO ?= 1
99
# Number of USB endpoint pairs.
1010
USB_NUM_ENDPOINT_PAIRS = 4
11+
UF2_FAMILY_ID ?= 0x6d0922fa
1112
endif
1213

1314
ifeq ($(MCU_SERIES),F4)
@@ -25,6 +26,7 @@ ifeq ($(MCU_SERIES),F4)
2526
CIRCUITPY_ROTARYIO ?= 0
2627
CIRCUITPY_RTC ?= 0
2728
USB_NUM_ENDPOINT_PAIRS = 4
29+
UF2_FAMILY_ID ?= 0x57755a57
2830
endif
2931

3032
ifeq ($(MCU_SERIES),H7)
@@ -43,6 +45,7 @@ ifeq ($(MCU_SERIES),H7)
4345
CIRCUITPY_RTC ?= 0
4446

4547
USB_NUM_ENDPOINT_PAIRS = 9
48+
UF2_FAMILY_ID ?= 0x6db66082
4649
endif
4750

4851
ifeq ($(MCU_SERIES),F7)
@@ -59,6 +62,7 @@ ifeq ($(MCU_SERIES),F7)
5962
CIRCUITPY_RTC ?= 0
6063

6164
USB_NUM_ENDPOINT_PAIRS = 6
65+
UF2_FAMILY_ID ?= 0x53b80f00
6266
endif
6367

6468
ifeq ($(MCU_SERIES),L4)
@@ -77,6 +81,7 @@ ifeq ($(MCU_SERIES),L4)
7781
# This slide deck https://www.st.com/content/ccc/resource/training/technical/product_training/98/89/c8/6c/3e/e9/49/79/STM32L4_Peripheral_USB.pdf/files/STM32L4_Peripheral_USB.pdf/jcr:content/translations/en.STM32L4_Peripheral_USB.pdf
7882
# cites 16 endpoints, 8 endpoint pairs, while section 3.39 of the L4R5 datasheet states 6 endpoint pairs.
7983
USB_NUM_ENDPOINT_PAIRS = 6
84+
UF2_FAMILY_ID ?= 0x00ff6919
8085
endif
8186

8287
CIRCUITPY_PARALLELDISPLAY := 0

0 commit comments

Comments
 (0)