1
0
Fork 0

Fixes for bootloader refactor build failures (#15638)

This commit is contained in:
Ryan 2022-01-06 06:55:46 +11:00 committed by GitHub
parent 99e11f4823
commit 5fb93934d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 53 additions and 121 deletions

View file

@ -143,6 +143,9 @@ ifneq ($(findstring STM32F042, $(MCU)),)
# This ensures that the EEPROM page buffer fits into RAM # This ensures that the EEPROM page buffer fits into RAM
USE_PROCESS_STACKSIZE = 0x600 USE_PROCESS_STACKSIZE = 0x600
USE_EXCEPTIONS_STACKSIZE = 0x300 USE_EXCEPTIONS_STACKSIZE = 0x300
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFFC400
endif endif
ifneq ($(findstring STM32F072, $(MCU)),) ifneq ($(findstring STM32F072, $(MCU)),)
@ -175,6 +178,9 @@ ifneq ($(findstring STM32F072, $(MCU)),)
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32F0 UF2_FAMILY ?= STM32F0
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFFC800
endif endif
ifneq ($(findstring STM32F103, $(MCU)),) ifneq ($(findstring STM32F103, $(MCU)),)
@ -239,6 +245,9 @@ ifneq ($(findstring STM32F303, $(MCU)),)
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32F3 UF2_FAMILY ?= STM32F3
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFFD800
endif endif
ifneq ($(findstring STM32F401, $(MCU)),) ifneq ($(findstring STM32F401, $(MCU)),)
@ -276,6 +285,9 @@ ifneq ($(findstring STM32F401, $(MCU)),)
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32F4 UF2_FAMILY ?= STM32F4
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq ($(findstring STM32F405, $(MCU)),) ifneq ($(findstring STM32F405, $(MCU)),)
@ -308,6 +320,9 @@ ifneq ($(findstring STM32F405, $(MCU)),)
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32F4 UF2_FAMILY ?= STM32F4
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq ($(findstring STM32F407, $(MCU)),) ifneq ($(findstring STM32F407, $(MCU)),)
@ -340,6 +355,9 @@ ifneq ($(findstring STM32F407, $(MCU)),)
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32F4 UF2_FAMILY ?= STM32F4
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq ($(findstring STM32F411, $(MCU)),) ifneq ($(findstring STM32F411, $(MCU)),)
@ -377,6 +395,9 @@ ifneq ($(findstring STM32F411, $(MCU)),)
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32F4 UF2_FAMILY ?= STM32F4
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq ($(findstring STM32F446, $(MCU)),) ifneq ($(findstring STM32F446, $(MCU)),)
@ -406,6 +427,9 @@ ifneq ($(findstring STM32F446, $(MCU)),)
BOARD ?= GENERIC_STM32_F446XE BOARD ?= GENERIC_STM32_F446XE
USE_FPU ?= yes USE_FPU ?= yes
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq ($(findstring STM32G431, $(MCU)),) ifneq ($(findstring STM32G431, $(MCU)),)
@ -438,6 +462,9 @@ ifneq ($(findstring STM32G431, $(MCU)),)
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32G4 UF2_FAMILY ?= STM32G4
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq ($(findstring STM32G474, $(MCU)),) ifneq ($(findstring STM32G474, $(MCU)),)
@ -470,6 +497,9 @@ ifneq ($(findstring STM32G474, $(MCU)),)
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32G4 UF2_FAMILY ?= STM32G4
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq (,$(filter $(MCU),STM32L433 STM32L443)) ifneq (,$(filter $(MCU),STM32L433 STM32L443))
@ -504,6 +534,9 @@ ifneq (,$(filter $(MCU),STM32L433 STM32L443))
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32L4 UF2_FAMILY ?= STM32L4
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq (,$(filter $(MCU),STM32L412 STM32L422)) ifneq (,$(filter $(MCU),STM32L412 STM32L422))
@ -538,6 +571,9 @@ ifneq (,$(filter $(MCU),STM32L412 STM32L422))
# UF2 settings # UF2 settings
UF2_FAMILY ?= STM32L4 UF2_FAMILY ?= STM32L4
# Bootloader address for STM32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif endif
ifneq ($(findstring WB32F3G71, $(MCU)),) ifneq ($(findstring WB32F3G71, $(MCU)),)
@ -567,6 +603,10 @@ ifneq ($(findstring WB32F3G71, $(MCU)),)
BOARD ?= GENERIC_WB32_F3G71XX BOARD ?= GENERIC_WB32_F3G71XX
USE_FPU ?= no USE_FPU ?= no
# Bootloader address for WB32 DFU
STM32_BOOTLOADER_ADDRESS ?= 0x1FFFE000
WB32_BOOTLOADER_ADDRESS ?= 0x1FFFE000
endif endif
ifneq ($(findstring GD32VF103, $(MCU)),) ifneq ($(findstring GD32VF103, $(MCU)),)

View file

@ -17,7 +17,6 @@ As such, if you wish to override this API consider limiting use to writing to lo
| `config.h` override | Description | Default | | `config.h` override | Description | Default |
|-----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| |-----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| `#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP` | Whether or not bootloader is to be executed during the early initialisation code of QMK. | `FALSE` | | `#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP` | Whether or not bootloader is to be executed during the early initialisation code of QMK. | `FALSE` |
| `#define STM32_BOOTLOADER_ADDRESS` | Relevant for single-bank STM32 MCUs, signifies the memory address to jump to bootloader. Consult [AN2606](https://www.st.com/content/st_com/en/search.html#q=an2606-t=resources-page=1) for the _System Memory_ address for your MCU. This value should be of the format `0x11111111`. | `<none>` |
| `#define STM32_BOOTLOADER_DUAL_BANK` | Relevant for dual-bank STM32 MCUs, signifies that a GPIO is to be toggled in order to enter bootloader mode. | `FALSE` | | `#define STM32_BOOTLOADER_DUAL_BANK` | Relevant for dual-bank STM32 MCUs, signifies that a GPIO is to be toggled in order to enter bootloader mode. | `FALSE` |
| `#define STM32_BOOTLOADER_DUAL_BANK_GPIO` | Relevant for dual-bank STM32 MCUs, the pin to toggle when attempting to enter bootloader mode, e.g. `B8` | `<none>` | | `#define STM32_BOOTLOADER_DUAL_BANK_GPIO` | Relevant for dual-bank STM32 MCUs, the pin to toggle when attempting to enter bootloader mode, e.g. `B8` | `<none>` |
| `#define STM32_BOOTLOADER_DUAL_BANK_POLARITY` | Relevant for dual-bank STM32 MCUs, the value to set the pin to in order to trigger charging of the RC circuit. e.g. `0` or `1`. | `0` | | `#define STM32_BOOTLOADER_DUAL_BANK_POLARITY` | Relevant for dual-bank STM32 MCUs, the value to set the pin to in order to trigger charging of the RC circuit. e.g. `0` or `1`. | `0` |

View file

@ -1,7 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here (page 175):
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
* This also requires a patch to chibios:
* <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFFC800

View file

@ -1,9 +1,11 @@
# MCU name # MCU name
# Actually F070, but close enough # Actually F070, but close enough
MCU = STM32F072 MCU = STM32F072
BOARD = DURGOD_STM32_F070 BOARD = DURGOD_STM32_F070
# Bootloader selection
BOOTLOADER = stm32-dfu
# Do not put the microcontroller into power saving mode # Do not put the microcontroller into power saving mode
NO_SUSPEND_POWER_DOWN = yes NO_SUSPEND_POWER_DOWN = yes

View file

@ -1,12 +1,8 @@
# MCU name # MCU name
MCU = STM32F103 MCU = STM32F103
MCU_LDSCRIPT = stm32f103_bootloader MCU_LDSCRIPT = stm32f103_bootloader
BOARD = ST_NUCLEO64_F103RB BOARD = ST_NUCLEO64_F103RB
CFLAGS += "-Wno-error=deprecated"
EXTRAFLAGS = -O0 -g
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control EXTRAKEY_ENABLE = yes # Audio control and System control

View file

@ -208,9 +208,6 @@ static void stm32_gpio_init(void) {
* else. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested();
stm32_gpio_init(); stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }

View file

@ -1,7 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
* This also requires a patch to chibios:
* <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000

View file

@ -25,14 +25,6 @@ ARMV = 7
USE_FPU = yes USE_FPU = yes
# Vector table for application
# 0x00000000-0x00001000 area is occupied by bootlaoder.*/
OPT_DEFS =
# Options to pass to dfu-util when flashing
#DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave
#DFU_SUFFIX_ARGS = -p DF11 -v 0483
# Build Options # Build Options
# change yes to no to disable # change yes to no to disable
# #

View file

@ -1,5 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000

View file

@ -1,5 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000

View file

@ -2,7 +2,7 @@
MCU = atmega32a MCU = atmega32a
# Bootloader selection # Bootloader selection
BOOTLOADER = atmel-dfu BOOTLOADER = bootloadhid
# Build Options # Build Options
# change yes to no to disable # change yes to no to disable

View file

@ -1,6 +1,9 @@
# MCU name # MCU name
MCU = STM32F401 MCU = STM32F401
# Bootloader selection
BOOTLOADER = stm32-dfu
# Build Options # Build Options
# change yes to no to disable # change yes to no to disable
# #
@ -14,6 +17,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output AUDIO_ENABLE = no # Audio output
EEPROM_DRIVER = i2c EEPROM_DRIVER = i2c
# Enter lower-power sleep mode when on the ChibiOS idle thread # Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
STM32_BOOTLOADER_ADDRESS = 0x1FFF0000

View file

@ -622,11 +622,6 @@ def arm_processor_rules(info_data, rules):
info_data['protocol'] = 'ChibiOS' info_data['protocol'] = 'ChibiOS'
if 'bootloader' not in info_data: if 'bootloader' not in info_data:
if 'STM32' in info_data['processor']:
info_data['bootloader'] = 'stm32-dfu'
elif 'WB32' in info_data['processor']:
info_data['bootloader'] = 'wb32-dfu'
else:
info_data['bootloader'] = 'unknown' info_data['bootloader'] = 'unknown'
if 'STM32' in info_data['processor']: if 'STM32' in info_data['processor']:

View file

@ -1,5 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000

View file

@ -1,5 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000

View file

@ -1,5 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFFC400

View file

@ -1,5 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here (page 175):
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFFC800

View file

@ -1,5 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFFD800

View file

@ -17,7 +17,7 @@
/* Address for jumping to bootloader on STM32 chips. */ /* 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. /* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606.
*/ */
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP #ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE # define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif #endif

View file

@ -17,7 +17,7 @@
/* Address for jumping to bootloader on STM32 chips. */ /* 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. /* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606.
*/ */
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP #ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE # define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif #endif

View file

@ -17,7 +17,7 @@
/* Address for jumping to bootloader on STM32 chips. */ /* 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. /* It is chip dependent, the correct number can be looked up by checking against ST's application note AN2606.
*/ */
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP #ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE # define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif #endif

View file

@ -1,23 +0,0 @@
/* Copyright 2018-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 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 here (page 175):
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
* This also requires a patch to chibios:
* <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFF0000

View file

@ -17,7 +17,6 @@
/* Address for jumping to bootloader on STM32 chips. */ /* 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. /* 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 #define PAL_STM32_OSPEED_HIGHEST PAL_STM32_OSPEED_HIGH

View file

@ -17,7 +17,6 @@
/* Address for jumping to bootloader on STM32 chips. */ /* 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. /* 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 #define PAL_STM32_OSPEED_HIGHEST PAL_STM32_OSPEED_HIGH

View file

@ -1,12 +0,0 @@
/* Address for jumping to bootloader on WB32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.westberrytech.com/down/mcu/data/WB32F3G71xx_rm.pdf
*/
#ifndef WB32_BOOTLOADER_ADDRESS
# undef STM32_BOOTLOADER_ADDRESS
# define WB32_BOOTLOADER_ADDRESS 0x1FFFE000
# define STM32_BOOTLOADER_ADDRESS WB32_BOOTLOADER_ADDRESS
#else
# undef STM32_BOOTLOADER_ADDRESS
# define STM32_BOOTLOADER_ADDRESS WB32_BOOTLOADER_ADDRESS
#endif

View file

@ -1,7 +0,0 @@
/* Address for jumping to bootloader on STM32 chips. */
/* It is chip dependent, the correct number can be looked up here:
* http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
* This also requires a patch to chibios:
* <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
*/
#define STM32_BOOTLOADER_ADDRESS 0x1FFFD800

View file

@ -17,6 +17,7 @@
#include "bootloader.h" #include "bootloader.h"
#include <ch.h> #include <ch.h>
#include <hal.h>
#define DBGMCU_KEY_UNLOCK 0x4B5A6978 #define DBGMCU_KEY_UNLOCK 0x4B5A6978
#define DBGMCU_CMD_RESET 0x1 #define DBGMCU_CMD_RESET 0x1