From 591371f947b0a9dfdd2c1d21e4b27eed9a244b22 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Wed, 11 Sep 2024 14:33:06 +0300 Subject: [PATCH 1/2] sn32: remove qmk specific bootloader checks These should NOT be in chibios level --- os/hal/boards/SN_SN32F240/board.c | 2 -- os/hal/boards/SN_SN32F240B/board.c | 2 -- os/hal/boards/SN_SN32F280/board.c | 2 -- os/hal/boards/SN_SN32F290/board.c | 2 -- 4 files changed, 8 deletions(-) diff --git a/os/hal/boards/SN_SN32F240/board.c b/os/hal/boards/SN_SN32F240/board.c index 655a9b04b4..dfc276c2f2 100644 --- a/os/hal/boards/SN_SN32F240/board.c +++ b/os/hal/boards/SN_SN32F240/board.c @@ -44,7 +44,6 @@ const PALConfig pal_default_config = { #endif static int flag __attribute__((section(".flag"))) __attribute__((__used__)) = 0xAAAA5555; -extern void enter_bootloader_mode_if_requested(void); /** * @brief Early initialization code. @@ -52,7 +51,6 @@ extern void enter_bootloader_mode_if_requested(void); * and before any other initialization. */ void __early_init(void) { - enter_bootloader_mode_if_requested(); sn32_clock_init(); } diff --git a/os/hal/boards/SN_SN32F240B/board.c b/os/hal/boards/SN_SN32F240B/board.c index ccaf913c45..596ee347ce 100644 --- a/os/hal/boards/SN_SN32F240B/board.c +++ b/os/hal/boards/SN_SN32F240B/board.c @@ -44,7 +44,6 @@ const PALConfig pal_default_config = { #endif static int flag __attribute__((section(".flag"))) __attribute__((__used__)) = 0xAAAA5555; -extern void enter_bootloader_mode_if_requested(void); /** * @brief Early initialization code. @@ -52,7 +51,6 @@ extern void enter_bootloader_mode_if_requested(void); * and before any other initialization. */ void __early_init(void) { - enter_bootloader_mode_if_requested(); sn32_clock_init(); } diff --git a/os/hal/boards/SN_SN32F280/board.c b/os/hal/boards/SN_SN32F280/board.c index ccaf913c45..596ee347ce 100644 --- a/os/hal/boards/SN_SN32F280/board.c +++ b/os/hal/boards/SN_SN32F280/board.c @@ -44,7 +44,6 @@ const PALConfig pal_default_config = { #endif static int flag __attribute__((section(".flag"))) __attribute__((__used__)) = 0xAAAA5555; -extern void enter_bootloader_mode_if_requested(void); /** * @brief Early initialization code. @@ -52,7 +51,6 @@ extern void enter_bootloader_mode_if_requested(void); * and before any other initialization. */ void __early_init(void) { - enter_bootloader_mode_if_requested(); sn32_clock_init(); } diff --git a/os/hal/boards/SN_SN32F290/board.c b/os/hal/boards/SN_SN32F290/board.c index ccaf913c45..596ee347ce 100644 --- a/os/hal/boards/SN_SN32F290/board.c +++ b/os/hal/boards/SN_SN32F290/board.c @@ -44,7 +44,6 @@ const PALConfig pal_default_config = { #endif static int flag __attribute__((section(".flag"))) __attribute__((__used__)) = 0xAAAA5555; -extern void enter_bootloader_mode_if_requested(void); /** * @brief Early initialization code. @@ -52,7 +51,6 @@ extern void enter_bootloader_mode_if_requested(void); * and before any other initialization. */ void __early_init(void) { - enter_bootloader_mode_if_requested(); sn32_clock_init(); } From 0f6612e67508ae097f0deda4c28674ce9530afc2 Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Wed, 11 Sep 2024 14:34:37 +0300 Subject: [PATCH 2/2] sn32: boot with SWD enabled by default --- os/hal/boards/SN_SN32F240/board.c | 2 -- os/hal/boards/SN_SN32F240B/board.c | 2 -- os/hal/boards/SN_SN32F260/board.c | 2 +- os/hal/boards/SN_SN32F280/board.c | 2 -- os/hal/boards/SN_SN32F290/board.c | 2 -- 5 files changed, 1 insertion(+), 9 deletions(-) diff --git a/os/hal/boards/SN_SN32F240/board.c b/os/hal/boards/SN_SN32F240/board.c index dfc276c2f2..b1715ea6b2 100644 --- a/os/hal/boards/SN_SN32F240/board.c +++ b/os/hal/boards/SN_SN32F240/board.c @@ -60,8 +60,6 @@ void __early_init(void) { */ void boardInit(void) { - SN_SYS0->EXRSTCTRL_b.RESETDIS = 1; // Disable RESET - SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD } void restart_usb_driver(USBDriver *usbp) { diff --git a/os/hal/boards/SN_SN32F240B/board.c b/os/hal/boards/SN_SN32F240B/board.c index 596ee347ce..802d141829 100644 --- a/os/hal/boards/SN_SN32F240B/board.c +++ b/os/hal/boards/SN_SN32F240B/board.c @@ -60,6 +60,4 @@ void __early_init(void) { */ void boardInit(void) { - SN_SYS0->EXRSTCTRL_b.RESETDIS = 1; // Disable RESET - SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD } diff --git a/os/hal/boards/SN_SN32F260/board.c b/os/hal/boards/SN_SN32F260/board.c index 72ad880c15..d089216ab6 100644 --- a/os/hal/boards/SN_SN32F260/board.c +++ b/os/hal/boards/SN_SN32F260/board.c @@ -56,5 +56,5 @@ void __early_init(void) { * @brief Board-specific initialization code. */ void boardInit(void) { - SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD + } diff --git a/os/hal/boards/SN_SN32F280/board.c b/os/hal/boards/SN_SN32F280/board.c index 596ee347ce..802d141829 100644 --- a/os/hal/boards/SN_SN32F280/board.c +++ b/os/hal/boards/SN_SN32F280/board.c @@ -60,6 +60,4 @@ void __early_init(void) { */ void boardInit(void) { - SN_SYS0->EXRSTCTRL_b.RESETDIS = 1; // Disable RESET - SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD } diff --git a/os/hal/boards/SN_SN32F290/board.c b/os/hal/boards/SN_SN32F290/board.c index 596ee347ce..802d141829 100644 --- a/os/hal/boards/SN_SN32F290/board.c +++ b/os/hal/boards/SN_SN32F290/board.c @@ -60,6 +60,4 @@ void __early_init(void) { */ void boardInit(void) { - SN_SYS0->EXRSTCTRL_b.RESETDIS = 1; // Disable RESET - SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD }