fix: allow compilation of BW radio when DEBUG=Y (#4708)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
@@ -524,6 +524,11 @@ link_libraries(firmware -lstdc++)
|
||||
add_dependencies(firmware ${RADIO_DEPENDENCIES})
|
||||
set_target_properties(firmware PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
if(DEBUG)
|
||||
target_compile_definitions(firmware PRIVATE -DDEBUG)
|
||||
target_compile_definitions(stm32_drivers_w_dbg_fw PRIVATE -DDEBUG)
|
||||
endif()
|
||||
|
||||
target_link_options(firmware PRIVATE
|
||||
-lm -T${LINKER_DIR}/firmware.ld
|
||||
-Wl,-Map=firmware.map,--cref,--no-warn-mismatch,--gc-sections
|
||||
|
||||
@@ -178,10 +178,6 @@ if(ENABLE_SERIAL_PASSTHROUGH)
|
||||
add_definitions(-DENABLE_SERIAL_PASSTHROUGH)
|
||||
endif()
|
||||
|
||||
if(DEBUG)
|
||||
add_definitions(-DDEBUG)
|
||||
endif()
|
||||
|
||||
if(HAPTIC)
|
||||
add_definitions(-DHAPTIC)
|
||||
set(SRC ${SRC} haptic.cpp)
|
||||
|
||||
@@ -83,7 +83,6 @@ if(NOT NATIVE_BUILD)
|
||||
add_library(stm32_drivers OBJECT EXCLUDE_FROM_ALL
|
||||
${STM32_DRIVER_DIR}/stm32_hal.cpp
|
||||
${STM32_DRIVER_DIR}/timers_driver.cpp
|
||||
${STM32_DRIVER_DIR}/sdcard_spi.cpp
|
||||
${STM32_DRIVER_DIR}/diskio_spi.cpp
|
||||
${STM32_DRIVER_DIR}/stm32_exti_driver.cpp
|
||||
${STM32_DRIVER_DIR}/stm32_serial_driver.cpp
|
||||
@@ -96,6 +95,14 @@ if(NOT NATIVE_BUILD)
|
||||
${STM32_DRIVER_DIR}/stm32_adc.cpp
|
||||
)
|
||||
|
||||
# HAL/LL drivers using TRACE
|
||||
add_library(stm32_drivers_w_dbg_fw OBJECT EXCLUDE_FROM_ALL
|
||||
${STM32_DRIVER_DIR}/sdcard_spi.cpp
|
||||
)
|
||||
add_library(stm32_drivers_w_dbg_bl OBJECT EXCLUDE_FROM_ALL
|
||||
${STM32_DRIVER_DIR}/sdcard_spi.cpp
|
||||
)
|
||||
|
||||
if(NOT PCB STREQUAL PL18)
|
||||
target_sources(stm32_drivers PUBLIC
|
||||
${STM32_DRIVER_DIR}/diskio_sdio.cpp
|
||||
@@ -103,7 +110,10 @@ if(NOT NATIVE_BUILD)
|
||||
endif()
|
||||
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} $<TARGET_OBJECTS:stm32_drivers>)
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} $<TARGET_OBJECTS:stm32_drivers_w_dbg_fw>)
|
||||
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $<TARGET_OBJECTS:stm32_drivers>)
|
||||
set(BOOTLOADER_SRC ${BOOTLOADER_SRC} $<TARGET_OBJECTS:stm32_drivers_w_dbg_bl>)
|
||||
endif()
|
||||
|
||||
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC}
|
||||
|
||||
@@ -83,7 +83,6 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14 OR PCB STREQUAL PL
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if(USB_CHARGER)
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
@@ -92,6 +91,7 @@ if(PCB STREQUAL X10 OR PCB STREQUAL X12S OR PCB STREQUAL NV14 OR PCB STREQUAL PL
|
||||
endif()
|
||||
|
||||
if(DEBUG)
|
||||
set(ENABLE_BOOTLOADER_DEBUG true)
|
||||
set(BOOTLOADER_SRC
|
||||
${BOOTLOADER_SRC}
|
||||
../../../../../serial.cpp
|
||||
@@ -105,9 +105,9 @@ else()
|
||||
../../../../../gui/common/stdlcd/utf8.cpp
|
||||
../../../../../crc.cpp
|
||||
)
|
||||
remove_definitions(-DDEBUG)
|
||||
endif()
|
||||
|
||||
# TODO: this shouldn't be needed at all
|
||||
remove_definitions(-DDISK_CACHE)
|
||||
remove_definitions(-DLUA)
|
||||
remove_definitions(-DCLI)
|
||||
@@ -124,7 +124,9 @@ if(NOT NO_LTO)
|
||||
target_compile_options(stm32usb_device_bl PRIVATE -flto)
|
||||
target_compile_options(stm32usb_device_fw PRIVATE -flto)
|
||||
target_compile_options(stm32_drivers PRIVATE -flto)
|
||||
target_compile_options(stm32_drivers_w_dbg_bl PRIVATE -flto)
|
||||
endif()
|
||||
|
||||
add_executable(bootloader EXCLUDE_FROM_ALL ${BOOTLOADER_SRC})
|
||||
add_dependencies(bootloader ${BITMAPS_TARGET})
|
||||
|
||||
@@ -148,6 +150,12 @@ if (DEFINED TARGET_SDRAM_SIZE)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (DEFINED ENABLE_BOOTLOADER_DEBUG)
|
||||
target_compile_definitions(bootloader PUBLIC -DDEBUG)
|
||||
# uncomment to enable TRACE in drivers
|
||||
# target_compile_definitions(stm32_drivers_w_dbg_bl PRIVATE -DDEBUG)
|
||||
endif()
|
||||
|
||||
target_include_directories(bootloader
|
||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user