cmake: use sdk-ng built toolchain for x86_64
This adds the necessary bits to utilize the x86_64 toolchain built by sdk-ng for x86_64 when toolchain variant is either zephyr or xtools. This allows decoupling the builds from the host toolchain. Newlib is also available with this toolchain so remove the Kconfig restriction on CONFIG_NEWLIB_LIBC. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
06a3735754
commit
1c5fa6a128
7 changed files with 16 additions and 3 deletions
|
@ -11,4 +11,7 @@ add_subdirectory(core)
|
|||
|
||||
zephyr_compile_options(${X86_64_BASE_CFLAGS} -mx32)
|
||||
|
||||
zephyr_link_libraries(-mx32)
|
||||
zephyr_link_libraries(
|
||||
-mx32
|
||||
${LINKERFLAGPREFIX},-melf32_x86_64
|
||||
)
|
||||
|
|
|
@ -48,6 +48,7 @@ add_custom_command(
|
|||
-T ${CMAKE_CURRENT_SOURCE_DIR}/xuk-stub32.ld
|
||||
${CMAKE_CURRENT_BINARY_DIR}/xuk-stub32.o
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/xuk-stub32.elf
|
||||
${LINKERFLAGPREFIX},-melf_i386
|
||||
COMMAND ${CMAKE_OBJCOPY} -O binary
|
||||
${CMAKE_CURRENT_BINARY_DIR}/xuk-stub32.elf
|
||||
${incdir}/xuk-stub32.bin
|
||||
|
@ -70,4 +71,5 @@ add_custom_command(
|
|||
COMMAND ${CMAKE_C_COMPILER} -m32 -T ${CMAKE_CURRENT_SOURCE_DIR}/xuk64.ld
|
||||
-Wl,--build-id=none -nostdlib -nodefaultlibs -nostartfiles
|
||||
-o ${qkernel_file} ${CMAKE_CURRENT_BINARY_DIR}/zephyr-qemu.o
|
||||
${LINKERFLAGPREFIX},-melf_i386
|
||||
)
|
||||
|
|
|
@ -6,5 +6,6 @@ arch: x86_64
|
|||
toolchain:
|
||||
- zephyr
|
||||
- host
|
||||
- xtools
|
||||
testing:
|
||||
default: true
|
||||
|
|
|
@ -54,7 +54,7 @@ set(ZEPHYR_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT} CACHE STRING "Zephyr to
|
|||
assert(ZEPHYR_TOOLCHAIN_VARIANT "Zephyr toolchain variant invalid: please set the ZEPHYR_TOOLCHAIN_VARIANT-variable")
|
||||
|
||||
# Pick host system's toolchain if we are targeting posix
|
||||
if((${ARCH} STREQUAL "posix") OR (${ARCH} STREQUAL "x86_64"))
|
||||
if(${ARCH} STREQUAL "posix")
|
||||
if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "llvm")
|
||||
set(ZEPHYR_TOOLCHAIN_VARIANT "host")
|
||||
endif()
|
||||
|
|
|
@ -13,6 +13,7 @@ set(CROSS_COMPILE_TARGET_riscv32 riscv32-zephyr-elf)
|
|||
set(CROSS_COMPILE_TARGET_mips mipsel-zephyr-elf)
|
||||
set(CROSS_COMPILE_TARGET_xtensa xtensa-zephyr-elf)
|
||||
set(CROSS_COMPILE_TARGET_arc arc-zephyr-elf)
|
||||
set(CROSS_COMPILE_TARGET_x86_64 x86_64-zephyr-elf)
|
||||
|
||||
set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
|
||||
set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET})
|
||||
|
@ -29,4 +30,7 @@ if("${ARCH}" STREQUAL "xtensa")
|
|||
|
||||
LIST(APPEND TOOLCHAIN_LIBS hal)
|
||||
LIST(APPEND LIB_INCLUDE_DIR -L${SYSROOT_DIR}/lib)
|
||||
elseif("${ARCH}" STREQUAL "x86_64")
|
||||
list(APPEND TOOLCHAIN_C_FLAGS -mx32)
|
||||
list(APPEND TOOLCHAIN_LD_FLAGS -mx32)
|
||||
endif()
|
||||
|
|
|
@ -13,6 +13,7 @@ set(CROSS_COMPILE_TARGET_riscv32 riscv32-zephyr-elf)
|
|||
set(CROSS_COMPILE_TARGET_mips mipsel-zephyr-elf)
|
||||
set(CROSS_COMPILE_TARGET_xtensa xtensa-zephyr-elf)
|
||||
set(CROSS_COMPILE_TARGET_arc arc-zephyr-elf)
|
||||
set(CROSS_COMPILE_TARGET_x86_64 x86_64-zephyr-elf)
|
||||
|
||||
set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
|
||||
set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET})
|
||||
|
@ -28,5 +29,8 @@ if("${ARCH}" STREQUAL "xtensa")
|
|||
|
||||
LIST(APPEND TOOLCHAIN_LIBS hal)
|
||||
LIST(APPEND LIB_INCLUDE_DIR -L${SYSROOT_DIR}/lib)
|
||||
elseif("${ARCH}" STREQUAL "x86_64")
|
||||
list(APPEND TOOLCHAIN_C_FLAGS -mx32)
|
||||
list(APPEND TOOLCHAIN_LD_FLAGS -mx32)
|
||||
endif()
|
||||
set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET})
|
||||
|
|
|
@ -11,7 +11,6 @@ depends on !NATIVE_APPLICATION
|
|||
|
||||
config NEWLIB_LIBC
|
||||
bool "Build with newlib c library"
|
||||
depends on !X86_64
|
||||
help
|
||||
Build with newlib library. The newlib library is expected to be
|
||||
part of the SDK in this case.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue