@@ -36,6 +36,7 @@ set(PROJECT_VERSION "0.6.0-BETA.${MAGIC_SMOKE}") # Generate compile version
3636# NOTICE: ENABLING THESE DEBUGGING DEFINITIONS WILL HAVE SIGNIFICANT IMPACT AND WILL DELAY PLAYING!
3737# NOTICE: UART AND USBCDC ARE MUTUALLY EXCLUSIVE!
3838if (NOT DEFINED $ENV{DISABLE_DEBUGGING} ) # MATCHES
39+ set (BUILD_DEBUGGING DEBUG) # Set loglevel from CMake build steps (STATUS,DEBUG,TRACE) override with --log-level
3940 set (USBSID_DEBUGGING 1) # Enable debugging ~ mandatory enable for all other logging types
4041 set (UART_DEBUGGING 1) # Enable debugging over uart pins ~ USBCDC must be 0!
4142 set (USBCDC_DEBUGGING 0) # Enable debugging over cdc port 2 ~ UART must be 0!
@@ -78,6 +79,17 @@ set(USE_PIO_UART 0)
7879# rp2040 will bug out complaining about assembly calls not being available
7980# rp2350 will bug out on PICO_USE_SW_SPIN_LOCK not being available
8081
82+ ### Build steps log level
83+ set (CMAKE_MESSAGE_LOG_LEVEL ${BUILD_DEBUGGING} )
84+ message (DEBUG "Starting compilation of ${PRODUCT_STRING} firmware version ${PROJECT_VERSION } " )
85+ if (ONBOARD_EMULATOR EQUAL 1)
86+ message (DEBUG "Firmware is built with ONBOARD_EMULATOR" )
87+ endif ()
88+ if (ONBOARD_SIDPLAYER EQUAL 1)
89+ message (DEBUG "Firmware is built with ONBOARD_SIDPLAYER" )
90+ endif ()
91+ message (DEBUG "LOG_LEVEL is ${CMAKE_MESSAGE_LOG_LEVEL} " )
92+
8193### Optimization and debugging
8294# remember that enabling debugging and disabling optimizations
8395# will weird out tune playing and reading from and writing to
@@ -91,23 +103,23 @@ set(ANALYSE_STACKUSAGE 0) # 0 default, 1 enabled, 0 disabled
91103
92104### Target board pico, pico_w, pico2
93105if (DEFINED PICO_BOARD)
94- message ("PICO_BOARD is defined as ${PICO_BOARD} " )
106+ message (STATUS "PICO_BOARD is defined as ${PICO_BOARD} " )
95107else ()
96- message ("PICO_BOARD not defined, defaulting to 'pico'" )
108+ message (WARNING "PICO_BOARD not defined, defaulting to 'pico'" )
97109 set (PICO_BOARD pico)
98110endif ()
99111
100112### Target platform rp2040, rp2350 (rp2350-arm-s)
101113if (DEFINED PICO_PLATFORM)
102- message ("PICO_PLATFORM is defined as ${PICO_PLATFORM} " )
114+ message (STATUS "PICO_PLATFORM is defined as ${PICO_PLATFORM} " )
103115else ()
104116 if (DEFINED PICO_BOARD)
105117 if (PICO_BOARD STREQUAL "pico2" )
106118 set (PICO_PLATFORM rp2350)
107- message ("PICO_PLATFORM not defined, board is ${PICO_BOARD} setting PICO_PLATFORM to ${PICO_PLATFORM} " )
119+ message (STATUS "PICO_PLATFORM not defined, board is ${PICO_BOARD} setting PICO_PLATFORM to ${PICO_PLATFORM} " )
108120 endif ()
109121 else ()
110- message ("PICO_PLATFORM not defined, defaulting to 'rp2040'" )
122+ message (WARNING "PICO_PLATFORM not defined, defaulting to 'rp2040'" )
111123 set (PICO_PLATFORM rp2040)
112124 endif ()
113125endif ()
@@ -124,26 +136,26 @@ if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/src/globals.h)
124136 string (REGEX MATCH "^#define PROJECT_VERSION" VALIDATED ${LINE} )
125137 if (${VALIDATED} MATCHES ${VALIDATION_LINE} )
126138 set (REDUCTION_SUCCESS True )
127- message ("VALIDATED header line '${VALIDATION_LINE} '" )
139+ message (DEBUG "VALIDATED header line '${VALIDATION_LINE} '" )
128140 set (USBSID_MANUFACTURER "${PROJECT_MANUFACTURER} (v${PROJECT_VERSION } )" )
129141 add_compile_definitions (USBSID_MANUFACTURER= "${USBSID_MANUFACTURER} " )
130142 ### CMake shenanigens
131143 set (PJVER ${PROJECT_VERSION } )
132144 add_compile_definitions (PROJECT_VERSION = "${PJVER} " )
133145 break ()
134146 else ()
135- message ("ERROR header validation line is present but incorrect" )
147+ message (SEND_ERROR "ERROR header validation line is present but incorrect" )
136148 set (REDUCTION_SUCCESS False )
137149 return ()
138150 endif ()
139151 endif ()
140152 endwhile ()
141153 if (NOT REDUCTION_SUCCESS)
142- message ("ERROR header validation fallback line not present" )
154+ message (SEND_ERROR "ERROR header validation fallback line not present" )
143155 return ()
144156 endif ()
145157else ()
146- message ("ERROR globals.h missing" )
158+ message (SEND_ERROR "ERROR globals.h missing" )
147159 return ()
148160endif ()
149161
@@ -183,15 +195,15 @@ else()
183195 set (PICO_DEOPTIMIZED_DEBUG 0)
184196 ### TinyUSB debug logging
185197 if (TUSB_DEBUG GREATER 0)
186- message ("TinyUSB debugging set to ${TUSB_DEBUG} " )
198+ message (DEBUG "TinyUSB debugging set to ${TUSB_DEBUG} " )
187199 set (CFG_TUSB_DEBUG ${TUSB_DEBUG} )
188200 # add_compile_definitions(CFG_TUSB_DEBUG=${TUSB_DEBUG})
189201 else ()
190202 set (CFG_TUSB_DEBUG 0)
191203 endif ()
192204endif ()
193205
194- message ("Firmware build type is ${CMAKE_BUILD_TYPE } " )
206+ message (STATUS "Firmware build type is ${CMAKE_BUILD_TYPE } " )
195207
196208### Define compile time debugging
197209if (DEBUGGING EQUAL 0)
@@ -436,7 +448,7 @@ include_directories(".")
436448
437449### Double check debugging types
438450if (UART_DEBUGGING EQUAL 1 AND USBCDC_DEBUGGING EQUAL 1)
439- message ("ERROR cannot have both UART_DEBUGGING and USBCDC_DEBUGGING enabled!" )
451+ message (SEND_ERROR "ERROR cannot have both UART_DEBUGGING and USBCDC_DEBUGGING enabled!" )
440452 return ()
441453endif ()
442454
@@ -481,28 +493,28 @@ endif()
481493add_compile_definitions (MAGIC_SMOKE=${MAGIC_SMOKE} )
482494
483495### Captain I canna change the options anymore!
484- message ("C Compiler root: " ${CMAKE_FIND_ROOT_PATH } )
485- message ("CXX Compiler root: " ${CMAKE_FIND_ROOT_PATH } )
486- message ("C Compile time flags:" )
487- message ("${CMAKE_C_FLAGS } " )
488- message ("CXX Compile time flags:" )
489- message ("${CMAKE_CXX_FLAGS } " )
490- message ("Compile time options:" )
491- message ("${COMPILE_OPTS} " )
492- message ("Compile time source files:" )
493- message ("${SOURCEFILES} " )
494- message ("Compile time include dirs:" )
495- message ("${TARGET_INCLUDE_DIRS} " )
496+ message (TRACE "C Compiler root: " ${CMAKE_FIND_ROOT_PATH } )
497+ message (TRACE "CXX Compiler root: " ${CMAKE_FIND_ROOT_PATH } )
498+ message (TRACE "C Compile time flags:" )
499+ message (TRACE "${CMAKE_C_FLAGS } " )
500+ message (TRACE "CXX Compile time flags:" )
501+ message (TRACE "${CMAKE_CXX_FLAGS } " )
502+ message (TRACE "Compile time options:" )
503+ message (TRACE "${COMPILE_OPTS} " )
504+ message (TRACE "Compile time source files:" )
505+ message (TRACE "${SOURCEFILES} " )
506+ message (TRACE "Compile time include dirs:" )
507+ message (TRACE "${TARGET_INCLUDE_DIRS} " )
496508
497509### Compile targets
498510foreach (FILENAME PICOTYPE PCBVERSION IN ZIP_LISTS FILENAMES PICOTYPES PCBVERSIONS)
499511 # set filename
500512 set (BUILD ${FILENAME} )
501513 set (BUILD_VERSION "" )
502514 string (CONCAT BUILD_VERSION ${PROJECT_PRODUCT} " v" ${PCBVERSION} )
503- message (STATUS "Building ${FILENAME} with PICOTYPE=${PICOTYPE} and MAGIC_SMOKE=${MAGIC_SMOKE} " )
504- message (STATUS "Set USB manufacturer: ${USBSID_MANUFACTURER} " )
505- message (STATUS "Set USB product: ${BUILD_VERSION} " )
515+ message (DEBUG "Building ${FILENAME} with PICOTYPE=${PICOTYPE} and MAGIC_SMOKE=${MAGIC_SMOKE} " )
516+ message (DEBUG "Set USB manufacturer: ${USBSID_MANUFACTURER} " )
517+ message (DEBUG "Set USB product: ${BUILD_VERSION} " )
506518 # executable
507519 add_executable (${BUILD} ${SOURCEFILES} )
508520 # BUILD TYPES
@@ -534,11 +546,11 @@ foreach(FILENAME PICOTYPE PCBVERSION IN ZIP_LISTS FILENAMES PICOTYPES PCBVERSION
534546 target_link_options (${BUILD} PRIVATE -Xlinker --print-memory-usage )
535547 # memory map linkers
536548 if (${PICO_PLATFORM} MATCHES rp2350)
537- message (STATUS "Memmap linker, platform ${PICO_PLATFORM} MATCHES rp2350" )
549+ message (TRACE "Memmap linker, platform ${PICO_PLATFORM} MATCHES rp2350" )
538550 target_compile_definitions (${BUILD} PRIVATE USBSID PICO_EMBED_XIP_SETUP=1 )
539551 set_target_properties (${BUILD} PROPERTIES PICO_TARGET_LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR } /src/usbsidpico-rp2350.ld)
540552 else ()
541- message (STATUS "Memmap linker, platform ${PICO_PLATFORM} EQUALS rp2040" )
553+ message (TRACE "Memmap linker, platform ${PICO_PLATFORM} EQUALS rp2040" )
542554 set_target_properties (${BUILD} PROPERTIES PICO_TARGET_LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR } /src/usbsidpico-rp2040.ld)
543555 endif ()
544556 # tell the linker what libraries to link
0 commit comments