mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Remove USE_SWDIO, simply refer to DEBUG (#12361)
Remove USE_SWDIO, simply refer to debug Command line of `make TARGET=STM32F405 DEBUG=GDB` will trigger this. Alternative is simply `make TARGET=STM32F405 EXTRA_FLAGS="-DDEBUG"`
This commit is contained in:
parent
4fe980384c
commit
3598f3e41a
8 changed files with 84 additions and 16 deletions
|
@ -154,6 +154,7 @@ MCU_COMMON_SRC = \
|
||||||
drivers/stm32/adc_stm32f4xx.c \
|
drivers/stm32/adc_stm32f4xx.c \
|
||||||
drivers/stm32/bus_i2c_stm32f4xx.c \
|
drivers/stm32/bus_i2c_stm32f4xx.c \
|
||||||
drivers/stm32/bus_spi_stdperiph.c \
|
drivers/stm32/bus_spi_stdperiph.c \
|
||||||
|
drivers/stm32/debug.c \
|
||||||
drivers/stm32/dma_stm32f4xx.c \
|
drivers/stm32/dma_stm32f4xx.c \
|
||||||
drivers/stm32/dshot_bitbang.c \
|
drivers/stm32/dshot_bitbang.c \
|
||||||
drivers/stm32/dshot_bitbang_stdperiph.c \
|
drivers/stm32/dshot_bitbang_stdperiph.c \
|
||||||
|
|
|
@ -164,6 +164,7 @@ MCU_COMMON_SRC = \
|
||||||
drivers/stm32/bus_i2c_hal_init.c \
|
drivers/stm32/bus_i2c_hal_init.c \
|
||||||
drivers/stm32/bus_i2c_hal.c \
|
drivers/stm32/bus_i2c_hal.c \
|
||||||
drivers/stm32/bus_spi_ll.c \
|
drivers/stm32/bus_spi_ll.c \
|
||||||
|
drivers/stm32/debug.c \
|
||||||
drivers/stm32/dma_stm32f7xx.c \
|
drivers/stm32/dma_stm32f7xx.c \
|
||||||
drivers/stm32/dshot_bitbang_ll.c \
|
drivers/stm32/dshot_bitbang_ll.c \
|
||||||
drivers/stm32/dshot_bitbang.c \
|
drivers/stm32/dshot_bitbang.c \
|
||||||
|
|
|
@ -150,6 +150,7 @@ MCU_COMMON_SRC = \
|
||||||
drivers/stm32/bus_i2c_hal_init.c \
|
drivers/stm32/bus_i2c_hal_init.c \
|
||||||
drivers/stm32/bus_i2c_hal.c \
|
drivers/stm32/bus_i2c_hal.c \
|
||||||
drivers/stm32/bus_spi_ll.c \
|
drivers/stm32/bus_spi_ll.c \
|
||||||
|
drivers/stm32/debug.c \
|
||||||
drivers/stm32/dma_stm32g4xx.c \
|
drivers/stm32/dma_stm32g4xx.c \
|
||||||
drivers/stm32/dshot_bitbang_ll.c \
|
drivers/stm32/dshot_bitbang_ll.c \
|
||||||
drivers/stm32/dshot_bitbang.c \
|
drivers/stm32/dshot_bitbang.c \
|
||||||
|
|
|
@ -306,6 +306,7 @@ MCU_COMMON_SRC = \
|
||||||
drivers/stm32/bus_spi_ll.c \
|
drivers/stm32/bus_spi_ll.c \
|
||||||
drivers/stm32/bus_quadspi_hal.c \
|
drivers/stm32/bus_quadspi_hal.c \
|
||||||
drivers/stm32/bus_octospi_stm32h7xx.c \
|
drivers/stm32/bus_octospi_stm32h7xx.c \
|
||||||
|
drivers/stm32/debug.c \
|
||||||
drivers/stm32/dma_stm32h7xx.c \
|
drivers/stm32/dma_stm32h7xx.c \
|
||||||
drivers/stm32/dshot_bitbang_ll.c \
|
drivers/stm32/dshot_bitbang_ll.c \
|
||||||
drivers/stm32/dshot_bitbang.c \
|
drivers/stm32/dshot_bitbang.c \
|
||||||
|
|
|
@ -111,3 +111,5 @@ typedef enum {
|
||||||
} debugType_e;
|
} debugType_e;
|
||||||
|
|
||||||
extern const char * const debugModeNames[DEBUG_COUNT];
|
extern const char * const debugModeNames[DEBUG_COUNT];
|
||||||
|
|
||||||
|
void debugInit(void);
|
||||||
|
|
38
src/main/drivers/at32/debug.c
Normal file
38
src/main/drivers/at32/debug.c
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Betaflight.
|
||||||
|
*
|
||||||
|
* Betaflight is free software. You can redistribute this software
|
||||||
|
* and/or modify this software under the terms of the GNU General
|
||||||
|
* Public License as published by the Free Software Foundation,
|
||||||
|
* either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* Betaflight 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 software.
|
||||||
|
*
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
#include "build/debug.h"
|
||||||
|
#include "drivers/io.h"
|
||||||
|
|
||||||
|
#ifdef DEBUG // DEBUG=GDB on command line
|
||||||
|
void debugInit(void)
|
||||||
|
{
|
||||||
|
IO_t io = IOGetByTag(DEFIO_TAG_E(PA13)); // SWDIO
|
||||||
|
if (IOGetOwner(io) == OWNER_FREE) {
|
||||||
|
IOInit(io, OWNER_SWD, 0);
|
||||||
|
}
|
||||||
|
io = IOGetByTag(DEFIO_TAG_E(PA14)); // SWCLK
|
||||||
|
if (IOGetOwner(io) == OWNER_FREE) {
|
||||||
|
IOInit(io, OWNER_SWD, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
38
src/main/drivers/stm32/debug.c
Normal file
38
src/main/drivers/stm32/debug.c
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* This file is part of Betaflight.
|
||||||
|
*
|
||||||
|
* Betaflight is free software. You can redistribute this software
|
||||||
|
* and/or modify this software under the terms of the GNU General
|
||||||
|
* Public License as published by the Free Software Foundation,
|
||||||
|
* either version 3 of the License, or (at your option) any later
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
* Betaflight 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 software.
|
||||||
|
*
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
#include "build/debug.h"
|
||||||
|
#include "drivers/io.h"
|
||||||
|
|
||||||
|
#ifdef DEBUG // DEBUG=GDB on command line
|
||||||
|
void debugInit(void)
|
||||||
|
{
|
||||||
|
IO_t io = IOGetByTag(DEFIO_TAG_E(PA13)); // SWDIO
|
||||||
|
if (IOGetOwner(io) == OWNER_FREE) {
|
||||||
|
IOInit(io, OWNER_SWD, 0);
|
||||||
|
}
|
||||||
|
io = IOGetByTag(DEFIO_TAG_E(PA14)); // SWCLK
|
||||||
|
if (IOGetOwner(io) == OWNER_FREE) {
|
||||||
|
IOInit(io, OWNER_SWD, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -256,20 +256,6 @@ static void sdCardAndFSInit(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SWDIO
|
|
||||||
static void swdPinsInit(void)
|
|
||||||
{
|
|
||||||
IO_t io = IOGetByTag(DEFIO_TAG_E(PA13)); // SWDIO
|
|
||||||
if (IOGetOwner(io) == OWNER_FREE) {
|
|
||||||
IOInit(io, OWNER_SWD, 0);
|
|
||||||
}
|
|
||||||
io = IOGetByTag(DEFIO_TAG_E(PA14)); // SWCLK
|
|
||||||
if (IOGetOwner(io) == OWNER_FREE) {
|
|
||||||
IOInit(io, OWNER_SWD, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void init(void)
|
void init(void)
|
||||||
{
|
{
|
||||||
#ifdef SERIAL_PORT_COUNT
|
#ifdef SERIAL_PORT_COUNT
|
||||||
|
@ -1030,8 +1016,8 @@ void init(void)
|
||||||
spiInitBusDMA();
|
spiInitBusDMA();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SWDIO
|
#ifdef DEBUG
|
||||||
swdPinsInit();
|
debugInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unusedPinsInit();
|
unusedPinsInit();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue