diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 95124cb00059..e5c3a64534fa 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -188,7 +188,7 @@ else ifeq ($(PLATFORM),AVR) # Automatically provided by avr-libc, nothing required else ifeq ($(PLATFORM),CHIBIOS) - ifneq ($(filter STM32F3xx_% STM32F1xx_% STM32F4xx_% STM32L4xx_% GD32VF103_% CM32M101A_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8 ,$(MCU_SERIES)_$(MCU_LDSCRIPT)),) + ifneq ($(filter STM32F3xx_% STM32F1xx_% STM32F4xx_% STM32L4xx_% GD32VF103_% CM32M101A_% AIR32F103_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8 ,$(MCU_SERIES)_$(MCU_LDSCRIPT)),) # Emulated EEPROM OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED COMMON_VPATH += $(DRIVER_PATH)/eeprom diff --git a/builddefs/mcu_selection.mk b/builddefs/mcu_selection.mk index 4c9f4f36c2f7..7c80a7982f7f 100644 --- a/builddefs/mcu_selection.mk +++ b/builddefs/mcu_selection.mk @@ -778,6 +778,38 @@ ifneq ($(findstring CM32M101A, $(MCU)),) CM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000 endif +ifneq ($(findstring AIR32F103, $(MCU)),) + # Cortex version + MCU = cortex-m3 + + # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 + ARMV = 7 + + ## chip/board settings + # - the next two should match the directories in + # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) + MCU_FAMILY = AIR32 + MCU_SERIES = AIR32F10x + + # Linker script to use + # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ + # or /ld/ + MCU_LDSCRIPT ?= AIR32F103xC + + # Startup code to use + # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/ + MCU_STARTUP ?= air32f10x + + # Board: it should exist either in /os/hal/boards/, + # /boards/, or drivers/boards/ + BOARD ?= GENERIC_AIR32_F103 + + USE_FPU ?= no + + # UF2 settings + UF2_FAMILY ?= STM32F1 +endif + ifneq ($(findstring GD32VF103, $(MCU)),) # RISC-V MCU = risc-v diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index b2da6070ceff..60acc9cf2714 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -21,7 +21,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", "WB32FQ95", "CM32M101A", "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", "WB32FQ95", "CM32M101A", "AIR32F103", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"] }, "audio": { "type": "object", diff --git a/keyboards/zhaqian/tester/air32f103/board.h b/keyboards/zhaqian/tester/air32f103/board.h new file mode 100644 index 000000000000..a179d1c341b2 --- /dev/null +++ b/keyboards/zhaqian/tester/air32f103/board.h @@ -0,0 +1,25 @@ +/* Copyright 2020 Nick Brassel (tzarc) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include_next "board.h" + +#undef AIR32_HSECLK +#define AIR32_HSECLK 8000000 + +#undef AIR32F103xB +#define AIR32F103xC \ No newline at end of file diff --git a/keyboards/zhaqian/tester/air32f103/chconf.h b/keyboards/zhaqian/tester/air32f103/chconf.h new file mode 100644 index 000000000000..524194b39c08 --- /dev/null +++ b/keyboards/zhaqian/tester/air32f103/chconf.h @@ -0,0 +1,24 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define CH_CFG_ST_FREQUENCY 10000 + +#define CH_CFG_ST_TIMEDELTA 0 + +#include_next + diff --git a/keyboards/zhaqian/tester/air32f103/config.h b/keyboards/zhaqian/tester/air32f103/config.h new file mode 100644 index 000000000000..b28759ffc109 --- /dev/null +++ b/keyboards/zhaqian/tester/air32f103/config.h @@ -0,0 +1,54 @@ +/* Copyright 2021 ZhaQian + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config_common.h" + +#define MATRIX_COL_PINS { A9, A0, B15, B14, B13 } +#define MATRIX_ROW_PINS { A10, B6, C14 } +#define UNUSED_PINS + +#ifdef RGB_MATRIX_ENABLE +#define RGB_DI_PIN B3 +#define WS2812_PWM_DRIVER PWMD2 +#define WS2812_PWM_CHANNEL 2 +#define WS2812_PWM_PAL_MODE 2 +#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 +#define WS2812_DMA_CHANNEL 2 +#endif + +#ifdef ENCODER_ENABLE +#define ENCODERS_PAD_A { B1 } +#define ENCODERS_PAD_B { B3 } +#define ENCODER_RESOLUTIONS { 4 } +#ifdef ENCODER_TRIGGER_ENABLE +#define ENCODER_PAD_A_KEY_POS {4, 1} +#define ENCODER_PAD_B_KEY_POS {4, 2} +#endif +#endif + +#ifdef UNDERGLOW_RGB_MATRIX_ENABLE +#undef UG_RGB_MATRIX_ANIMATIONS +#define UG_RGB_MATRIX_CYCLEOUTIN +#undef UG_RGB_MATRIX_WPM_ANIMATIONS +#endif +// #define DEBUG_EEPROM_OUTPUT +#define DEBUG_MATRIX_SCAN_RATE + +// #define SERIAL_DRIVER SD2 +// #define SD1_TX_PIN A2 +// #define SD1_RX_PIN A3 \ No newline at end of file diff --git a/keyboards/zhaqian/tester/air32f103/rules.mk b/keyboards/zhaqian/tester/air32f103/rules.mk new file mode 100644 index 000000000000..e194004d61a5 --- /dev/null +++ b/keyboards/zhaqian/tester/air32f103/rules.mk @@ -0,0 +1,11 @@ +MCU = AIR32F103 +MCU_LDSCRIPT = AIR32F103xCuf2 +FIRMWARE_FORMAT = uf2 + +BOOTLOADER = custom + +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE + +SRC += uf2_boot.c + + diff --git a/keyboards/zhaqian/tester/air32f103/uf2_boot.c b/keyboards/zhaqian/tester/air32f103/uf2_boot.c new file mode 100644 index 000000000000..c09adb15d6f2 --- /dev/null +++ b/keyboards/zhaqian/tester/air32f103/uf2_boot.c @@ -0,0 +1,30 @@ +/* Copyright 2022 ZhaQian + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "bootloader.h" + +#include + +#define MAGIC_BOOT 0x544F4F42UL +#define MAGIC_REG *(volatile uint32_t*)0x20004000 + +void bootloader_jump(void) { + MAGIC_REG = MAGIC_BOOT; + NVIC_SystemReset(); +} + +void enter_bootloader_mode_if_requested(void) {} + diff --git a/keyboards/zhaqian/tester/f103/config.h b/keyboards/zhaqian/tester/f103/config.h index e63a899fa273..48fe2cbd4707 100644 --- a/keyboards/zhaqian/tester/f103/config.h +++ b/keyboards/zhaqian/tester/f103/config.h @@ -47,7 +47,7 @@ #undef UG_RGB_MATRIX_WPM_ANIMATIONS #endif // #define DEBUG_EEPROM_OUTPUT -// #define DEBUG_MATRIX_SCAN_RATE +#define DEBUG_MATRIX_SCAN_RATE #define SERIAL_DRIVER SD2 #define SD1_TX_PIN A2 diff --git a/keyboards/zhaqian/tester/rules.mk b/keyboards/zhaqian/tester/rules.mk index 903cc79501c7..65009517c187 100644 --- a/keyboards/zhaqian/tester/rules.mk +++ b/keyboards/zhaqian/tester/rules.mk @@ -1,6 +1,6 @@ BOOTMAGIC_ENABLE = yes MOUSEKEY_ENABLE = yes EXTRAKEY_ENABLE = yes -CONSOLE_ENABLE = no +CONSOLE_ENABLE = yes COMMAND_ENABLE = no NKRO_ENABLE = yes diff --git a/lib/chibios-contrib b/lib/chibios-contrib index 4568901a91e9..09309b9595ae 160000 --- a/lib/chibios-contrib +++ b/lib/chibios-contrib @@ -1 +1 @@ -Subproject commit 4568901a91e9bef78ea96a7a83e8150fe1f7353a +Subproject commit 09309b9595ae7fe74912131a938c751689e70411 diff --git a/lib/python/qmk/constants.py b/lib/python/qmk/constants.py index 9c46df61ccd3..8fe4b5dce155 100644 --- a/lib/python/qmk/constants.py +++ b/lib/python/qmk/constants.py @@ -14,7 +14,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', 'WB32FQ95', 'CM32M101A' +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', 'WB32FQ95', 'CM32M101A', 'AIR32F103' LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85' diff --git a/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.c b/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.c new file mode 100644 index 000000000000..78c5e7965c2f --- /dev/null +++ b/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.c @@ -0,0 +1,73 @@ +/* + Copyright (C) + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * This file has been automatically generated using ChibiStudio board + * generator plugin. Do not edit manually. + */ + +#include "hal.h" +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver exported variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local variables and types. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local functions. */ +/*===========================================================================*/ + +/** + * @brief PAL setup. + * @details Digital I/O ports static configuration as defined in @p board.h. + * This variable is used by the HAL when initializing the PAL driver. + */ +#if HAL_USE_PAL || defined(__DOXYGEN__) +const PALConfig pal_default_config = +{ + {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, + {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, + {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, + {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, +}; +#endif + +/*===========================================================================*/ +/* Driver interrupt handlers. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver exported functions. */ +/*===========================================================================*/ +/* + * Early initialization code. + * This initialization must be performed just after stack setup and before + * any other initialization. + */ +void __early_init(void) { + // enter_bootloader_mode_if_requested(); + air32_clock_init(); +} +/** + * @brief Board-specific initialization code. + * @note You can add your board-specific code here. + */ +void boardInit(void) { + +} \ No newline at end of file diff --git a/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.h b/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.h new file mode 100644 index 000000000000..09540794c023 --- /dev/null +++ b/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.h @@ -0,0 +1,106 @@ +#pragma once +/* + Copyright (C) + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * This file has been automatically generated using ChibiStudio board + * generator plugin. Do not edit manually. + */ + +#ifndef BOARD_H +#define BOARD_H + +/*===========================================================================*/ +/* Driver constants. */ +/*===========================================================================*/ + +/* + * Setup board. + */ +/* + * Port A setup. + * Everything input with pull-up except: + * PA2 - Alternate output (USART2 TX). + * PA3 - Normal input (USART2 RX). + * PA9 - Alternate output (USART1 TX). + * PA10 - Normal input (USART1 RX). + */ +#define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */ +#define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */ +#define VAL_GPIOAODR 0xFFFFFFFF + +/* + * Port B setup. + * Everything input with pull-up except: + * PB10 - Push Pull output (USB switch). + */ +#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ +#define VAL_GPIOBCRH 0x88888388 /* PB15...PB8 */ +#define VAL_GPIOBODR 0xFFFFFFFF + +/* + * Port C setup. + * Everything input with pull-up except: + * PC13 - Push Pull output (LED). + */ +#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ +#define VAL_GPIOCCRH 0x88388888 /* PC15...PC8 */ +#define VAL_GPIOCODR 0xFFFFFFFF + +/* + * Port D setup. + * Everything input with pull-up except: + * PD0 - Normal input (XTAL). + * PD1 - Normal input (XTAL). + */ +#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ +#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ +#define VAL_GPIODODR 0xFFFFFFFF +/* + * Board identifier. + */ +#define BOARD_AIR32F103 +#define BOARD_NAME "AIR32F103" + +#define AIR32F103xB + +#if !defined(AIR32F10x) + #define AIR32F10x +#endif + +/* + * Board oscillators-related settings. + * NOTE: LSE not fitted. + */ +#if !defined(AIR32_LSECLK) +#define AIR32_LSECLK 0U +#endif + +#if !defined(AIR32_HSECLK) +#define AIR32_HSECLK 8000000U +#endif +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* BOARD_H */ \ No newline at end of file diff --git a/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.mk b/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.mk new file mode 100644 index 000000000000..842e33590594 --- /dev/null +++ b/platforms/chibios/boards/GENERIC_AIR32_F103/board/board.mk @@ -0,0 +1,9 @@ +# List of all the board related files. +BOARDSRC = $(BOARD_PATH)/board/board.c + +# Required include directories +BOARDINC = $(BOARD_PATH)/board + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC) diff --git a/platforms/chibios/boards/GENERIC_AIR32_F103/configs/chconf.h b/platforms/chibios/boards/GENERIC_AIR32_F103/configs/chconf.h new file mode 100644 index 000000000000..295bac53cc60 --- /dev/null +++ b/platforms/chibios/boards/GENERIC_AIR32_F103/configs/chconf.h @@ -0,0 +1,21 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define CH_CFG_ST_TIMEDELTA 0 + +#include_next \ No newline at end of file diff --git a/platforms/chibios/boards/GENERIC_AIR32_F103/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_AIR32_F103/configs/mcuconf.h new file mode 100644 index 000000000000..4032d571df88 --- /dev/null +++ b/platforms/chibios/boards/GENERIC_AIR32_F103/configs/mcuconf.h @@ -0,0 +1,228 @@ +/* + Copyright (C) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef MCUCONF_H +#define MCUCONF_H + +#define AIR32F10x_MCUCONF TRUE + +/* + * AIR32F10x drivers configuration. + * The following settings override the default settings present in + * the various device driver implementation headers. + * Note that the settings for each driver only have effect if the whole + * driver is enabled in halconf.h. + * + * IRQ priorities: + * 7...0 Lowest...Highest. + * + */ + +/* + * HAL driver system settings. + */ +// #define AIR32_NO_INIT FALSE +// #define AIR32_HSI_ENABLED TRUE +// #define AIR32_LSI_ENABLED FALSE +// #define AIR32_HSE_ENABLED TRUE +// #define AIR32_LSE_ENABLED FALSE +// #define AIR32_SW AIR32_SW_PLL +// #define AIR32_PLLSRC AIR32_PLLSRC_HSE +// #define AIR32_PLLXTPRE AIR32_PLLXTPRE_DIV1 +// #define AIR32_PLLMUL_VALUE 9 +// #define AIR32_HPRE AIR32_HPRE_DIV1 +// #define AIR32_PPRE1 AIR32_PPRE1_DIV2 +// #define AIR32_PPRE2 AIR32_PPRE2_DIV2 +// #define AIR32_ADCPRE AIR32_ADCPRE_DIV4 +// #define AIR32_USB_CLOCK_REQUIRED TRUE +// #define AIR32_USBPRE AIR32_USBPRE_DIV1P5 +// #define AIR32_MCOSEL AIR32_MCOSEL_NOCLOCK +// #define AIR32_RTCSEL AIR32_RTCSEL_HSEDIV +// #define AIR32_PVD_ENABLE FALSE +// #define AIR32_PLS AIR32_PLS_LEV0 +#define AIR32_NO_INIT FALSE +#define AIR32_HSI_ENABLED TRUE +#define AIR32_LSI_ENABLED FALSE +#define AIR32_HSE_ENABLED TRUE +#define AIR32_LSE_ENABLED FALSE +#define AIR32_SW AIR32_SW_PLL +#define AIR32_PLLSRC AIR32_PLLSRC_HSE +#define AIR32_PLLXTPRE AIR32_PLLXTPRE_DIV1 +#define AIR32_PLLMUL_VALUE 15 +#define AIR32_HPRE AIR32_HPRE_DIV1 +#define AIR32_PPRE1 AIR32_PPRE1_DIV2 +#define AIR32_PPRE2 AIR32_PPRE2_DIV1 +#define AIR32_ADCPRE AIR32_ADCPRE_DIV16 +#define AIR32_USB_CLOCK_REQUIRED TRUE +#define AIR32_USBPRE AIR32_USBPRE_DIV2P5 +#define AIR32_MCOSEL AIR32_MCOSEL_NOCLOCK +#define AIR32_RTCSEL AIR32_RTCSEL_HSEDIV +#define AIR32_PVD_ENABLE FALSE +#define AIR32_PLS AIR32_PLS_LEV0 + +/* + * ADC driver system settings. + */ +#define AIR32_ADC_USE_ADC1 FALSE +#define AIR32_ADC_ADC1_DMA_PRIORITY 2 +#define AIR32_ADC_ADC1_IRQ_PRIORITY 6 + +#define AIR32_ADC_USE_ADC2 FALSE +#define AIR32_ADC_ADC2_DMA_PRIORITY 2 +#define AIR32_ADC_ADC2_IRQ_PRIORITY 6 + +/* + * DAC driver system settings. + */ +#define AIR32_DAC_DUAL_MODE FALSE +#define AIR32_DAC_USE_DAC1_CH1 FALSE +#define AIR32_DAC_USE_DAC1_CH2 FALSE +#define AIR32_DAC_DAC1_CH1_IRQ_PRIORITY 7 +#define AIR32_DAC_DAC1_CH2_IRQ_PRIORITY 7 +#define AIR32_DAC_DAC1_CH1_DMA_PRIORITY 7 +#define AIR32_DAC_DAC1_CH2_DMA_PRIORITY 7 + +/* + * CAN driver system settings. + */ +#define AIR32_CAN_USE_CAN1 FALSE +#define AIR32_CAN_CAN1_IRQ_PRIORITY 11 + +/* + * EXT driver system settings. + */ +#define AIR32_EXT_EXTI0_IRQ_PRIORITY 6 +#define AIR32_EXT_EXTI1_IRQ_PRIORITY 6 +#define AIR32_EXT_EXTI2_IRQ_PRIORITY 6 +#define AIR32_EXT_EXTI3_IRQ_PRIORITY 6 +#define AIR32_EXT_EXTI4_IRQ_PRIORITY 6 +#define AIR32_EXT_EXTI5_9_IRQ_PRIORITY 6 +#define AIR32_EXT_EXTI10_15_IRQ_PRIORITY 6 + +/* + * GPT driver system settings. + */ +#define AIR32_GPT_USE_TIM1 FALSE +#define AIR32_GPT_USE_TIM2 FALSE +#define AIR32_GPT_USE_TIM3 FALSE +#define AIR32_GPT_USE_TIM4 FALSE +#define AIR32_GPT_USE_TIM5 FALSE +#define AIR32_GPT_TIM1_IRQ_PRIORITY 7 +#define AIR32_GPT_TIM2_IRQ_PRIORITY 7 +#define AIR32_GPT_TIM3_IRQ_PRIORITY 7 +#define AIR32_GPT_TIM4_IRQ_PRIORITY 7 +#define AIR32_GPT_TIM5_IRQ_PRIORITY 7 + +/* + * I2C driver system settings. + */ +#define AIR32_I2C_USE_I2C1 FALSE +#define AIR32_I2C_USE_I2C2 FALSE +#define AIR32_I2C_BUSY_TIMEOUT 50 +#define AIR32_I2C_I2C1_IRQ_PRIORITY 5 +#define AIR32_I2C_I2C2_IRQ_PRIORITY 5 +#define AIR32_I2C_I2C1_DMA_PRIORITY 3 +#define AIR32_I2C_I2C2_DMA_PRIORITY 3 +#define AIR32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") + +/* + * ICU driver system settings. + */ +#define AIR32_ICU_USE_TIM1 FALSE +#define AIR32_ICU_USE_TIM2 FALSE +#define AIR32_ICU_USE_TIM3 FALSE +#define AIR32_ICU_USE_TIM4 FALSE +#define AIR32_ICU_USE_TIM5 FALSE +#define AIR32_ICU_TIM1_IRQ_PRIORITY 7 +#define AIR32_ICU_TIM2_IRQ_PRIORITY 7 +#define AIR32_ICU_TIM3_IRQ_PRIORITY 7 +#define AIR32_ICU_TIM4_IRQ_PRIORITY 7 +#define AIR32_ICU_TIM5_IRQ_PRIORITY 7 + +/* + * PWM driver system settings. + */ +#define AIR32_PWM_USE_ADVANCED FALSE +#define AIR32_PWM_USE_TIM1 FALSE +#define AIR32_PWM_USE_TIM2 FALSE +#define AIR32_PWM_USE_TIM3 FALSE +#define AIR32_PWM_USE_TIM4 FALSE +#define AIR32_PWM_USE_TIM5 FALSE +#define AIR32_PWM_TIM1_IRQ_PRIORITY 7 +#define AIR32_PWM_TIM2_IRQ_PRIORITY 7 +#define AIR32_PWM_TIM3_IRQ_PRIORITY 7 +#define AIR32_PWM_TIM4_IRQ_PRIORITY 7 +#define AIR32_PWM_TIM5_IRQ_PRIORITY 7 + +/* + * RTC driver system settings. + */ +#define AIR32_RTC_IRQ_PRIORITY 7 + +/* + * SERIAL driver system settings. + */ +#define AIR32_SERIAL_USE_USART1 FALSE +#define AIR32_SERIAL_USE_USART2 FALSE +#define AIR32_SERIAL_USE_USART3 FALSE +#define AIR32_SERIAL_USART1_PRIORITY 12 +#define AIR32_SERIAL_USART2_PRIORITY 12 +#define AIR32_SERIAL_USART3_PRIORITY 12 + +/* + * SPI driver system settings. + */ +#define AIR32_SPI_USE_SPI1 FALSE +#define AIR32_SPI_USE_SPI2 FALSE +#define AIR32_SPI_USE_SPI3 FALSE +#define AIR32_SPI_SPI1_DMA_PRIORITY 1 +#define AIR32_SPI_SPI2_DMA_PRIORITY 1 +#define AIR32_SPI_SPI3_DMA_PRIORITY 1 +#define AIR32_SPI_SPI1_IRQ_PRIORITY 10 +#define AIR32_SPI_SPI2_IRQ_PRIORITY 10 +#define AIR32_SPI_SPI3_IRQ_PRIORITY 10 +#define AIR32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") + +/* + * ST driver system settings. + */ +#define AIR32_ST_IRQ_PRIORITY 8 +#define AIR32_ST_USE_TIMER 2 + +/* + * UART driver system settings. + */ +#define AIR32_UART_USE_USART1 FALSE +#define AIR32_UART_USE_USART2 FALSE +#define AIR32_UART_USE_USART3 FALSE +#define AIR32_UART_USART1_IRQ_PRIORITY 12 +#define AIR32_UART_USART2_IRQ_PRIORITY 12 +#define AIR32_UART_USART3_IRQ_PRIORITY 12 +#define AIR32_UART_USART1_DMA_PRIORITY 0 +#define AIR32_UART_USART2_DMA_PRIORITY 0 +#define AIR32_UART_USART3_DMA_PRIORITY 0 +#define AIR32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") + +/* + * USB driver system settings. + */ +#define AIR32_USB_USE_USB1 TRUE +#define AIR32_USB_LOW_POWER_ON_SUSPEND FALSE +#define AIR32_USB_USB1_HP_IRQ_PRIORITY 13 +#define AIR32_USB_USB1_LP_IRQ_PRIORITY 14 + + +#endif /* MCUCONF_H */ diff --git a/platforms/chibios/boards/GENERIC_AIR32_F103/ld/AIR32F103xB_uf2.ld b/platforms/chibios/boards/GENERIC_AIR32_F103/ld/AIR32F103xB_uf2.ld new file mode 100644 index 000000000000..00a8abcc2b8f --- /dev/null +++ b/platforms/chibios/boards/GENERIC_AIR32_F103/ld/AIR32F103xB_uf2.ld @@ -0,0 +1,85 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * AIR32F103xB_uf2 memory setup. + */ +MEMORY +{ + flash0 (rx) : org = 0x08000000 + 16k, len = 128k - 16k + flash1 (rx) : org = 0x00000000, len = 0 + flash2 (rx) : org = 0x00000000, len = 0 + flash3 (rx) : org = 0x00000000, len = 0 + flash4 (rx) : org = 0x00000000, len = 0 + flash5 (rx) : org = 0x00000000, len = 0 + flash6 (rx) : org = 0x00000000, len = 0 + flash7 (rx) : org = 0x00000000, len = 0 + ram0 (wx) : org = 0x20000000, len = 32k + ram1 (wx) : org = 0x00000000, len = 0 + ram2 (wx) : org = 0x00000000, len = 0 + ram3 (wx) : org = 0x00000000, len = 0 + ram4 (wx) : org = 0x00000000, len = 0 + ram5 (wx) : org = 0x00000000, len = 0 + ram6 (wx) : org = 0x00000000, len = 0 + ram7 (wx) : org = 0x00000000, len = 0 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld \ No newline at end of file diff --git a/platforms/chibios/boards/GENERIC_AIR32_F103/ld/AIR32F103xC_uf2.ld b/platforms/chibios/boards/GENERIC_AIR32_F103/ld/AIR32F103xC_uf2.ld new file mode 100644 index 000000000000..80b8dded460c --- /dev/null +++ b/platforms/chibios/boards/GENERIC_AIR32_F103/ld/AIR32F103xC_uf2.ld @@ -0,0 +1,169 @@ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +/* + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * AIR32F103xB_uf2 memory setup. + */ +MEMORY +{ + flash0 (rx) : org = 0x08000000 + 16k, len = 256k - 16k + flash1 (rx) : org = 0x00000000, len = 0 + flash2 (rx) : org = 0x00000000, len = 0 + flash3 (rx) : org = 0x00000000, len = 0 + flash4 (rx) : org = 0x00000000, len = 0 + flash5 (rx) : org = 0x00000000, len = 0 + flash6 (rx) : org = 0x00000000, len = 0 + flash7 (rx) : org = 0x00000000, len = 0 + ram0 (wx) : org = 0x20000000, len = 64k + ram1 (wx) : org = 0x00000000, len = 0 + ram2 (wx) : org = 0x00000000, len = 0 + ram3 (wx) : org = 0x00000000, len = 0 + ram4 (wx) : org = 0x00000000, len = 0 + ram5 (wx) : org = 0x00000000, len = 0 + ram6 (wx) : org = 0x00000000, len = 0 + ram7 (wx) : org = 0x00000000, len = 0 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld +/* + * ST32F103xB memory setup. + */ +MEMORY +{ + flash0 (rx) : org = 0x08000000 + 16k, len = 64k - 16k + flash1 (rx) : org = 0x00000000, len = 0 + flash2 (rx) : org = 0x00000000, len = 0 + flash3 (rx) : org = 0x00000000, len = 0 + flash4 (rx) : org = 0x00000000, len = 0 + flash5 (rx) : org = 0x00000000, len = 0 + flash6 (rx) : org = 0x00000000, len = 0 + flash7 (rx) : org = 0x00000000, len = 0 + ram0 (wx) : org = 0x20000000, len = 20k + ram1 (wx) : org = 0x00000000, len = 0 + ram2 (wx) : org = 0x00000000, len = 0 + ram3 (wx) : org = 0x00000000, len = 0 + ram4 (wx) : org = 0x00000000, len = 0 + ram5 (wx) : org = 0x00000000, len = 0 + ram6 (wx) : org = 0x00000000, len = 0 + ram7 (wx) : org = 0x00000000, len = 0 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld diff --git a/platforms/chibios/chibios_config.h b/platforms/chibios/chibios_config.h index be29e373ac6b..c19e9b1d99ae 100644 --- a/platforms/chibios/chibios_config.h +++ b/platforms/chibios/chibios_config.h @@ -75,6 +75,16 @@ # endif #endif +// AIR32 compatibility +#if defined(MCU_AIR32) +# define CPU_CLOCK AIR32_SYSCLK + +# if defined(AIR32F10x) +# define PAL_MODE_ALTERNATE_OPENDRAIN PAL_MODE_AIR32_ALTERNATE_OPENDRAIN +# define PAL_MODE_ALTERNATE_PUSHPULL PAL_MODE_AIR32_ALTERNATE_PUSHPULL +# endif +#endif + #if defined(GD32VF103) /* This chip has the same API as STM32F103, but uses different names for literally the same thing. * As of 4.7.2021 QMK is tailored to use STM32 defines/names, for compatibility sake diff --git a/platforms/chibios/drivers/analog.c b/platforms/chibios/drivers/analog.c index 0c0e68c20420..872eaeba50a2 100644 --- a/platforms/chibios/drivers/analog.c +++ b/platforms/chibios/drivers/analog.c @@ -37,7 +37,7 @@ // Otherwise assume V3 #if defined(STM32F0XX) || defined(STM32L0XX) # define USE_ADCV1 -#elif defined(STM32F1XX) || defined(STM32F2XX) || defined(STM32F4XX) || defined(GD32VF103) +#elif defined(STM32F1XX) || defined(STM32F2XX) || defined(STM32F4XX) || defined(GD32VF103) || defined(AIR32F10x) # define USE_ADCV2 #endif @@ -74,7 +74,7 @@ /* User configurable ADC options */ #ifndef ADC_COUNT -# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F4XX) || defined(GD32VF103) +# if defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F4XX) || defined(GD32VF103) || defined(AIR32F10x) # define ADC_COUNT 1 # elif defined(STM32F3XX) # define ADC_COUNT 4 diff --git a/platforms/chibios/drivers/ws2812.c b/platforms/chibios/drivers/ws2812.c index f0513d2113ab..b5e00c0d28d8 100644 --- a/platforms/chibios/drivers/ws2812.c +++ b/platforms/chibios/drivers/ws2812.c @@ -6,7 +6,7 @@ /* Adapted from https://github.com/bigjosh/SimpleNeoPixelDemo/ */ #ifndef NOP_FUDGE -# if defined(STM32F0XX) || defined(STM32F1XX) || defined(GD32VF103) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(CM32M101A) || defined(STM32L4XX) +# if defined(STM32F0XX) || defined(STM32F1XX) || defined(GD32VF103) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(CM32M101A) || defined(STM32L4XX) || defined(AIR32F10x) # define NOP_FUDGE 0.4 # else # error("NOP_FUDGE configuration required") diff --git a/platforms/chibios/eeprom_stm32_defs.h b/platforms/chibios/eeprom_stm32_defs.h index c5255cd541d6..a30819947cd5 100644 --- a/platforms/chibios/eeprom_stm32_defs.h +++ b/platforms/chibios/eeprom_stm32_defs.h @@ -18,14 +18,14 @@ #include #if !defined(FEE_PAGE_SIZE) || !defined(FEE_PAGE_COUNT) -# if defined(STM32F103xB) || defined(STM32F042x6) || defined(GD32VF103C8) || defined(GD32VF103CB) +# if defined(STM32F103xB) || defined(STM32F042x6) || defined(GD32VF103C8) || defined(GD32VF103CB) || defined(AIR32F103xB) # ifndef FEE_PAGE_SIZE # define FEE_PAGE_SIZE 0x400 // Page size = 1KByte # endif # ifndef FEE_PAGE_COUNT # define FEE_PAGE_COUNT 2 // How many pages are used # endif -# elif defined(STM32F103xE) || defined(STM32F303xC) || defined(STM32F303xE) || defined(STM32F072xB) || defined(STM32F070xB) || defined(CM32M101A) || defined(STM32L433xC) +# elif defined(STM32F103xE) || defined(STM32F303xC) || defined(STM32F303xE) || defined(STM32F072xB) || defined(STM32F070xB) || defined(CM32M101A) || defined(STM32L433xC) || defined(AIR32F103xC) # ifndef FEE_PAGE_SIZE # define FEE_PAGE_SIZE 0x800 // Page size = 2KByte # endif @@ -47,9 +47,9 @@ # define FEE_MCU_FLASH_SIZE 32 // Size in Kb # elif defined(GD32VF103C8) # define FEE_MCU_FLASH_SIZE 64 // Size in Kb -# elif defined(STM32F103xB) || defined(STM32F072xB) || defined(STM32F070xB) || defined(GD32VF103CB) || defined(CM32M101A) +# elif defined(STM32F103xB) || defined(STM32F072xB) || defined(STM32F070xB) || defined(GD32VF103CB) || defined(CM32M101A) || defined(AIR32F103xB) # define FEE_MCU_FLASH_SIZE 128 // Size in Kb -# elif defined(STM32F303xC) || defined(STM32F401xC) || defined(STM32L433xC) +# elif defined(STM32F303xC) || defined(STM32F401xC) || defined(STM32L433xC) || defined(AIR32F103xC) # define FEE_MCU_FLASH_SIZE 256 // Size in Kb # elif defined(STM32F103xE) || defined(STM32F303xE) || defined(STM32F401xE) || defined(STM32F411xE) # define FEE_MCU_FLASH_SIZE 512 // Size in Kb diff --git a/platforms/chibios/flash_stm32.c b/platforms/chibios/flash_stm32.c index 339824672817..aa5f3060ab21 100644 --- a/platforms/chibios/flash_stm32.c +++ b/platforms/chibios/flash_stm32.c @@ -19,7 +19,7 @@ #include #include "flash_stm32.h" -#if defined(STM32F1XX) +#if defined(STM32F1XX) || defined(AIR32F10x) # define FLASH_SR_WRPERR FLASH_SR_WRPRTERR #endif