pureboot moved to its own repo, so the loader this board hands over to stopped being reachable through a sibling checkout of the bootloader repo. It is a submodule here now: this board has no reset line and no programming header, so the resident loader is the only way in, and the commit naming the firmware should name the loader it has to reach. The reachability check stops carrying its own copy of where that loader is. 0x7e00 was a literal beside pureboot's own geometry, which the submodule exports as PUREBOOT_BASE_HEX - one source for the fact now, and the check reads whichever slot the pinned loader actually has. The boot-section bound stays a literal, being a fuse fact rather than a loader one. Built and tested at both pins on the bench: 5/5, cross-mode identity included, and the image deployed to the board verifies byte-for-byte through its loader. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
42 lines
1.8 KiB
CMake
42 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.28)
|
|
|
|
project(fantemp LANGUAGES CXX)
|
|
|
|
# libavr rides as the pinned submodule; LIBAVR_ROOT (cache or environment)
|
|
# overrides it for tandem development against a working tree. The toolchain
|
|
# file comes from the submodule via CMakePresets.json either way.
|
|
if(NOT LIBAVR_ROOT AND DEFINED ENV{LIBAVR_ROOT})
|
|
set(LIBAVR_ROOT $ENV{LIBAVR_ROOT})
|
|
endif()
|
|
if(NOT LIBAVR_ROOT)
|
|
set(LIBAVR_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/libavr)
|
|
endif()
|
|
if(NOT EXISTS ${LIBAVR_ROOT}/CMakeLists.txt)
|
|
message(FATAL_ERROR "libavr not found at ${LIBAVR_ROOT} - run: git submodule update --init libavr")
|
|
endif()
|
|
# pureboot rides as a pinned submodule too: this board's only way in is its
|
|
# resident loader, so the commit that names this firmware names the loader it
|
|
# has to hand over to. Consumed for the geometry it exports - the loader links
|
|
# the libavr target above, so pureboot's own libavr submodule stays
|
|
# uninitialised.
|
|
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/pureboot/CMakeLists.txt)
|
|
message(FATAL_ERROR "pureboot not found - run: git submodule update --init pureboot")
|
|
endif()
|
|
add_subdirectory(${LIBAVR_ROOT} libavr-build)
|
|
add_subdirectory(pureboot pureboot-build)
|
|
include(${LIBAVR_ROOT}/cmake/checks.cmake)
|
|
|
|
add_executable(fantemp src/main.cpp)
|
|
target_link_libraries(fantemp PRIVATE libavr)
|
|
# The raw image is what the loader takes, and what the reachability check
|
|
# measures the boot-section clearance against.
|
|
add_custom_command(TARGET fantemp POST_BUILD
|
|
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:fantemp>
|
|
COMMAND ${CMAKE_OBJCOPY} -O binary -R .eeprom
|
|
$<TARGET_FILE:fantemp> $<TARGET_FILE_DIR:fantemp>/fantemp.bin
|
|
COMMAND ${CMAKE_OBJCOPY} -O ihex -R .eeprom
|
|
$<TARGET_FILE:fantemp> $<TARGET_FILE_DIR:fantemp>/fantemp.hex)
|
|
|
|
enable_testing()
|
|
add_subdirectory(test)
|