~ruther/qmk_firmware

5fb93934d0f3319547cc6313845fe5a96f8b7798 — Ryan 3 years ago 99e11f4
Fixes for bootloader refactor build failures (#15638)

27 files changed, 53 insertions(+), 121 deletions(-)

M builddefs/mcu_selection.mk
M docs/platformdev_chibios_earlyinit.md
D keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h
M keyboards/durgod/dgk6x/rules.mk
M keyboards/ergodox_stm32/rules.mk
M keyboards/matrix/abelx/boards/abelx_bd/board.c
D keyboards/matrix/abelx/bootloader_defs.h
M keyboards/matrix/abelx/rules.mk
D keyboards/matrix/m20add/bootloader_defs.h
D keyboards/matrix/noah/bootloader_defs.h
M keyboards/mechmini/v1/rules.mk
M keyboards/mode/m65s/rules.mk
M lib/python/qmk/info.py
D platforms/chibios/boards/BLACKPILL_STM32_F401/configs/bootloader_defs.h
D platforms/chibios/boards/BLACKPILL_STM32_F411/configs/bootloader_defs.h
D platforms/chibios/boards/GENERIC_STM32_F042X6/configs/bootloader_defs.h
D platforms/chibios/boards/GENERIC_STM32_F072XB/configs/bootloader_defs.h
D platforms/chibios/boards/GENERIC_STM32_F303XC/configs/bootloader_defs.h
M platforms/chibios/boards/GENERIC_STM32_F405XG/configs/config.h
M platforms/chibios/boards/GENERIC_STM32_F407XE/configs/config.h
M platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h
D platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h
M platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h
M platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h
D platforms/chibios/boards/GENERIC_WB32_F3G71XX/configs/bootloader_defs.h
D platforms/chibios/boards/QMK_PROTON_C/configs/bootloader_defs.h
M platforms/chibios/bootloaders/gd32v_dfu.c
M builddefs/mcu_selection.mk => builddefs/mcu_selection.mk +40 -0
@@ 143,6 143,9 @@ ifneq ($(findstring STM32F042, $(MCU)),)
  # This ensures that the EEPROM page buffer fits into RAM
  USE_PROCESS_STACKSIZE = 0x600
  USE_EXCEPTIONS_STACKSIZE = 0x300

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFFC400
endif

ifneq ($(findstring STM32F072, $(MCU)),)


@@ 175,6 178,9 @@ ifneq ($(findstring STM32F072, $(MCU)),)

  # UF2 settings
  UF2_FAMILY ?= STM32F0

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFFC800
endif

ifneq ($(findstring STM32F103, $(MCU)),)


@@ 239,6 245,9 @@ ifneq ($(findstring STM32F303, $(MCU)),)

  # UF2 settings
  UF2_FAMILY ?= STM32F3

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFFD800
endif

ifneq ($(findstring STM32F401, $(MCU)),)


@@ 276,6 285,9 @@ ifneq ($(findstring STM32F401, $(MCU)),)

  # UF2 settings
  UF2_FAMILY ?= STM32F4

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq ($(findstring STM32F405, $(MCU)),)


@@ 308,6 320,9 @@ ifneq ($(findstring STM32F405, $(MCU)),)

  # UF2 settings
  UF2_FAMILY ?= STM32F4

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq ($(findstring STM32F407, $(MCU)),)


@@ 340,6 355,9 @@ ifneq ($(findstring STM32F407, $(MCU)),)

  # UF2 settings
  UF2_FAMILY ?= STM32F4

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq ($(findstring STM32F411, $(MCU)),)


@@ 377,6 395,9 @@ ifneq ($(findstring STM32F411, $(MCU)),)

  # UF2 settings
  UF2_FAMILY ?= STM32F4

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq ($(findstring STM32F446, $(MCU)),)


@@ 406,6 427,9 @@ ifneq ($(findstring STM32F446, $(MCU)),)
  BOARD ?= GENERIC_STM32_F446XE

  USE_FPU ?= yes

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq ($(findstring STM32G431, $(MCU)),)


@@ 438,6 462,9 @@ ifneq ($(findstring STM32G431, $(MCU)),)

  # UF2 settings
  UF2_FAMILY ?= STM32G4

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq ($(findstring STM32G474, $(MCU)),)


@@ 470,6 497,9 @@ ifneq ($(findstring STM32G474, $(MCU)),)

  # UF2 settings
  UF2_FAMILY ?= STM32G4

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq (,$(filter $(MCU),STM32L433 STM32L443))


@@ 504,6 534,9 @@ ifneq (,$(filter $(MCU),STM32L433 STM32L443))

  # UF2 settings
  UF2_FAMILY ?= STM32L4

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq (,$(filter $(MCU),STM32L412 STM32L422))


@@ 538,6 571,9 @@ ifneq (,$(filter $(MCU),STM32L412 STM32L422))

  # UF2 settings
  UF2_FAMILY ?= STM32L4

  # Bootloader address for STM32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
endif

ifneq ($(findstring WB32F3G71, $(MCU)),)


@@ 567,6 603,10 @@ ifneq ($(findstring WB32F3G71, $(MCU)),)
  BOARD ?= GENERIC_WB32_F3G71XX

  USE_FPU ?= no

  # Bootloader address for WB32 DFU
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFFE000
  WB32_BOOTLOADER_ADDRESS ?= 0x1FFFE000
endif

ifneq ($(findstring GD32VF103, $(MCU)),)

M docs/platformdev_chibios_earlyinit.md => docs/platformdev_chibios_earlyinit.md +0 -1
@@ 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  |
|-----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| `#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_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`      |

D keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h => keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h +0 -7
@@ 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

M keyboards/durgod/dgk6x/rules.mk => keyboards/durgod/dgk6x/rules.mk +3 -1
@@ 1,9 1,11 @@
# MCU name
# Actually F070, but close enough
MCU = STM32F072

BOARD = DURGOD_STM32_F070

# Bootloader selection
BOOTLOADER = stm32-dfu

# Do not put the microcontroller into power saving mode
NO_SUSPEND_POWER_DOWN = yes


M keyboards/ergodox_stm32/rules.mk => keyboards/ergodox_stm32/rules.mk +0 -4
@@ 1,12 1,8 @@
# MCU name
MCU = STM32F103

MCU_LDSCRIPT = stm32f103_bootloader
BOARD = ST_NUCLEO64_F103RB

CFLAGS += "-Wno-error=deprecated"
EXTRAFLAGS = -O0 -g

BOOTMAGIC_ENABLE = no       # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no	# Mouse keys
EXTRAKEY_ENABLE = yes	# Audio control and System control

M keyboards/matrix/abelx/boards/abelx_bd/board.c => keyboards/matrix/abelx/boards/abelx_bd/board.c +0 -3
@@ 208,9 208,6 @@ static void stm32_gpio_init(void) {
 *          else.
 */
void __early_init(void) {
  extern void enter_bootloader_mode_if_requested(void);
  enter_bootloader_mode_if_requested();

  stm32_gpio_init();
  stm32_clock_init();
}

D keyboards/matrix/abelx/bootloader_defs.h => keyboards/matrix/abelx/bootloader_defs.h +0 -7
@@ 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

M keyboards/matrix/abelx/rules.mk => keyboards/matrix/abelx/rules.mk +0 -8
@@ 25,14 25,6 @@ ARMV = 7

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
#   change yes to no to disable
#

D keyboards/matrix/m20add/bootloader_defs.h => keyboards/matrix/m20add/bootloader_defs.h +0 -5
@@ 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

D keyboards/matrix/noah/bootloader_defs.h => keyboards/matrix/noah/bootloader_defs.h +0 -5
@@ 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

M keyboards/mechmini/v1/rules.mk => keyboards/mechmini/v1/rules.mk +1 -1
@@ 2,7 2,7 @@
MCU = atmega32a

# Bootloader selection
BOOTLOADER = atmel-dfu
BOOTLOADER = bootloadhid

# Build Options
#   change yes to no to disable

M keyboards/mode/m65s/rules.mk => keyboards/mode/m65s/rules.mk +4 -1
@@ 1,6 1,9 @@
# MCU name
MCU = STM32F401

# Bootloader selection
BOOTLOADER = stm32-dfu

# Build Options
#   change yes to no to disable
#


@@ 14,6 17,6 @@ BACKLIGHT_ENABLE = no      # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
AUDIO_ENABLE = no           # Audio output
EEPROM_DRIVER = i2c

# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
STM32_BOOTLOADER_ADDRESS = 0x1FFF0000

M lib/python/qmk/info.py => lib/python/qmk/info.py +1 -6
@@ 622,12 622,7 @@ def arm_processor_rules(info_data, rules):
    info_data['protocol'] = 'ChibiOS'

    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']:
        info_data['platform'] = 'STM32'

D platforms/chibios/boards/BLACKPILL_STM32_F401/configs/bootloader_defs.h => platforms/chibios/boards/BLACKPILL_STM32_F401/configs/bootloader_defs.h +0 -5
@@ 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

D platforms/chibios/boards/BLACKPILL_STM32_F411/configs/bootloader_defs.h => platforms/chibios/boards/BLACKPILL_STM32_F411/configs/bootloader_defs.h +0 -5
@@ 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

D platforms/chibios/boards/GENERIC_STM32_F042X6/configs/bootloader_defs.h => platforms/chibios/boards/GENERIC_STM32_F042X6/configs/bootloader_defs.h +0 -5
@@ 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

D platforms/chibios/boards/GENERIC_STM32_F072XB/configs/bootloader_defs.h => platforms/chibios/boards/GENERIC_STM32_F072XB/configs/bootloader_defs.h +0 -5
@@ 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

D platforms/chibios/boards/GENERIC_STM32_F303XC/configs/bootloader_defs.h => platforms/chibios/boards/GENERIC_STM32_F303XC/configs/bootloader_defs.h +0 -5
@@ 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

M platforms/chibios/boards/GENERIC_STM32_F405XG/configs/config.h => platforms/chibios/boards/GENERIC_STM32_F405XG/configs/config.h +1 -1
@@ 17,7 17,7 @@
/* 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

#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
#    define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif

M platforms/chibios/boards/GENERIC_STM32_F407XE/configs/config.h => platforms/chibios/boards/GENERIC_STM32_F407XE/configs/config.h +1 -1
@@ 17,7 17,7 @@
/* 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

#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
#    define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif

M platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h => platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h +1 -1
@@ 17,7 17,7 @@
/* 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

#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
#    define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif

D platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h => platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h +0 -23
@@ 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

M platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h => platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h +0 -1
@@ 17,7 17,6 @@
/* 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


M platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h => platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h +0 -1
@@ 17,7 17,6 @@
/* 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


D platforms/chibios/boards/GENERIC_WB32_F3G71XX/configs/bootloader_defs.h => platforms/chibios/boards/GENERIC_WB32_F3G71XX/configs/bootloader_defs.h +0 -12
@@ 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

D platforms/chibios/boards/QMK_PROTON_C/configs/bootloader_defs.h => platforms/chibios/boards/QMK_PROTON_C/configs/bootloader_defs.h +0 -7
@@ 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

M platforms/chibios/bootloaders/gd32v_dfu.c => platforms/chibios/bootloaders/gd32v_dfu.c +1 -0
@@ 17,6 17,7 @@
#include "bootloader.h"

#include <ch.h>
#include <hal.h>

#define DBGMCU_KEY_UNLOCK 0x4B5A6978
#define DBGMCU_CMD_RESET 0x1