Enable DEBUG over serial in bootloader

This commit is contained in:
Raphael Coeffic
2021-05-26 16:08:51 +02:00
committed by Raphael Coeffic
parent 038b8364f6
commit afd0a4541b
2 changed files with 15 additions and 7 deletions
@@ -123,12 +123,12 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14)
../../../../../syscalls.c ../../../../../syscalls.c
) )
if(USB_CHARGER) if(USB_CHARGER)
set(BOOTLOADER_SRC set(BOOTLOADER_SRC
${BOOTLOADER_SRC} ${BOOTLOADER_SRC}
../../../../../targets/${TARGET_DIR}/usb_charger_driver.cpp ../../../../../targets/${TARGET_DIR}/usb_charger_driver.cpp
../../../../../targets/${TARGET_DIR}/led_driver.cpp ../../../../../targets/${TARGET_DIR}/led_driver.cpp
) )
endif() endif()
if(DEBUG) if(DEBUG)
@@ -148,7 +148,6 @@ else()
remove_definitions(-DDEBUG) remove_definitions(-DDEBUG)
endif() endif()
remove_definitions(-DDEBUG)
remove_definitions(-DDISK_CACHE) remove_definitions(-DDISK_CACHE)
remove_definitions(-DLUA) remove_definitions(-DLUA)
remove_definitions(-DCLI) remove_definitions(-DCLI)
@@ -55,6 +55,11 @@ const uint8_t bootloaderVersion[] __attribute__ ((section(".version"), used)) =
volatile rotenc_t rotencValue = 0; volatile rotenc_t rotencValue = 0;
#endif #endif
#if defined(DEBUG)
volatile tmr10ms_t g_tmr10ms;
uint32_t debugCounter1ms = 0;
#endif
uint32_t firmwareSize; uint32_t firmwareSize;
uint32_t firmwareAddress = FIRMWARE_ADDRESS; uint32_t firmwareAddress = FIRMWARE_ADDRESS;
uint32_t firmwareWritten = 0; uint32_t firmwareWritten = 0;
@@ -73,6 +78,10 @@ void interrupt10ms()
{ {
tenms |= 1u; // 10 mS has passed tenms |= 1u; // 10 mS has passed
#if defined(DEBUG)
g_tmr10ms++;
#endif
uint8_t index = 0; uint8_t index = 0;
uint8_t in = readKeys(); uint8_t in = readKeys();
for (uint8_t i = 1; i != uint8_t(1u << TRM_BASE); i <<= 1) { for (uint8_t i = 1; i != uint8_t(1u << TRM_BASE); i <<= 1) {