Skip to content

Commit

Permalink
sonix sn32f2xx platform support
Browse files Browse the repository at this point in the history
  • Loading branch information
dexter93 committed Mar 3, 2022
1 parent 9f95844 commit 4fbcb68
Show file tree
Hide file tree
Showing 23 changed files with 4,550 additions and 5 deletions.
6 changes: 6 additions & 0 deletions builddefs/bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# stm32duino STM32Duino (STM32F103x8)
# stm32-dfu STM32 USB DFU in ROM
# apm32-dfu APM32 USB DFU in ROM
# sn32-dfu SN32 USB DFU in ROM
# RISC-V:
# gd32v-dfu GD32V USB DFU in ROM
#
Expand Down Expand Up @@ -203,6 +204,11 @@ ifeq ($(strip $(BOOTLOADER)), md-boot)
BOOTLOADER_TYPE = md_boot
endif

ifeq ($(strip $(BOOTLOADER)), sn32-dfu)
OPT_DEFS += -DBOOTLOADER_SN32_DFU
BOOTLOADER_TYPE = sn32_dfu
endif

ifeq ($(strip $(BOOTLOADER_TYPE)),)
$(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate 'BOOTLOADER' in your keyboard's 'rules.mk' file.)
endif
96 changes: 96 additions & 0 deletions builddefs/mcu_selection.mk
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,102 @@ ifneq ($(findstring GD32VF103, $(MCU)),)
USE_FPU ?= no
endif

ifneq ($(findstring SN32F248F, $(MCU)),)
# Cortex version
MCU = cortex-m0

# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
ARMV = 6

## chip/board settings
# - the next two should match the directories in
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = SN32
MCU_SERIES = SN32F240

# Linker script to use
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
# or <keyboard_dir>/ld/
MCU_LDSCRIPT ?= SN32F240

# Startup code to use
# - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
MCU_STARTUP ?= sn32f24x

# Board: it should exist either in <chibios>/os/hal/boards/,
# <keyboard_dir>/boards/, or drivers/boards/
BOARD ?= SN_SN32F240

USE_FPU ?= no

# Bootloader address for SN32 DFU
SN32_BOOTLOADER_ADDRESS = 0x1FFF0301
endif

ifneq ($(findstring SN32F248BF, $(MCU)),)
# Cortex version
MCU = cortex-m0

# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
ARMV = 6

## chip/board settings
# - the next two should match the directories in
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = SN32
MCU_SERIES = SN32F240B

# Linker script to use
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
# or <keyboard_dir>/ld/
MCU_LDSCRIPT ?= SN32F240B

# Startup code to use
# - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
MCU_STARTUP ?= sn32f24xb

# Board: it should exist either in <chibios>/os/hal/boards/,
# <keyboard_dir>/boards/, or drivers/boards/
BOARD ?= SN_SN32F240B

USE_FPU ?= no

# Bootloader address for SN32 DFU
SN32_BOOTLOADER_ADDRESS = 0x1FFF0301
endif

ifneq ($(findstring SN32F268F, $(MCU)),)
# Cortex version
MCU = cortex-m0

# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
ARMV = 6

## chip/board settings
# - the next two should match the directories in
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = SN32
MCU_SERIES = SN32F260

# Linker script to use
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
# or <keyboard_dir>/ld/
MCU_LDSCRIPT ?= SN32F260

# Startup code to use
# - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
MCU_STARTUP ?= sn32f26x

# Board: it should exist either in <chibios>/os/hal/boards/,
# <keyboard_dir>/boards/, or drivers/boards/
BOARD ?= SN_SN32F260

USE_FPU ?= no

# Bootloader address for SN32 DFU
SN32_BOOTLOADER_ADDRESS = 0x1FFF0009
endif

ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287))
PROTOCOL = LUFA

Expand Down
4 changes: 2 additions & 2 deletions data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"processor": {
"type": "string",
"enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66FX1M0", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F405", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L432", "STM32L433", "STM32L442", "STM32L443", "GD32VF103", "WB32F3G71", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
"enum": ["cortex-m0", "cortex-m0plus", "cortex-m3", "cortex-m4", "MKL26Z64", "MK20DX128", "MK20DX256", "MK66FX1M0", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F405", "STM32F407", "STM32F411", "STM32F446", "STM32G431", "STM32G474", "STM32L412", "STM32L422", "STM32L432", "STM32L433", "STM32L442", "STM32L443", "GD32VF103", "WB32F3G71", "SN32F248F", "SN32F248BF", "SN32F268F", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
},
"audio": {
"type": "object",
Expand Down Expand Up @@ -57,7 +57,7 @@
},
"bootloader": {
"type": "string",
"enum": ["atmel-dfu", "bootloadhid", "bootloadHID", "custom", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "md-boot", "qmk-dfu", "qmk-hid", "stm32-dfu", "stm32duino", "gd32v-dfu", "wb32-dfu", "unknown", "usbasploader", "USBasp", "tinyuf2"],
"enum": ["atmel-dfu", "bootloadhid", "bootloadHID", "custom", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "md-boot", "qmk-dfu", "qmk-hid", "stm32-dfu", "stm32duino", "gd32v-dfu", "wb32-dfu", "unknown", "usbasploader", "USBasp", "tinyuf2", "sn32_dfu"],
},
"bootloader_instructions": {
"type": "string",
Expand Down
5 changes: 4 additions & 1 deletion lib/python/qmk/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
MAX_KEYBOARD_SUBFOLDERS = 5

# Supported processor types
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71'
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'SN32F248F', 'SN32F248BF', 'SN32F268F'
LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'

Expand Down Expand Up @@ -42,6 +42,9 @@
"STM32L443": "stm32-dfu",
"GD32VF103": "gd32v-dfu",
"WB32F3G71": "wb32-dfu",
"SN32F248F": "sn32-dfu",
"SN32F248BF": "sn32-dfu",
"SN32F268F": "sn32-dfu",
"atmega16u2": "atmel-dfu",
"atmega32u2": "atmel-dfu",
"atmega16u4": "atmel-dfu",
Expand Down
12 changes: 12 additions & 0 deletions platforms/chibios/boards/SN_SN32F240/board/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# List of all the board related files.
BOARDSRC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F240/board.c

# Required include directories
BOARDINC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F240

# Optimize for speed
OPT = 2

# Shared variables
ALLCSRC += $(BOARDSRC)
ALLINC += $(BOARDINC)
Loading

0 comments on commit 4fbcb68

Please sign in to comment.