Allow using Segger RTT as debug output (#3052)

Firmware needs to be built with -DDEBUG=YES and -DDEBUG_SEGGER_RTT=YES to use this feature.
This commit is contained in:
Cliff
2023-01-23 09:08:31 +01:00
committed by GitHub
parent 15dca01f42
commit 0b8e4c6003
7 changed files with 69 additions and 12 deletions
@@ -54,6 +54,13 @@ if(BLUETOOTH)
)
endif()
if(DEBUG_SEGGER_RTT)
set(BOOTLOADER_SRC
${BOOTLOADER_SRC}
../../../../../thirdparty/Segger_RTT/RTT/SEGGER_RTT.c
)
endif()
if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14)
set(BOOTLOADER_SRC
@@ -73,7 +80,7 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14)
foreach(LVGL_FILE ${LVGL_SRC_FILES_MINIMAL})
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} ../../../../../${LVGL_FILE})
endforeach()
if(USB_CHARGER)
set(BOOTLOADER_SRC
${BOOTLOADER_SRC}
@@ -88,11 +95,11 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14)
../../../../../targets/${TARGET_DIR}/extmodule_helper.cpp
)
endif()
if(DEBUG)
set(BOOTLOADER_SRC
${BOOTLOADER_SRC}
../../../../../${STM32LIB_DIR}/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c
# ../../../../../${STM32LIB_DIR}/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.c
../../../../../serial.cpp
../../../../../targets/common/arm/stm32/aux_serial_driver.cpp
../../../../../targets/common/arm/stm32/stm32_usart_driver.cpp
@@ -27,6 +27,10 @@
#include "keys.h"
#include "debug.h"
#if defined(DEBUG_SEGGER_RTT)
#include "thirdparty/Segger_RTT/RTT/SEGGER_RTT.h"
#endif
#if defined(PCBXLITE)
#define BOOTLOADER_KEYS 0x0F
#else
@@ -83,7 +87,7 @@ void interrupt10ms()
#if defined(DEBUG)
g_tmr10ms++;
#endif
uint8_t index = 0;
uint32_t in = readKeys();
@@ -228,6 +232,10 @@ void bootloaderInitApp()
boardBootloaderInit();
#endif
#if defined(DEBUG_SEGGER_RTT)
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
#endif
pwrInit();
keysInit();
@@ -267,7 +275,7 @@ void bootloaderInitApp()
#endif
delaysInit(); // needed for lcdInit()
#if defined(DEBUG)
initSerialPorts();
#endif