CMakeLists.txt: generate firmware.map via -Wl,-Map. CI build job: - Writes per-section size table to the Gitea job summary (visible in the Actions UI after each run). - Uploads firmware.hex and firmware.map as a downloadable artifact named firmware-<sha>. CI docs job: - On push to main, force-pushes docs/html/ as an orphan commit to the gh-pages branch. Gitea Pages must be enabled in site admin for the HTML to be served; the branch is always available via the repo file browser regardless.
73 lines
1.5 KiB
CMake
73 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.22)
|
|
|
|
# must be set before project()
|
|
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/cmake/arm-none-eabi.cmake")
|
|
|
|
project(ptt_fhss C ASM)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
# sources
|
|
add_executable(firmware
|
|
src/startup.c
|
|
src/main.c
|
|
src/radio.c
|
|
src/fhss.c
|
|
src/power.c
|
|
vendor/tiny-aes-c/aes.c
|
|
)
|
|
|
|
# include paths
|
|
target_include_directories(firmware PRIVATE
|
|
include
|
|
vendor/nrfx/mdk # nRF52840 device headers (nrf52840.h etc.)
|
|
vendor/CMSIS_5/CMSIS/Core/Include # core_cm4.h, cmsis_gcc.h etc.
|
|
vendor/tiny-aes-c
|
|
)
|
|
|
|
# preprocessor defines
|
|
target_compile_definitions(firmware PRIVATE
|
|
NRF52840_XXAA # device variant required by nrfx/mdk headers
|
|
)
|
|
|
|
# compiler flags
|
|
set(CPU_FLAGS
|
|
-mcpu=cortex-m4
|
|
-mthumb
|
|
-mfpu=fpv4-sp-d16
|
|
-mfloat-abi=hard
|
|
)
|
|
|
|
target_compile_options(firmware PRIVATE
|
|
${CPU_FLAGS}
|
|
-Os
|
|
-ffunction-sections
|
|
-fdata-sections
|
|
-fno-exceptions
|
|
-Wall
|
|
-Wextra
|
|
-Werror
|
|
)
|
|
|
|
# linker
|
|
target_link_options(firmware PRIVATE
|
|
${CPU_FLAGS}
|
|
-T ${CMAKE_SOURCE_DIR}/link/nrf52840.ld
|
|
-Wl,--gc-sections
|
|
-Wl,--print-memory-usage
|
|
-Wl,-Map=${CMAKE_BINARY_DIR}/firmware.map
|
|
-nostartfiles
|
|
-specs=nano.specs
|
|
-specs=nosys.specs
|
|
)
|
|
|
|
# post-build: .hex + size report
|
|
add_custom_command(TARGET firmware POST_BUILD
|
|
COMMAND arm-none-eabi-objcopy
|
|
-O ihex $<TARGET_FILE:firmware>
|
|
${CMAKE_BINARY_DIR}/firmware.hex
|
|
COMMAND arm-none-eabi-size $<TARGET_FILE:firmware>
|
|
VERBATIM
|
|
)
|