# ============================================================================ # mcu_config.cmake — RP2040 / Pico SDK configuration for the bootloader # ============================================================================ # Step 1/3: called BEFORE project() — bootstrap the Pico SDK toolchain macro(mcu_init) include(${CMAKE_SOURCE_DIR}/pico_sdk_import.cmake) endmacro() # Step 2/3: called AFTER project() — register SDK targets macro(mcu_sdk_config) set(CMAKE_C_STANDARD ${PROJECT_C_STANDARD}) set(CMAKE_C_STANDARD_REQUIRED ON) pico_sdk_init() endmacro() # Step 3/3: called AFTER add_executable() — link SDK libs + configure target function(mcu_link_target target) # Libraries needed by the bootloader. # hardware_flash is critical — the bootloader writes firmware to flash. target_link_libraries(${target} PRIVATE pico_stdlib hardware_uart hardware_dma hardware_flash ) # Route stdio over USB-CDC for bootloader status messages pico_enable_stdio_usb(${target} 1) pico_enable_stdio_uart(${target} 0) # Generate .uf2 for initial bootloader flashing via BOOTSEL pico_add_extra_outputs(${target}) endfunction()