Skip to content

Commit

Permalink
Fixes for bootloader refactor build failures (#15638)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark committed Jan 5, 2022
1 parent 99e11f4 commit 5fb9393
Show file tree
Hide file tree
Showing 27 changed files with 53 additions and 121 deletions.
40 changes: 40 additions & 0 deletions builddefs/mcu_selection.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)),)
Expand Down Expand Up @@ -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)),)
Expand Down
1 change: 0 additions & 1 deletion docs/platformdev_chibios_earlyinit.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
7 changes: 0 additions & 7 deletions keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h

This file was deleted.

4 changes: 3 additions & 1 deletion keyboards/durgod/dgk6x/rules.mk
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 0 additions & 4 deletions keyboards/ergodox_stm32/rules.mk
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 0 additions & 3 deletions keyboards/matrix/abelx/boards/abelx_bd/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
7 changes: 0 additions & 7 deletions keyboards/matrix/abelx/bootloader_defs.h

This file was deleted.

8 changes: 0 additions & 8 deletions keyboards/matrix/abelx/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
5 changes: 0 additions & 5 deletions keyboards/matrix/m20add/bootloader_defs.h

This file was deleted.

5 changes: 0 additions & 5 deletions keyboards/matrix/noah/bootloader_defs.h

This file was deleted.

2 changes: 1 addition & 1 deletion keyboards/mechmini/v1/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
MCU = atmega32a

# Bootloader selection
BOOTLOADER = atmel-dfu
BOOTLOADER = bootloadhid

# Build Options
# change yes to no to disable
Expand Down
5 changes: 4 additions & 1 deletion keyboards/mode/m65s/rules.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# MCU name
MCU = STM32F401

# Bootloader selection
BOOTLOADER = stm32-dfu

# Build Options
# change yes to no to disable
#
Expand All @@ -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
7 changes: 1 addition & 6 deletions lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 0 additions & 23 deletions platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions platforms/chibios/bootloaders/gd32v_dfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "bootloader.h"

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

#define DBGMCU_KEY_UNLOCK 0x4B5A6978
#define DBGMCU_CMD_RESET 0x1
Expand Down

0 comments on commit 5fb9393

Please sign in to comment.