From 3ca51778de2f680b1445697916f1f1e858c3baba Mon Sep 17 00:00:00 2001 From: Dimitris Mantzouranis Date: Wed, 11 Sep 2024 16:44:20 +0300 Subject: [PATCH] sn32: boards: pwm: disable SWD on init --- .../boards/SN_SN32F240B_PWM/board/board.mk | 3 +++ .../boards/SN_SN32F240B_PWM/board/extra.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 platforms/chibios/boards/SN_SN32F240B_PWM/board/extra.c diff --git a/platforms/chibios/boards/SN_SN32F240B_PWM/board/board.mk b/platforms/chibios/boards/SN_SN32F240B_PWM/board/board.mk index b3cf15dd678c..21fdccf4ba1e 100644 --- a/platforms/chibios/boards/SN_SN32F240B_PWM/board/board.mk +++ b/platforms/chibios/boards/SN_SN32F240B_PWM/board/board.mk @@ -1,6 +1,9 @@ # List of all the board related files. BOARDSRC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F240B/board.c +# Extra files +BOARDSRC += $(BOARD_PATH)/board/extra.c + # Required include directories BOARDINC = $(CHIBIOS_CONTRIB)/os/hal/boards/SN_SN32F240B diff --git a/platforms/chibios/boards/SN_SN32F240B_PWM/board/extra.c b/platforms/chibios/boards/SN_SN32F240B_PWM/board/extra.c new file mode 100644 index 000000000000..8fc9a63bfb7b --- /dev/null +++ b/platforms/chibios/boards/SN_SN32F240B_PWM/board/extra.c @@ -0,0 +1,19 @@ +/* Copyright 2024 Dimitris Mantzouranis + * + * 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 . + */ +void board_init(void) { + SN_SYS0->EXRSTCTRL_b.RESETDIS = 1; // Disable RESET + SN_SYS0->SWDCTRL_b.SWDDIS = 1; // Disable SWD +} \ No newline at end of file