Docker-Build mit gcc-arm-none-eabi 4.9-2014q4 (statt Homebrew-Cask) verwendet, Dockerfile/tools/docker.sh dafür aus Task 13 vorgezogen. cmake/sdk.cmake schont gcc 4.9 (kennt -fcommon/-Wno-error=... nicht). Zwei zusätzliche SDK-Stubs (EarlyInit, pre_gpio_config) in src/sys/sdk_stubs.c ergänzt, siehe sdk/PATCHES.md.
21 lines
1013 B
CMake
21 lines
1013 B
CMake
# Host tool wm_tool packs the firmware into .img / _gz.img / .fls.
|
|
set(NL_WM_TOOL ${CMAKE_BINARY_DIR}/wm_tool)
|
|
add_custom_command(OUTPUT ${NL_WM_TOOL}
|
|
COMMAND cc -O2 -w -o ${NL_WM_TOOL} ${SDK_DIR}/tools/wm_tool.c -lpthread
|
|
DEPENDS ${SDK_DIR}/tools/wm_tool.c
|
|
COMMENT "Building host tool wm_tool")
|
|
add_custom_target(nl_wm_tool DEPENDS ${NL_WM_TOOL})
|
|
|
|
# 2M layout: update area 0x100000, run area 0x10100 (same as the old Klyqa images).
|
|
function(nl_add_images target)
|
|
add_dependencies(${target} nl_wm_tool)
|
|
set(out ${CMAKE_BINARY_DIR}/${target})
|
|
add_custom_command(TARGET ${target} POST_BUILD
|
|
COMMAND ${CMAKE_OBJCOPY} --output-target=binary -S -g -x -X -R .sbss -R .bss -R .reginfo -R .stack
|
|
$<TARGET_FILE:${target}> ${out}.bin
|
|
COMMAND ${NL_WM_TOOL} -b ${out}.bin -sb ${SDK_DIR}/Bin/secboot.img -fc compress -it 2M
|
|
-ua 100000 -ra 10100 -df -o ${out}
|
|
COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${target}>
|
|
COMMENT "Packing ${target}.fls and ${target}_gz.img")
|
|
endfunction()
|