build: use kconfig to select generated artifacts
Not all boards require the various binary formats zephyr generates. So be selective based on the arch, SoC or board and only geenrate the binaries actually needed. Fixes #5009 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
938a8aadaa
commit
1f1143ac87
@ -667,16 +667,6 @@ set_target_properties(${logical_target_for_zephyr_elf} PROPERTIES OUTPUT_NAME ${
|
||||
|
||||
set(post_build_commands "")
|
||||
|
||||
# TODO: Write a KConfig for these options instead
|
||||
set(CONFIG_CHECK_LINK_MAP 1)
|
||||
|
||||
set(CONFIG_BUILD_OUTPUT_HEX 1)
|
||||
set(CONFIG_BUILD_OUTPUT_BIN 1)
|
||||
set(CONFIG_BUILD_OUTPUT_S19 1)
|
||||
set(CONFIG_BUILD_OUTPUT_DISASSEMBLY 1)
|
||||
set(CONFIG_BUILD_OUTPUT_STAT 1)
|
||||
set(CONFIG_BUILD_OUTPUT_STRIPPED 1)
|
||||
|
||||
list_append_ifdef(CONFIG_CHECK_LINK_MAP
|
||||
post_build_commands
|
||||
COMMAND ${PYTHON_EXECUTABLE} $ENV{ZEPHYR_BASE}/scripts/check_link_map.py ${KERNEL_MAP_NAME}
|
||||
@ -700,13 +690,13 @@ list_append_ifdef(
|
||||
)
|
||||
|
||||
list_append_ifdef(
|
||||
CONFIG_BUILD_OUTPUT_DISASSEMBLY
|
||||
CONFIG_OUTPUT_DISASSEMBLY
|
||||
post_build_commands
|
||||
COMMAND ${CMAKE_OBJDUMP} -S ${KERNEL_ELF_NAME} > ${KERNEL_LST_NAME}
|
||||
)
|
||||
|
||||
list_append_ifdef(
|
||||
CONFIG_BUILD_OUTPUT_STAT
|
||||
CONFIG_OUTPUT_STAT
|
||||
post_build_commands
|
||||
COMMAND ${CMAKE_READELF} -e ${KERNEL_ELF_NAME} > ${KERNEL_STAT_NAME}
|
||||
)
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
|
||||
if SOC_FAMILY_NRF5
|
||||
|
||||
config BUILD_OUTPUT_HEX
|
||||
default y
|
||||
|
||||
if SERIAL
|
||||
|
||||
config GPIO
|
||||
|
||||
@ -11,6 +11,10 @@ config SOC_FAMILY_STM32
|
||||
default n
|
||||
|
||||
if SOC_FAMILY_STM32
|
||||
|
||||
config BUILD_OUTPUT_HEX
|
||||
default y
|
||||
|
||||
config SOC_FAMILY
|
||||
string
|
||||
default st_stm32
|
||||
|
||||
@ -26,6 +26,7 @@ menu "Nios II Gen 2 Processor Options"
|
||||
config CPU_NIOS2_GEN2
|
||||
bool
|
||||
default y
|
||||
select BUILD_OUTPUT_HEX
|
||||
help
|
||||
This option signifies the use of a Nios II Gen 2 CPU
|
||||
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
|
||||
if BOARD_QEMU_CORTEX_M3
|
||||
|
||||
config BUILD_OUTPUT_BIN
|
||||
default n
|
||||
|
||||
config BOARD
|
||||
default qemu_cortex_m3
|
||||
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
if BOARD_QEMU_NIOS2
|
||||
|
||||
config BUILD_OUTPUT_BIN
|
||||
default n
|
||||
|
||||
config BOARD
|
||||
default "qemu_nios2"
|
||||
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
if BOARD_QEMU_RISCV32
|
||||
|
||||
config BUILD_OUTPUT_BIN
|
||||
default n
|
||||
|
||||
config BOARD
|
||||
default "qemu_riscv32"
|
||||
|
||||
|
||||
@ -2,3 +2,4 @@
|
||||
config BOARD_ZEDBOARD_PULPINO
|
||||
bool "Zedboard pulpino target"
|
||||
depends on SOC_RISCV32_PULPINO
|
||||
select BUILD_OUTPUT_S19
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
|
||||
if BOARD_QEMU_X86
|
||||
|
||||
|
||||
config BUILD_OUTPUT_BIN
|
||||
default n
|
||||
|
||||
config BOARD
|
||||
default qemu_x86
|
||||
|
||||
|
||||
@ -4,6 +4,9 @@
|
||||
|
||||
if BOARD_QEMU_XTENSA
|
||||
|
||||
config BUILD_OUTPUT_BIN
|
||||
default n
|
||||
|
||||
config BOARD
|
||||
default qemu_xtensa
|
||||
|
||||
|
||||
48
misc/Kconfig
48
misc/Kconfig
@ -6,7 +6,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
menu "Compile and Link Features"
|
||||
menu "Build and Link Features"
|
||||
|
||||
menu "Linker Options"
|
||||
config HAS_FLASH_LOAD_OFFSET
|
||||
@ -104,9 +104,16 @@ config KERNEL_ENTRY
|
||||
help
|
||||
Code entry symbol, to be set at linking phase.
|
||||
|
||||
config CHECK_LINK_MAP
|
||||
bool "Check linker map"
|
||||
default y
|
||||
help
|
||||
Run a linker address generation validity checker at the end of the
|
||||
build.
|
||||
endmenu
|
||||
|
||||
menu "Compiler Options"
|
||||
|
||||
config CROSS_COMPILE
|
||||
string "Cross-compiler tool prefix"
|
||||
help
|
||||
@ -144,12 +151,49 @@ config GDB_INFO
|
||||
during interrupts, exceptions, and context switches. This information
|
||||
is required for task-aware debugging with GDB.
|
||||
|
||||
menu "Build Options"
|
||||
|
||||
config KERNEL_BIN_NAME
|
||||
string "The kernel binary name"
|
||||
default "zephyr"
|
||||
help
|
||||
This option sets the name of the generated kernel binary.
|
||||
This option sets the name of the generated kernel binary.
|
||||
|
||||
config OUTPUT_STAT
|
||||
bool "Create a statistics file"
|
||||
default y
|
||||
help
|
||||
Create a stat file using readelf -e <elf>
|
||||
|
||||
config BUILD_OUTPUT_HEX
|
||||
bool "Build a binary in HEX format"
|
||||
default n
|
||||
help
|
||||
Build a binary in HEX format. This will build a zephyr.hex file need
|
||||
by some platforms.
|
||||
|
||||
config BUILD_OUTPUT_BIN
|
||||
bool "Build a binary in BIN format"
|
||||
default y
|
||||
help
|
||||
Build a binary in BIN format. This will build a zephyr.bin file need
|
||||
by some platforms.
|
||||
|
||||
config BUILD_OUTPUT_S19
|
||||
bool "Build a binary in S19 format"
|
||||
default n
|
||||
help
|
||||
Build a binary in S19 format. This will build a zephyr.s19 file need
|
||||
by some platforms.
|
||||
|
||||
config BUILD_OUTPUT_STRIPPED
|
||||
bool "Build a stripped binary"
|
||||
default n
|
||||
help
|
||||
Build a stripped binary. This will build a zephyr.stripped file need
|
||||
by some platforms.
|
||||
|
||||
endmenu
|
||||
endmenu
|
||||
|
||||
menu "System Monitoring Options"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user