# 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 $ ${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} $ COMMENT "Packing ${target}.fls and ${target}_gz.img") endfunction()