Add minimal STM32F103C6 support (#17853)
Unfortunately, the crippled versions of “Bluepill” boards with STM32F103C6xx chips instead of STM32F103C8xx are now sold all over the place, sometimes advertised in a confusing way to make the difference not noticeable until too late. Add minimal support for these MCUs in the common “Bluepill with stm32duino” configuration, so that it could be possible to make something useful from those boards (although fitting QMK into the available 24 KiB of flash may be rather hard). (In fact, I'm not sure whether the “STM32” part of the chip name is actually correct for those boards of uncertain origin, so the onekey board name is `bluepill_f103c6`; another reason for that name is to match the existing `blackpill_f401` and `blackpill_f411`.) The EEPROM emulation support is not included on purpose, because enabling it without having a working firmware size check would be irresponsible with such flash size (the chance that someone would build a firmware where the EEPROM backing store ends up overlapping some firmware code is really high). Other than that, enabling the EEPROM emulation code is mostly trivial (the `wear_leveling` driver with the `embedded_flash` backing store even works without any custom configuration, although its code is significantly larger than the `vendor` driver, which may also be important for such flash size).master^2
parent
8c4269f98e
commit
9e44362179
|
@ -0,0 +1,6 @@
|
|||
// Copyright 2022 Sergey Vlasov (@sigprof)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#include_next <board.h>
|
||||
|
||||
#undef STM32F103xB
|
||||
#define STM32F103x6
|
|
@ -0,0 +1,40 @@
|
|||
/* Copyright 2019
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#define PRODUCT Onekey Bluepill STM32F103C6
|
||||
|
||||
#define MATRIX_COL_PINS { B0 }
|
||||
#define MATRIX_ROW_PINS { A7 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define BACKLIGHT_PIN A0
|
||||
#define BACKLIGHT_PWM_DRIVER PWMD2
|
||||
#define BACKLIGHT_PWM_CHANNEL 1
|
||||
|
||||
#define RGB_DI_PIN A1
|
||||
|
||||
#define ADC_PIN A0
|
||||
|
||||
// This code does not fit into the really small flash of STM32F103x6 together
|
||||
// with CONSOLE_ENABLE=yes, and the debugging console is probably more
|
||||
// important for the "okeney" testing firmware. In a real firmware you may be
|
||||
// able to use these features if you keep the debugging console disabled.
|
||||
#define NO_ACTION_LAYER
|
||||
#define NO_ACTION_TAPPING
|
|
@ -0,0 +1,26 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was auto-generated by:
|
||||
* `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/halconf.h -r platforms/chibios/common/configs/halconf.h`
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_PWM TRUE
|
||||
|
||||
#include_next <halconf.h>
|
|
@ -0,0 +1,30 @@
|
|||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was auto-generated by:
|
||||
* `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/mcuconf.h -r platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h`
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_PWM_USE_TIM2
|
||||
#define STM32_PWM_USE_TIM2 TRUE
|
||||
|
||||
#undef STM32_SPI_USE_SPI2
|
||||
#define STM32_SPI_USE_SPI2 FALSE
|
|
@ -0,0 +1,7 @@
|
|||
# STM32F103C6xx Bluepill onekey
|
||||
|
||||
* Supported hardware: Bluepill boards with the STM32F103C**6**xx chips
|
||||
|
||||
Note that STM32F103C6xx chips have only 32 KiB of flash and 10 KiB of RAM, and the stm32duino bootloader occupies 8 KiB of flash, leaving only 24 KiB for the firmware, therefore the capabilities of this board are severely restricted in comparison to proper Bluepill boards with STM32F103CBxx or STM32F103C8xx chips (128 or 64 KiB of flash and 20 KiB of RAM). You may need to disable many features in the QMK firmware to bring its compiled size below 24 KiB. Please avoid designing new keyboards with these MCUs unless you are stuck with some hardware that you already have and don't want to just throw away.
|
||||
|
||||
To trigger keypress, short together pins *B0* and *A7*.
|
|
@ -0,0 +1,27 @@
|
|||
# MCU name
|
||||
MCU = STM32F103
|
||||
|
||||
# Bootloader selection
|
||||
# Cannot use `BOOTLOADER = stm32duino` due to the need to override
|
||||
# `MCU_LDSCRIPT`, therefore all parameters need to be specified here manually.
|
||||
OPT_DEFS += -DBOOTLOADER_STM32DUINO
|
||||
MCU_LDSCRIPT = STM32F103x6_stm32duino_bootloader
|
||||
BOARD = STM32_F103_STM32DUINO
|
||||
BOOTLOADER_TYPE = stm32duino
|
||||
DFU_ARGS = -d 1EAF:0003 -a 2 -R
|
||||
DFU_SUFFIX_ARGS = -v 1EAF -p 0003
|
||||
|
||||
# Enter lower-power sleep mode when on the ChibiOS idle thread
|
||||
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
|
||||
|
||||
# LTO is required to fit the firmware into the available 24K of flash
|
||||
LTO_ENABLE = yes
|
||||
|
||||
# Disable some features which still don't fit into flash even with LTO
|
||||
MOUSEKEY_ENABLE = no
|
||||
NKRO_ENABLE = no
|
||||
|
||||
# EEPROM emulation not supported yet (need to implement a proper firmware size
|
||||
# check first, otherwise the chance of the EEPROM backing store overwriting
|
||||
# some part of the firmware code is really high).
|
||||
EEPROM_DRIVER = transient
|
|
@ -28,7 +28,9 @@ const PALConfig pal_default_config =
|
|||
{VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH},
|
||||
{VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH},
|
||||
{VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH},
|
||||
# if STM32_HAS_GPIOE
|
||||
{VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH},
|
||||
# endif
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2016 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* STM32F103x6 memory setup for use with the STM32Duino bootloader.
|
||||
*/
|
||||
f103_flash_size = 32k;
|
||||
f103_ram_size = 10k;
|
||||
|
||||
INCLUDE stm32duino_bootloader_common.ld
|
|
@ -18,5 +18,6 @@
|
|||
* STM32F103x8 memory setup for use with the STM32Duino bootloader.
|
||||
*/
|
||||
f103_flash_size = 64k;
|
||||
f103_ram_size = 20k;
|
||||
|
||||
INCLUDE stm32duino_bootloader_common.ld
|
||||
|
|
|
@ -18,5 +18,6 @@
|
|||
* STM32F103xB memory setup for use with the STM32Duino bootloader.
|
||||
*/
|
||||
f103_flash_size = 128k;
|
||||
f103_ram_size = 20k;
|
||||
|
||||
INCLUDE stm32duino_bootloader_common.ld
|
||||
|
|
|
@ -27,7 +27,7 @@ MEMORY
|
|||
flash5 : org = 0x00000000, len = 0
|
||||
flash6 : org = 0x00000000, len = 0
|
||||
flash7 : org = 0x00000000, len = 0
|
||||
ram0 : org = 0x20000000, len = 20k
|
||||
ram0 : org = 0x20000000, len = f103_ram_size
|
||||
ram1 : org = 0x00000000, len = 0
|
||||
ram2 : org = 0x00000000, len = 0
|
||||
ram3 : org = 0x00000000, len = 0
|
||||
|
|
Loading…
Reference in New Issue