Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add STM32L432 support and STM32L4 series EEPROM emulation #15050

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b08389c
Add a new led driver for Keychron's keyboards.
KeychronMacro Oct 18, 2021
c94ccf6
Update ckled2001.c/ckled2001.h.
KeychronMacro Oct 18, 2021
8c68c25
Update ckled2001.c/ckled2001.h.
KeychronMacro Oct 18, 2021
e5ff8ad
Update ckled2001.c/ckled2001.h.
KeychronMacro Oct 18, 2021
1e7f20d
Update ckled2001.c
KeychronMacro Oct 18, 2021
1aabe7b
Add a new led driver
KeychronMacro Oct 18, 2021
4bd7665
Merge branch 'develop' of https://github.com/lalalademaxiya1/qmk_firm…
KeychronMacro Oct 18, 2021
c6b6a8b
Merge pull request #1 from lalalademaxiya1/develop
keychron-dev Oct 18, 2021
9337189
Update ckled2001.c
KeychronMacro Oct 18, 2021
bdafa94
Update ckled2001.c
KeychronMacro Oct 20, 2021
4459ddf
Update ckled2001.c
KeychronMacro Oct 20, 2021
9a94daf
Update ckled2001.c
KeychronMacro Oct 20, 2021
68f7cd5
Delete ckled2001.c
KeychronMacro Oct 20, 2021
15c4cc0
Create ckled2001.c
KeychronMacro Oct 20, 2021
067e0d5
Update ckled2001.c
KeychronMacro Oct 20, 2021
7a2c8e5
Merge branch 'qmk:develop' into develop
lokher Oct 28, 2021
49f6ee4
Merge branch 'develop' of https://github.com/keychron/qmk_firmware in…
lokher Nov 4, 2021
acfd125
Update chibios-contrib
lokher Nov 4, 2021
1070360
Add STM32L432 support and STM32L4 series EEPROM emulation
lokher Nov 4, 2021
66936f2
Update copyright
lokher Nov 4, 2021
2f8070b
Update eeprom_stm32_l4.c
lokher Nov 5, 2021
60588e6
Update eeprom_stm32_l4.h
lokher Nov 5, 2021
720eb9a
Update tmk_core/common/chibios/eeprom_stm32_l4.c
lokher Nov 17, 2021
7b2b664
Update flash_stm32.h
lokher Feb 7, 2022
18ddd7b
Update flash_stm32.c
lokher Feb 7, 2022
c78ae9a
Delete keyboard.jsonschema
lokher Feb 8, 2022
84d9d6d
Delete compatible_microcontrollers.md
lokher Feb 8, 2022
acd5ac1
Delete constants.py
lokher Feb 8, 2022
9f698cc
Delete board.mk
lokher Feb 8, 2022
40d06cc
Delete board.h
lokher Feb 8, 2022
a235870
Delete config.h
lokher Feb 8, 2022
b64fcd1
Delete mcuconf.h
lokher Feb 8, 2022
5d3e394
Delete mcu_selection.mk
lokher Feb 8, 2022
defd46e
Merge branch 'temp' into stm32l432
lokher Feb 8, 2022
3151432
update flash_stm32.h
lokher Feb 8, 2022
5ab36e7
Update flash_stm32.c
lokher Feb 8, 2022
08b488c
Update flash_stm32.c
lokher Feb 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions builddefs/mcu_selection.mk
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,40 @@ ifneq ($(findstring STM32G474, $(MCU)),)
UF2_FAMILY ?= STM32G4
endif

ifneq (,$(filter $(MCU),STM32L432))
# Cortex version
MCU = cortex-m4

# 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
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
MCU_FAMILY = STM32
MCU_SERIES = STM32L4xx

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

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

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

PLATFORM_NAME ?= platform_l432

USE_FPU ?= yes

# UF2 settings
UF2_FAMILY ?= STM32L4
endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This already exists in develop.

ifneq (,$(filter $(MCU),STM32L433 STM32L443))
# Cortex version
MCU = cortex-m4
Expand Down
6 changes: 6 additions & 0 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ else
COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/eeprom
SRC += eeprom_driver.c
SRC += eeprom_stm32_L0_L1.c
else ifneq ($(filter $(MCU_SERIES),STM32L4xx),)
OPT_DEFS += -DEEPROM_DRIVER
COMMON_VPATH += $(DRIVER_PATH)/eeprom
SRC += eeprom_driver.c
SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32_l4.c
SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
else
# This will effectively work the same as "transient" if not supported by the chip
SRC += $(PLATFORM_COMMON_DIR)/eeprom_teensy.c
Expand Down
2 changes: 1 addition & 1 deletion 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", "STM32L433", "STM32L443", "GD32VF103", "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", "STM32L443", "GD32VF103", "atmega16u2", "atmega32u2", "atmega16u4", "atmega32u4", "at90usb162", "at90usb646", "at90usb647", "at90usb1286", "at90usb1287", "atmega32a", "atmega328p", "atmega328", "attiny85", "unknown"]
lokher marked this conversation as resolved.
Show resolved Hide resolved
},
"audio": {
"type": "object",
Expand Down
3 changes: 2 additions & 1 deletion docs/compatible_microcontrollers.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ You can also use any ARM chip with USB that [ChibiOS](https://www.chibios.org) s
* [STM32G474](https://www.st.com/en/microcontrollers-microprocessors/stm32g4x4.html)
* [STM32L412](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x2.html)
* [STM32L422](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x2.html)
* [STM32L432](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x2.html)
lokher marked this conversation as resolved.
Show resolved Hide resolved
* [STM32L433](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x3.html)
* [STM32L443](https://www.st.com/en/microcontrollers-microprocessors/stm32l4x3.html)

Expand All @@ -53,4 +54,4 @@ There is limited support for one of Atmel's ATSAM microcontrollers, that being t

### GigaDevice

[ChibiOS-Contrib](https://github.com/ChibiOS/ChibiOS-Contrib) has support for the GigaDevice [GD32VF103 series](https://www.gigadevice.com/products/microcontrollers/gd32/risc-v/mainstream-line/gd32vf103-series/) microcontrollers and provides configurations for the [SiPeed Longan Nano](https://longan.sipeed.com/en/) development board that uses this microcontroller. It is largely pin and feature compatible with STM32F103 and STM32F303 microcontrollers.
[ChibiOS-Contrib](https://github.com/ChibiOS/ChibiOS-Contrib) has support for the GigaDevice [GD32VF103 series](https://www.gigadevice.com/products/microcontrollers/gd32/risc-v/mainstream-line/gd32vf103-series/) microcontrollers and provides configurations for the [SiPeed Longan Nano](https://longan.sipeed.com/en/) development board that uses this microcontroller. It is largely pin and feature compatible with STM32F103 and STM32F303 microcontrollers.
2 changes: 1 addition & 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', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L433', 'STM32L443', 'GD32VF103'
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK66FX1M0', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L443', 'GD32VF103'
lokher marked this conversation as resolved.
Show resolved Hide resolved
LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'

Expand Down
9 changes: 9 additions & 0 deletions platforms/chibios/boards/GENERIC_STM32_L432KC/board/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# List of all the board related files.
lokher marked this conversation as resolved.
Show resolved Hide resolved
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO32_L432KC/board.c

# Required include directories
BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO32_L432KC

# Shared variables
ALLCSRC += $(BOARDSRC)
ALLINC += $(BOARDINC)
18 changes: 18 additions & 0 deletions platforms/chibios/boards/GENERIC_STM32_L432KC/configs/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Copyright 2021 @ lokher (https://www.keychron.com)
lokher marked this conversation as resolved.
Show resolved Hide resolved
*
* 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 <https://www.gnu.org/licenses/>.
*/
#pragma once

#include_next "board.h"
27 changes: 27 additions & 0 deletions platforms/chibios/boards/GENERIC_STM32_L432KC/configs/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Copyright 2021 @ lokher (https://www.keychron.com)
lokher marked this conversation as resolved.
Show resolved Hide resolved
*
*
* 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/>.
*/

/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606.
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000

#define PAL_STM32_OSPEED_HIGHEST PAL_STM32_OSPEED_HIGH

#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif
Loading