From 4592ff2d5a8229816e0834f16521fc0b18da7a65 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 23 Nov 2017 07:54:26 -0500 Subject: [PATCH] native: build zephyr.exe for posix arch To indicate the generated binary is executable on the host, add .exe extension to the generated ELF file. Signed-off-by: Anas Nashif --- CMakeLists.txt | 7 +++++++ cmake/app/boilerplate.cmake | 1 + cmake/emu/native.cmake | 2 +- misc/Kconfig | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fdc469259fc..61a4cf4ed3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -760,6 +760,7 @@ list_append_ifdef( post_build_commands COMMAND ${CMAKE_OBJCOPY} -S -Obinary -R .comment -R COMMON -R .eh_frame ${KERNEL_ELF_NAME} ${KERNEL_BIN_NAME} ) + list_append_ifdef( CONFIG_BUILD_OUTPUT_S19 post_build_commands @@ -784,6 +785,12 @@ list_append_ifdef( COMMAND ${CMAKE_STRIP} --strip-all ${KERNEL_ELF_NAME} -o ${KERNEL_STRIP_NAME} ) +list_append_ifdef( + CONFIG_BUILD_OUTPUT_EXE + post_build_commands + COMMAND ${CMAKE_COMMAND} -E rename ${KERNEL_ELF_NAME} ${KERNEL_EXE_NAME} + ) + add_custom_command( TARGET ${logical_target_for_zephyr_elf} POST_BUILD diff --git a/cmake/app/boilerplate.cmake b/cmake/app/boilerplate.cmake index 256b66d09df..8d64186d1de 100644 --- a/cmake/app/boilerplate.cmake +++ b/cmake/app/boilerplate.cmake @@ -237,6 +237,7 @@ set(KERNEL_HEX_NAME ${KERNEL_NAME}.hex) set(KERNEL_MAP_NAME ${KERNEL_NAME}.map) set(KERNEL_LST_NAME ${KERNEL_NAME}.lst) set(KERNEL_S19_NAME ${KERNEL_NAME}.s19) +set(KERNEL_EXE_NAME ${KERNEL_NAME}.exe) set(KERNEL_STAT_NAME ${KERNEL_NAME}.stat) set(KERNEL_STRIP_NAME ${KERNEL_NAME}.strip) diff --git a/cmake/emu/native.cmake b/cmake/emu/native.cmake index 4dbdacbd457..563e043088e 100644 --- a/cmake/emu/native.cmake +++ b/cmake/emu/native.cmake @@ -1,6 +1,6 @@ add_custom_target(run COMMAND - ${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME} + ${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_EXE_NAME} WORKING_DIRECTORY ${APPLICATION_BINARY_DIR} USES_TERMINAL ) diff --git a/misc/Kconfig b/misc/Kconfig index 37cd3e47c5d..9fbb53e4651 100644 --- a/misc/Kconfig +++ b/misc/Kconfig @@ -197,6 +197,13 @@ config BUILD_OUTPUT_BIN Build a binary in BIN format. This will build a zephyr.bin file need by some platforms. +config BUILD_OUTPUT_EXE + bool "Build a binary in ELF format with .exe extension" + default n + help + Build a binary in ELF format that can run in the host system. This + will build a zephyr.exe file. + config BUILD_OUTPUT_S19 bool "Build a binary in S19 format" default n