浏览代码

Fixes for bootloader refactor build failures (#15638)

Ryan 3 年之前
父节点
当前提交
5fb93934d0
共有 27 个文件被更改,包括 53 次插入121 次删除
  1. 40 0
      builddefs/mcu_selection.mk
  2. 0 1
      docs/platformdev_chibios_earlyinit.md
  3. 0 7
      keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h
  4. 3 1
      keyboards/durgod/dgk6x/rules.mk
  5. 0 4
      keyboards/ergodox_stm32/rules.mk
  6. 0 3
      keyboards/matrix/abelx/boards/abelx_bd/board.c
  7. 0 7
      keyboards/matrix/abelx/bootloader_defs.h
  8. 0 8
      keyboards/matrix/abelx/rules.mk
  9. 0 5
      keyboards/matrix/m20add/bootloader_defs.h
  10. 0 5
      keyboards/matrix/noah/bootloader_defs.h
  11. 1 1
      keyboards/mechmini/v1/rules.mk
  12. 4 1
      keyboards/mode/m65s/rules.mk
  13. 1 6
      lib/python/qmk/info.py
  14. 0 5
      platforms/chibios/boards/BLACKPILL_STM32_F401/configs/bootloader_defs.h
  15. 0 5
      platforms/chibios/boards/BLACKPILL_STM32_F411/configs/bootloader_defs.h
  16. 0 5
      platforms/chibios/boards/GENERIC_STM32_F042X6/configs/bootloader_defs.h
  17. 0 5
      platforms/chibios/boards/GENERIC_STM32_F072XB/configs/bootloader_defs.h
  18. 0 5
      platforms/chibios/boards/GENERIC_STM32_F303XC/configs/bootloader_defs.h
  19. 1 1
      platforms/chibios/boards/GENERIC_STM32_F405XG/configs/config.h
  20. 1 1
      platforms/chibios/boards/GENERIC_STM32_F407XE/configs/config.h
  21. 1 1
      platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h
  22. 0 23
      platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h
  23. 0 1
      platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h
  24. 0 1
      platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h
  25. 0 12
      platforms/chibios/boards/GENERIC_WB32_F3G71XX/configs/bootloader_defs.h
  26. 0 7
      platforms/chibios/boards/QMK_PROTON_C/configs/bootloader_defs.h
  27. 1 0
      platforms/chibios/bootloaders/gd32v_dfu.c

+ 40 - 0
builddefs/mcu_selection.mk

@@ -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)),)

+ 0 - 1
docs/platformdev_chibios_earlyinit.md

@@ -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`      |

+ 0 - 7
keyboards/durgod/boards/DURGOD_STM32_F070/bootloader_defs.h

@@ -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

+ 3 - 1
keyboards/durgod/dgk6x/rules.mk

@@ -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
 

+ 0 - 4
keyboards/ergodox_stm32/rules.mk

@@ -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

+ 0 - 3
keyboards/matrix/abelx/boards/abelx_bd/board.c

@@ -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();
 }

+ 0 - 7
keyboards/matrix/abelx/bootloader_defs.h

@@ -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

+ 0 - 8
keyboards/matrix/abelx/rules.mk

@@ -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
 #

+ 0 - 5
keyboards/matrix/m20add/bootloader_defs.h

@@ -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

+ 0 - 5
keyboards/matrix/noah/bootloader_defs.h

@@ -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

+ 1 - 1
keyboards/mechmini/v1/rules.mk

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

+ 4 - 1
keyboards/mode/m65s/rules.mk

@@ -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

+ 1 - 6
lib/python/qmk/info.py

@@ -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'

+ 0 - 5
platforms/chibios/boards/BLACKPILL_STM32_F401/configs/bootloader_defs.h

@@ -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

+ 0 - 5
platforms/chibios/boards/BLACKPILL_STM32_F411/configs/bootloader_defs.h

@@ -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

+ 0 - 5
platforms/chibios/boards/GENERIC_STM32_F042X6/configs/bootloader_defs.h

@@ -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

+ 0 - 5
platforms/chibios/boards/GENERIC_STM32_F072XB/configs/bootloader_defs.h

@@ -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

+ 0 - 5
platforms/chibios/boards/GENERIC_STM32_F303XC/configs/bootloader_defs.h

@@ -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

+ 1 - 1
platforms/chibios/boards/GENERIC_STM32_F405XG/configs/config.h

@@ -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

+ 1 - 1
platforms/chibios/boards/GENERIC_STM32_F407XE/configs/config.h

@@ -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

+ 1 - 1
platforms/chibios/boards/GENERIC_STM32_F446XE/configs/config.h

@@ -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

+ 0 - 23
platforms/chibios/boards/GENERIC_STM32_G431XB/configs/config.h

@@ -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

+ 0 - 1
platforms/chibios/boards/GENERIC_STM32_L412XB/configs/config.h

@@ -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
 

+ 0 - 1
platforms/chibios/boards/GENERIC_STM32_L433XC/configs/config.h

@@ -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
 

+ 0 - 12
platforms/chibios/boards/GENERIC_WB32_F3G71XX/configs/bootloader_defs.h

@@ -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

+ 0 - 7
platforms/chibios/boards/QMK_PROTON_C/configs/bootloader_defs.h

@@ -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

+ 1 - 0
platforms/chibios/bootloaders/gd32v_dfu.c

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