Skip to content

Commit

Permalink
sn32: add direct qmk flash support
Browse files Browse the repository at this point in the history
build and flash in one line
  • Loading branch information
dexter93 committed Sep 19, 2024
1 parent d36bb3c commit 4aa4afa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions platforms/chibios/bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ endif
ifeq ($(strip $(BOOTLOADER)), sn32-dfu)
OPT_DEFS += -DBOOTLOADER_SN32_DFU
BOOTLOADER_TYPE = sn32_dfu

# Options to pass to sonixflasher when flashing
ifeq ($(strip $(MCU_SERIES)), SN32F240)
DFU_ARGS ?= -v 0c45/7900
endif
ifeq ($(strip $(MCU_SERIES)), SN32F240B)
DFU_ARGS ?= -v 0c45/7040
endif
ifeq ($(strip $(MCU_SERIES)), SN32F260)
DFU_ARGS ?= -v 0c45/7010 -o 0x200
endif

endif

ifeq ($(strip $(BOOTLOADER_TYPE)),)
Expand Down
8 changes: 8 additions & 0 deletions platforms/chibios/flash.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ define EXEC_WB32_DFU_UPDATER
$(WB32_DFU_UPDATER) -D $(BUILD_DIR)/$(TARGET).bin && $(WB32_DFU_UPDATER) -R
endef

SONIX_FLASHER ?= sonixflasher

define EXEC_SONIX_FLASHER
$(SONIX_FLASHER) $(DFU_ARGS) -f $(BUILD_DIR)/$(TARGET).bin
endef

dfu-util: $(BUILD_DIR)/$(TARGET).bin cpfirmware sizeafter
$(call EXEC_DFU_UTIL)

Expand Down Expand Up @@ -115,6 +121,8 @@ else ifeq ($(strip $(MCU_FAMILY)),WB32)
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_WB32_DFU_UPDATER)
else ifeq ($(strip $(MCU_FAMILY)),GD32V)
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL)
else ifeq ($(strip $(MCU_FAMILY)),SN32)
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_SONIX_FLASHER)
else
$(PRINT_OK); $(SILENT) || printf "$(MSG_FLASH_BOOTLOADER)"
endif

0 comments on commit 4aa4afa

Please sign in to comment.