New project under bootloader/ with the same structure as color_switcher: Dockerfile, docker-compose, modular CMake, and APP_BOOT + SYS_ECU stub components. Reuses common/ submodules for MCU_UART, MCU_USB, HAL_COM, STD_TYPES. TODO.md lists all open design decisions (interface, protocol, flash layout, entry trigger, integrity checks, flash strategy) and the implementation tasks that depend on them.
35 lines
1.2 KiB
CMake
35 lines
1.2 KiB
CMake
# ============================================================================
|
|
# 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()
|