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 <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-11-23 07:54:26 -05:00 committed by Anas Nashif
parent fd276aeb42
commit 4592ff2d5a
4 changed files with 16 additions and 1 deletions

View file

@ -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

View file

@ -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)

View file

@ -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
)

View file

@ -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