Open maxkunes opened 1 year ago
object
kind has not been supported in makefile generator yet.
object
kind has not been supported in makefile generator yet.
Oh, I do have some .object files in some other targets in my .lua file. Would the issue be fixed if I swap those targets to generate static libraries?
I also notice that cmake does not work? Is that also not supported?
The reason why I'm compiling objects is because I am having issues compiling assembly files. If I include assembly files in my standard targets, they seem to inherit the compile options of the other C/C++ code in the target. This causes the assembly files to fail to "compile" as those options for C/C++ are not correct for the assembly code. To fix this issue, I made a separate target that builds the assembly files into object files that get linked in the final executable. Is there a way around this? I suspect the inheritance is due to the GCC executable compiling both the assembly and C/C++ code, but I'm not sure.
object
kind has not been supported in makefile generator yet.Oh, I do have some .object files in some other targets in my .lua file. Would the issue be fixed if I swap those targets to generate static libraries?
I also notice that cmake does not work? Is that also not supported?
yes
The reason why I'm compiling objects is because I am having issues compiling assembly files. If I include assembly files in my standard targets, they seem to inherit the compile options of the other C/C++ code in the target. This causes the assembly files to fail to "compile" as those options for C/C++ are not correct for the assembly code. To fix this issue, I made a separate target that builds the assembly files into object files that get linked in the final executable. Is there a way around this? I suspect the inheritance is due to the GCC executable compiling both the assembly and C/C++ code, but I'm not sure.
what options? c/c++ use add_cxflags(), asm use add_asflags. they are not conflict.
object
kind has not been supported in makefile generator yet.Oh, I do have some .object files in some other targets in my .lua file. Would the issue be fixed if I swap those targets to generate static libraries? I also notice that cmake does not work? Is that also not supported?
yes
The reason why I'm compiling objects is because I am having issues compiling assembly files. If I include assembly files in my standard targets, they seem to inherit the compile options of the other C/C++ code in the target. This causes the assembly files to fail to "compile" as those options for C/C++ are not correct for the assembly code. To fix this issue, I made a separate target that builds the assembly files into object files that get linked in the final executable. Is there a way around this? I suspect the inheritance is due to the GCC executable compiling both the assembly and C/C++ code, but I'm not sure.
what options? c/c++ use add_cxflags(), asm use add_asflags. they are not conflict.
I'll give add_asflags
a shot, but I'm very certain I've tested add_asflags
and flags from add_cxflags
were still getting passed. I'll have to double check though.
I just tested moving my assembly back into my main target, and the issue I'm seeing is that values from add_defines
get passed to the assembler. Is there any way to not pass the values from add_defines
to the assembler?
add_defines will pass to all sourcefiles.
if you do not want to set it to asm, you can use add_cxflags/add_asflags to set it.
Hmm, ok. I'll give that a shot.
That worked! However, I'm getting this error now when building the makefile. The same issue also happens with the cmake
project kind:
PS redacted> xmake project -v makefile
configure
{
ccache = true
host = windows
kind = static
plat = cross
buildir = build
mode = release
arch = none
target_os = linux
ndk_stdcxx = true
}
error: attempt to concatenate a nil value (local 'program')
-vD and see logs
PS > xmake project -vD cmake
configure
{
plat = cross
mode = release
buildir = build
ndk_stdcxx = true
host = windows
ccache = true
kind = static
arch = none
target_os = linux
}
error: @programdir\core\main.lua:299: @programdir\plugins\project\make\makefile.lua:282: attempt to concatenate a nil value (local 'program')
stack traceback:
[@programdir\plugins\project\make\makefile.lua:282]: in function '_make_target'
[@programdir\plugins\project\make\makefile.lua:429]: in function '_make_all'
[@programdir\plugins\project\make\makefile.lua:497]: in function '?'
[@programdir\plugins\project\main.lua:79]: in function '_make'
[@programdir\plugins\project\main.lua:92]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:280]:
[@programdir\core\base\task.lua:501]: in function 'run'
[@programdir\core\main.lua:297]: in function 'cotask'
[@programdir\core\base\scheduler.lua:404]:
stack traceback:
[C]: in function 'error'
@programdir\core\base\os.lua:898: in function 'base/os.raiselevel'
(...tail calls...)
@programdir\core\main.lua:299: in upvalue 'cotask'
@programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
please provide your xmake.lua
@waruqi
-- Define the Cortex-M7 toolchain. This is the toolchain that builds a binary that can be loaded by actual ZET hardware.
toolchain("cm7")
-- This is a standalone toolchain, not referencing anything else
set_kind("standalone")
-- Use "sdk" aka compilers, libraries, headers extracted from the 9198 version of MCUXPRESSO
if is_host("windows") then
print('Using Windows Toolchain')
set_sdkdir("./toolchains/MCUXpressoIDE_11.7.0_9198/windows")
else
print('Using Linux Toolchain')
set_sdkdir("./toolchains/MCUXpressoIDE_11.7.0_9198/linux")
end
toolchain_end()
-- Change target dir to a directory in scripts.
-- This is where the final output goes (axf and map)
set_targetdir("./zet_app/scripts/build/out/")
-- Define target for compiling threadx to object files.
target("threadx_lib")
-- Use CM7 toolchain
set_toolchains("cm7")
-- Produce object files, not exectuable binaries
set_kind("static")
-- Add all the C files
add_files("./libraries/threadx_lib/**.c")
-- ZET uses gnu99 for C and C++17
set_languages("gnu99", "cxx17")
-- Optimize using O2
set_optimize("faster")
-- Add the required include directories
add_includedirs("./libraries/threadx_lib/azure-rtos/threadx/common/inc")
add_includedirs("./libraries/threadx_lib/azure-rtos/threadx/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/threadx_lib/azure-rtos/config")
-- Add the required defines
add_cxflags("-DCPU_MIMXRT1064DVL6A")
add_cxflags("-DTX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DMCUXPRESSO_SDK")
add_cxflags("-DCPU_MIMXRT1064DVL6A_cm7")
add_cxflags("-D__MCUXPRESSO")
add_cxflags("-DDEBUG")
add_cxflags("-D__NEWLIB__")
-- Add the required compiler flags
add_cxflags("-fno-common")
add_cxflags("-g3")
add_cxflags("-Wno-unused-but-set-variable")
add_cxflags("-c")
add_cxflags("-ffunction-sections")
add_cxflags("-fdata-sections")
add_cxflags("-ffreestanding")
add_cxflags("-fno-builtin")
add_cxflags('-fmacro-prefix-map="$(<D)/"=')
add_cxflags("-mcpu=cortex-m7")
add_cxflags("-mfpu=fpv5-sp-d16")
add_cxflags("-mfloat-abi=hard", {force = true})
add_cxflags("-mthumb")
add_cxflags("-fstack-usage")
add_cxflags("-specs=nano.specs")
-- Define target for compiling filex to object files.
target("filex_lib")
-- Use CM7 toolchain
set_toolchains("cm7")
-- Produce object files, not exectuable binaries
set_kind("static")
-- Add all the C files
add_files("./libraries/filex_lib/**.c")
-- ZET uses gnu99 for C and C++17
set_languages("gnu99", "cxx17")
-- Optimize using O2
set_optimize("faster")
-- Add the required include directories
add_includedirs("./libraries/threadx_lib/azure-rtos/config")
add_includedirs("./libraries/filex_lib/azure-rtos/threadx/common/inc")
add_includedirs("./libraries/filex_lib/azure-rtos/threadx/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/filex_lib/azure-rtos/filex/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/filex_lib/azure-rtos/config")
add_includedirs("./libraries/filex_lib/azure-rtos/filex/common/inc")
-- Add the required defines
add_cxflags("-DCPU_MIMXRT1064DVL6A")
add_cxflags("-DTX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DFX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DMCUXPRESSO_SDK")
add_cxflags("-DCPU_MIMXRT1064DVL6A_cm7")
add_cxflags("-D__MCUXPRESSO")
add_cxflags("-DDEBUG")
add_cxflags("-D__NEWLIB__")
-- Add the required compiler flags
add_cxflags("-fno-common")
add_cxflags("-g3")
add_cxflags("-Wno-unused-but-set-variable")
add_cxflags("-c")
add_cxflags("-ffunction-sections")
add_cxflags("-fdata-sections")
add_cxflags("-ffreestanding")
add_cxflags("-fno-builtin")
add_cxflags('-fmacro-prefix-map="$(<D)/"=')
add_cxflags("-mcpu=cortex-m7")
add_cxflags("-mfpu=fpv5-sp-d16")
add_cxflags("-mfloat-abi=hard", {force = true})
add_cxflags("-mthumb")
add_cxflags("-fstack-usage")
add_cxflags("-specs=nano.specs")
-- Define target for compiling netxduo to object files.
target("netxduo_lib")
-- Use CM7 toolchain
set_toolchains("cm7")
-- Produce object files, not exectuable binaries
set_kind("static")
-- Add all the C files
add_files("./libraries/netxduo_lib/azure-rtos/netxduo/common/src/**.c")
add_files("./libraries/netxduo_lib/azure-rtos/netxduo/crypto_libraries/**.c")
add_files("./libraries/netxduo_lib/azure-rtos/netxduo/nx_secure/**.c")
-- ZET uses gnu99 for C and C++17
set_languages("gnu99", "cxx17")
-- Optimize using O2
set_optimize("faster")
-- Add the required include directories
add_includedirs("./libraries/threadx_lib/azure-rtos/config")
add_includedirs("./libraries/filex_lib/azure-rtos/threadx/common/inc")
add_includedirs("./libraries/filex_lib/azure-rtos/threadx/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/filex_lib/azure-rtos/filex/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/filex_lib/azure-rtos/config")
add_includedirs("./libraries/filex_lib/azure-rtos/filex/common/inc")
add_includedirs("./libraries/threadx_lib/azure-rtos/config")
add_includedirs("./libraries/filex_lib/azure-rtos/config")
add_includedirs("./libraries/netxduo_lib/azure-rtos/threadx/common/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/filex/common/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/common/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/crypto_libraries/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/nx_secure/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/nx_secure/ports")
add_includedirs("./libraries/netxduo_lib/azure-rtos/threadx/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/filex/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/config")
-- Add the required defines
add_cxflags("-DCPU_MIMXRT1064DVL6A")
add_cxflags("-DTX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DFX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DNX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DMCUXPRESSO_SDK")
add_cxflags("-DCPU_MIMXRT1064DVL6A_cm7")
add_cxflags("-D__MCUXPRESSO")
add_cxflags("-DDEBUG")
add_cxflags("-D__NEWLIB__")
-- Add the required compiler flags
add_cxflags("-fno-common")
add_cxflags("-g3")
add_cxflags("-Wno-unused-but-set-variable")
add_cxflags("-c")
add_cxflags("-ffunction-sections")
add_cxflags("-fdata-sections")
add_cxflags("-ffreestanding")
add_cxflags("-fno-builtin")
add_cxflags('-fmacro-prefix-map="$(<D)/"=')
add_cxflags("-mcpu=cortex-m7")
add_cxflags("-mfpu=fpv5-sp-d16")
add_cxflags("-mfloat-abi=hard", {force = true})
add_cxflags("-mthumb")
add_cxflags("-fstack-usage")
add_cxflags("-specs=nano.specs")
-- Define target for compiling tinyusb to object files.
target("tinyusb_lib")
-- Use CM7 toolchain
set_toolchains("cm7")
-- Produce object files, not exectuable binaries
set_kind("static")
-- Add all the C files
add_files("./libraries/tinyusb_lib/**.c")
-- ZET uses gnu99 for C and C++17
set_languages("gnu99", "cxx17")
-- Optimize using O2
set_optimize("faster")
-- Add the required include directories
add_includedirs("./libraries/threadx_lib/azure-rtos/threadx/common/inc")
add_includedirs("./libraries/threadx_lib/azure-rtos/threadx/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/threadx_lib/azure-rtos/config")
add_includedirs("./libraries/tinyusb_lib/tinyusb")
add_includedirs("./libraries/tinyusb_lib/tinyusb/src")
add_includedirs("./libraries/tinyusb_lib/CMSIS")
add_includedirs("./libraries/tinyusb_lib/device")
add_includedirs("./libraries/tinyusb_lib/drivers")
add_includedirs("./libraries/tinyusb_lib/component/serial_manager")
add_includedirs("./libraries/tinyusb_lib/component/uart")
-- Add the required defines
add_cxflags("-DCPU_MIMXRT1064DVL6A")
add_cxflags("-DTX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DFX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DNX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DMCUXPRESSO_SDK")
add_cxflags("-DCPU_MIMXRT1064DVL6A_cm7")
add_cxflags("-D__MCUXPRESSO")
add_cxflags("-DDEBUG")
add_cxflags("-D__NEWLIB__")
add_cxflags("-DSERIAL_PORT_TYPE_UART=1")
-- Add the required compiler flags
add_cxflags("-fno-common")
add_cxflags("-g3")
add_cxflags("-Wno-unused-but-set-variable")
add_cxflags("-c")
add_cxflags("-ffunction-sections")
add_cxflags("-fdata-sections")
add_cxflags("-ffreestanding")
add_cxflags("-fno-builtin")
add_cxflags('-fmacro-prefix-map="$(<D)/"=')
add_cxflags("-mcpu=cortex-m7")
add_cxflags("-mfpu=fpv5-sp-d16")
add_cxflags("-mfloat-abi=hard", {force = true})
add_cxflags("-mthumb")
add_cxflags("-fstack-usage")
add_cxflags("-specs=nano.specs")
-- Define target for compiling zstd to object files.
target("zstd_lib")
-- Use CM7 toolchain
set_toolchains("cm7")
-- Produce object files, not exectuable binaries
set_kind("static")
-- Add all the C files
add_files("./libraries/zstd_lib/source/**.c")
-- ZET uses gnu99 for C and C++17
set_languages("gnu99", "cxx17")
-- Optimize using O2
set_optimize("faster")
-- Add the required include directories
add_includedirs("./libraries/zstd_lib/source")
-- Add the required defines
add_cxflags("-DCPU_MIMXRT1064DVL6A")
add_cxflags("-DTX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DFX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DNX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DMCUXPRESSO_SDK")
add_cxflags("-DCPU_MIMXRT1064DVL6A_cm7")
add_cxflags("-D__MCUXPRESSO")
add_cxflags("-DDEBUG")
add_cxflags("-D__NEWLIB__")
add_cxflags("-DSERIAL_PORT_TYPE_UART=1")
-- Add the required compiler flags
add_cxflags("-fno-common")
add_cxflags("-g3")
add_cxflags("-Wno-unused-but-set-variable")
add_cxflags("-c")
add_cxflags("-ffunction-sections")
add_cxflags("-fdata-sections")
add_cxflags("-ffreestanding")
add_cxflags("-fno-builtin")
add_cxflags('-fmacro-prefix-map="$(<D)/"=')
add_cxflags("-mcpu=cortex-m7")
add_cxflags("-mfpu=fpv5-sp-d16")
add_cxflags("-mfloat-abi=hard", {force = true})
add_cxflags("-mthumb")
add_cxflags("-fstack-usage")
add_cxflags("-specs=nano.specs")
-- Define the actual ZET bootloader target. This produces the zet_bootloader.axf that can be loaded onto the actual ZET hardware.
target("zet_bootloader")
-- Use CM7 toolchain
set_toolchains("cm7")
-- Set output filename
set_filename("zet_bootloader.axf")
-- Depend on ASM target and libraries so that it gets auto built and we can reference the object files.
add_deps("zstd_lib")
add_deps("tinyusb_lib")
add_deps("threadx_lib")
-- ZET uses gnu99 for C and C++17
set_languages("gnu99", "cxx17")
-- Optimize using O2
set_optimize("faster")
-- Add flags for both C and C++
add_cxflags("-fno-common")
add_cxflags("-g3")
add_cxflags("-Wall")
add_cxflags("-Wextra")
add_cxflags("-Wstack-usage=4096")
add_cxflags("-ffunction-sections")
add_cxflags("-fdata-sections")
add_cxflags("-ffreestanding")
add_cxflags("-fno-builtin")
add_cxflags("-Wno-unused-parameter")
add_cxflags("-Wno-missing-field-initializers")
add_cxflags("-Wno-write-strings")
add_cxflags("-Wno-unused-variable")
add_cxflags("-Wno-register")
add_cxflags("-mcpu=cortex-m7")
add_cxflags("-mfpu=fpv5-sp-d16")
add_cxflags("-mfloat-abi=hard", {force = true})
add_cxflags("-mthumb")
add_cxflags("-fstack-usage")
add_cxflags("-specs=nano.specs")
add_cxflags('-fmacro-prefix-map="$(<D)/"=')
-- Add flags for just the CPP Compiler
add_cxxflags("-fno-rtti")
add_cxxflags("-fno-exceptions")
add_cxxflags("-Wno-deprecated-declarations")
-- Add include directories for linker. This includes the location of libraries to link and also the linker script location.
add_linkdirs("./zet_bootloader/Debug/")
-- Add required linker flags
add_ldflags("-nostdlib", {force = true})
add_ldflags('-Wl,-Map,./zet_app/scripts/build/out/zet_bootloader.map', {force = true})
add_ldflags("-Xlinker --gc-sections", {force = true})
add_ldflags("-Xlinker -print-memory-usage", {force = true})
add_ldflags("-Xlinker --sort-section=alignment", {force = true})
add_ldflags("-Xlinker --cref", {force = true})
add_ldflags("-mcpu=cortex-m7", {force = true})
add_ldflags("-mfpu=fpv5-sp-d16", {force = true})
add_ldflags("-mfloat-abi=hard", {force = true})
add_ldflags("-mthumb", {force = true})
add_ldflags('-T zet_bootloader_Debug.ld', {force = true})
add_ldflags("-u _printf_float", {force = true})
add_ldflags("-u _scanf_float", {force = true})
-- Defines for both C and C++
add_cxflags("-DFMT_HEADER_ONLY")
add_cxflags("-DENABLE_RAM_VECTOR_TABLE")
add_cxflags("-DETL_LOG_ERRORS")
add_cxflags("-DUX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DFX_DISABLE_BUILD_OPTIONS")
add_cxflags("-DLX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DSKIP_SYSCLK_INIT")
add_cxflags("-DXIP_BOOT_HEADER_DCD_ENABLE=1")
add_cxflags("-DCPU_MIMXRT1064DVL6A")
add_cxflags("-DCPU_MIMXRT1064DVL6A_cm7")
add_cxflags("-DSDK_DEBUGCONSOLE=1")
add_cxflags("-DXIP_EXTERNAL_FLASH=1")
add_cxflags("-DXIP_BOOT_HEADER_ENABLE=1")
add_cxflags("-DSDK_DEBUGCONSOLE_UART")
add_cxflags("-DPRINTF_FLOAT_ENABLE=1")
add_cxflags("-DSCANF_FLOAT_ENABLE=1")
add_cxflags("-DPRINTF_ADVANCED_ENABLE=1")
add_cxflags("-DSCANF_ADVANCED_ENABLE=1")
add_cxflags("-DSERIAL_PORT_TYPE_UART=1")
add_cxflags("-DFSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE")
add_cxflags("-DTX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DFX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DNX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DCR_INTEGER_PRINTF")
add_cxflags("-D__MCUXPRESSO")
add_cxflags("-D__USE_CMSIS")
add_cxflags("-DDEBUG")
add_cxflags("-D__NEWLIB__")
add_cxflags("-DFREESCALE_KSDK_2_0_TRNG")
add_cxflags("-DNO_WOLFSSL_DIR")
add_cxflags("-DWOLFCRYPT_ONLY")
add_cxflags("-DHAVE_NETX")
add_cxflags("-DOPENSSL_EXTRA")
add_cxflags("-DNO_WRITEV")
add_cxflags("-DWOLFSSL_NO_SOCK")
add_cxflags("-DWOLFSSL_OPENSSH")
add_cxflags("-DTHREADX")
add_cxflags("-DULLONG_MAX=18446744073709551615ULL")
-- All the include directories of the project
add_includedirs("./libraries/tinyusb_lib/tinyusb")
add_includedirs("./libraries/zstd_lib/source")
add_includedirs("./zet_bootloader/component/serial_manager")
add_includedirs("./libraries/tinyusb_lib/tinyusb/src")
add_includedirs("./zet_bootloader/etl-20.32.1")
add_includedirs("./libraries/threadx_lib/azure-rtos/config")
add_includedirs("./libraries/threadx_lib/azure-rtos/threadx/common/inc")
add_includedirs("./libraries/threadx_lib/azure-rtos/threadx/ports/cortex_m7/gnu/inc")
add_includedirs("./zet_bootloader/drivers")
add_includedirs("./zet_bootloader/xip")
add_includedirs("./zet_bootloader/utilities")
add_includedirs("./zet_bootloader/component/serial_manager")
add_includedirs("./zet_bootloader/component/lists")
add_includedirs("./zet_bootloader/component/uart")
add_includedirs("./zet_bootloader/board")
add_includedirs("./zet_bootloader/usb/phy")
add_includedirs("./zet_bootloader/usb/include")
add_includedirs("./zet_bootloader/component/osa")
add_includedirs("./zet_bootloader/device")
add_includedirs("./zet_bootloader/CMSIS")
add_includedirs("./zet_bootloader/drivers")
add_includedirs("./zet_bootloader/xip")
add_includedirs("./zet_bootloader/utilities")
add_includedirs("./zet_bootloader/board")
add_includedirs("./zet_bootloader/usb/phy")
add_includedirs("./zet_bootloader/usb/include")
add_includedirs("./zet_bootloader/component/osa")
add_includedirs("./zet_bootloader/mbedtls/include")
add_includedirs("./zet_bootloader/mbedtls/library")
add_includedirs("./zet_bootloader/device")
add_includedirs("./zet_bootloader/CMSIS")
add_includedirs("./zet_bootloader/vendor/fmt-9.1.0")
add_includedirs("./zet_bootloader/source")
add_includedirs("./zet_bootloader/source/kernel/hardware")
add_includedirs("./zet_bootloader/")
-- Include all .S (assembly files) recursively in this directory
add_files("./zet_bootloader/**.S")
-- Set compiler flags. These are taken from MCUXPRESSO.
add_asflags("-c")
add_asflags("-fleading-underscore")
add_asflags("-x assembler-with-cpp")
add_asflags("-g3")
add_asflags("-mcpu=cortex-m7")
add_asflags("-mfpu=fpv5-sp-d16")
add_asflags("-mfloat-abi=hard", {force = true})
add_asflags("-mthumb")
add_asflags("-specs=nano.specs")
-- Compile all C/C++ files, but ignore any found in the scripts folder.
add_files("./zet_bootloader/**.c|scripts/**.c")
add_files("./zet_bootloader/**.cpp|scripts/**.cpp")
-- Define the actual ZET application target. This produces the zet_app.axf that can be loaded onto the actual ZET hardware.
target("zet_app")
-- Use CM7 toolchain
set_toolchains("cm7")
-- Set output filename
set_filename("zet_app.axf")
-- Depend on ASM target and libraries so that it gets auto built and we can reference the object files.
add_deps("tinyusb_lib")
add_deps("netxduo_lib")
add_deps("filex_lib")
add_deps("threadx_lib")
-- ZET uses gnu99 for C and C++17
set_languages("gnu99", "cxx17")
-- Optimize using O2
set_optimize("faster")
-- Add flags for both C and C++
add_cxflags("-fno-common")
add_cxflags("-g3")
add_cxflags("-Wall")
add_cxflags("-Wextra")
add_cxflags("-Wstack-usage=4096")
add_cxflags("-ffunction-sections")
add_cxflags("-fdata-sections")
add_cxflags("-ffreestanding")
add_cxflags("-fno-builtin")
add_cxflags("-Wno-unused-parameter")
add_cxflags("-Wno-missing-field-initializers")
add_cxflags("-Wno-write-strings")
add_cxflags("-Wno-unused-variable")
add_cxflags("-Wno-register")
add_cxflags("-mcpu=cortex-m7")
add_cxflags("-mfpu=fpv5-sp-d16")
add_cxflags("-mfloat-abi=hard", {force = true})
add_cxflags("-mthumb")
add_cxflags("-fstack-usage")
add_cxflags("-specs=nano.specs")
add_cxflags('-fmacro-prefix-map="$(<D)/"=')
-- Add flags for just the CPP Compiler
add_cxxflags("-fno-rtti")
add_cxxflags("-fno-exceptions")
add_cxxflags("-Wno-deprecated-declarations")
-- Add include directories for linker. This includes the location of libraries to link and also the linker script location.
add_linkdirs("./zet_app/Debug/")
-- Add required linker flags
add_ldflags("-nostdlib", {force = true})
add_ldflags('-Wl,-Map,./zet_app/scripts/build/out/zet_app.map', {force = true})
add_ldflags("-Xlinker --gc-sections", {force = true})
add_ldflags("-Xlinker -print-memory-usage", {force = true})
add_ldflags("-Xlinker --sort-section=alignment", {force = true})
add_ldflags("-Xlinker --cref", {force = true})
add_ldflags("-mcpu=cortex-m7", {force = true})
add_ldflags("-mfpu=fpv5-sp-d16", {force = true})
add_ldflags("-mfloat-abi=hard", {force = true})
add_ldflags("-mthumb", {force = true})
add_ldflags('-T zet_app_Debug.ld', {force = true})
add_ldflags("-u _printf_float", {force = true})
add_ldflags("-u _scanf_float", {force = true})
-- Defines for both C and C++
add_cxflags("-DFMT_HEADER_ONLY")
add_cxflags("-DENABLE_RAM_VECTOR_TABLE")
add_cxflags("-DETL_LOG_ERRORS")
add_cxflags("-DUX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DFX_DISABLE_BUILD_OPTIONS")
add_cxflags("-DLX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DSKIP_SYSCLK_INIT")
add_cxflags("-DXIP_BOOT_HEADER_DCD_ENABLE=1")
add_cxflags("-DCPU_MIMXRT1064DVL6A")
add_cxflags("-DCPU_MIMXRT1064DVL6A_cm7")
add_cxflags("-DSDK_DEBUGCONSOLE=1")
add_cxflags("-DXIP_EXTERNAL_FLASH=1")
add_cxflags("-DXIP_BOOT_HEADER_ENABLE=1")
add_cxflags("-DSDK_DEBUGCONSOLE_UART")
add_cxflags("-DPRINTF_FLOAT_ENABLE=1")
add_cxflags("-DSCANF_FLOAT_ENABLE=1")
add_cxflags("-DPRINTF_ADVANCED_ENABLE=1")
add_cxflags("-DSCANF_ADVANCED_ENABLE=1")
add_cxflags("-DSERIAL_PORT_TYPE_UART=1")
add_cxflags("-DFSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE")
add_cxflags("-DTX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DFX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DNX_INCLUDE_USER_DEFINE_FILE")
add_cxflags("-DCR_INTEGER_PRINTF")
add_cxflags("-D__MCUXPRESSO")
add_cxflags("-D__USE_CMSIS")
add_cxflags("-DDEBUG")
add_cxflags("-D__NEWLIB__")
add_cxflags("-DFREESCALE_KSDK_2_0_TRNG")
add_cxflags("-DNO_WOLFSSL_DIR")
add_cxflags("-DWOLFCRYPT_ONLY")
add_cxflags("-DHAVE_NETX")
add_cxflags("-DOPENSSL_EXTRA")
add_cxflags("-DNO_WRITEV")
add_cxflags("-DWOLFSSL_NO_SOCK")
add_cxflags("-DWOLFSSL_OPENSSH")
add_cxflags("-DTHREADX")
add_cxflags("-DULLONG_MAX=18446744073709551615ULL")
-- All the include directories of the project
add_includedirs("./libraries/tinyusb_lib/tinyusb")
add_includedirs("./libraries/tinyusb_lib/tinyusb/src")
add_includedirs("./zet_app/azure-rtos/netxduo")
add_includedirs("./zet_app/azure-rtos/netxduo/addons/sntp")
add_includedirs("./zet_app/azure-rtos/netxduo/addons/dhcp")
add_includedirs("./zet_app/azure-rtos/netxduo/addons/web")
add_includedirs("./zet_app/etl-20.32.1")
add_includedirs("./zet_app/phy")
add_includedirs("./zet_app/mdio")
add_includedirs("./libraries/threadx_lib/azure-rtos/config")
add_includedirs("./libraries/threadx_lib/azure-rtos/threadx/common/inc")
add_includedirs("./libraries/threadx_lib/azure-rtos/threadx/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/filex_lib/azure-rtos/config")
add_includedirs("./libraries/filex_lib/azure-rtos/filex/common/inc")
add_includedirs("./libraries/filex_lib/azure-rtos/filex/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/config")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/common/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/ports/cortex_m7/gnu/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/crypto_libraries/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/nx_secure/inc")
add_includedirs("./libraries/netxduo_lib/azure-rtos/netxduo/nx_secure/ports")
add_includedirs("./zet_app/drivers")
add_includedirs("./zet_app/xip")
add_includedirs("./zet_app/utilities")
add_includedirs("./zet_app/component/serial_manager")
add_includedirs("./zet_app/component/lists")
add_includedirs("./zet_app/component/uart")
add_includedirs("./zet_app/board")
add_includedirs("./zet_app/nor_flash")
add_includedirs("./zet_app/usb/phy")
add_includedirs("./zet_app/usb/include")
add_includedirs("./zet_app/component/osa")
add_includedirs("./zet_app/device")
add_includedirs("./zet_app/CMSIS")
add_includedirs("./zet_app/drivers")
add_includedirs("./zet_app/xip")
add_includedirs("./zet_app/utilities")
add_includedirs("./zet_app/component/serial_manager")
add_includedirs("./zet_app/component/lists")
add_includedirs("./zet_app/component/uart")
add_includedirs("./zet_app/board")
add_includedirs("./zet_app/nor_flash")
add_includedirs("./zet_app/usb/phy")
add_includedirs("./zet_app/usb/include")
add_includedirs("./zet_app/component/osa")
add_includedirs("./zet_app/mbedtls/include")
add_includedirs("./zet_app/mbedtls/library")
add_includedirs("./zet_app/mbedtls/port/ksdk")
add_includedirs("./zet_app/wolf")
add_includedirs("./zet_app/wolf/wolfssl")
add_includedirs("./zet_app/wolf/wolfssl/openssl")
add_includedirs("./zet_app/device")
add_includedirs("./zet_app/CMSIS")
add_includedirs("./zet_app/snmp-lib")
add_includedirs("./zet_app/vendor/fmt-9.1.0")
add_includedirs("./zet_app/levelx-6.2.0/common/inc")
add_includedirs("./zet_app/levelx-6.2.0/common/src")
add_includedirs("./zet_app/source")
add_includedirs("./zet_app/source/kernel/hardware")
add_includedirs("./zet_app/")
-- Include all .S (assembly files) recursively in this directory
add_files("./zet_app/**.S")
-- Set assembler flags. These are taken from MCUXPRESSO.
add_asflags("-c")
add_asflags("-fleading-underscore")
add_asflags("-x assembler-with-cpp")
add_asflags("-g3")
add_asflags("-mcpu=cortex-m7")
add_asflags("-mfpu=fpv5-sp-d16")
add_asflags("-mfloat-abi=hard", {force = true})
add_asflags("-mthumb")
add_asflags("-specs=nano.specs")
-- Compile all C/C++ files, but ignore any found in the scripts folder.
add_files("./zet_app/**.c|scripts/**.c")
add_files("./zet_app/**.cpp|scripts/**.cpp")
To be clear, the commands I'm running are as follows:
xmake clean (and/or manually clean .xmake and build folders)
xmake f -p cross (to tell xmake to configure as a cross compilation)
xmake project -vD cmake (to create cmakelists project for example)
Note that running xmake
at before or after the failing xmake project...
call succeeds in compiling and linking all dependencies and the two binary applications.
PS > xmake project -vD cmake
configure { plat = cross mode = release buildir = build ndk_stdcxx = true host = windows ccache = true kind = static arch = none target_os = linux } error: @programdir\core\main.lua:299: @programdir\plugins\project\make\makefile.lua:282: attempt to concatenate a nil value (local 'program') stack traceback: [@programdir\plugins\project\make\makefile.lua:282]: in function '_make_target' [@programdir\plugins\project\make\makefile.lua:429]: in function '_make_all' [@programdir\plugins\project\make\makefile.lua:497]: in function '?' [@programdir\plugins\project\main.lua:79]: in function '_make' [@programdir\plugins\project\main.lua:92]: [C]: in function 'xpcall' [@programdir\core\base\utils.lua:280]: [@programdir\core\base\task.lua:501]: in function 'run' [@programdir\core\main.lua:297]: in function 'cotask' [@programdir\core\base\scheduler.lua:404]: stack traceback: [C]: in function 'error' @programdir\core\base\os.lua:898: in function 'base/os.raiselevel' (...tail calls...) @programdir\core\main.lua:299: in upvalue 'cotask' @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>
Strange, you are executing cmake generator, but the error stack is for makefile generator. Are you sure you are executing xmake project -k cmake
and not xmake project -k make
?
error: @programdir\core\main.lua:299: @programdir\plugins\project\make\makefile.lua:282: attempt to concatenate a nil value (local 'program')
xmake cannot get linker in makefile generator.
program is nil, you can debug it here.
Yes, I did notice the makefile error when using cmake. I am sure the command is correct.
I don't know, it works for me. you can debug here. https://github.com/xmake-io/xmake/blob/182613fd26ca880aa925fc02541cbf7f51104dd4/xmake/plugins/project/main.lua#L43
Xmake Version
xmake v2.7.6+master.12eb31bcf
Operating System Version and Architecture
Windows 11
Describe Bug
My
xmake.lua
uses a custom toolchain to compilegcc-arm-none-eabi
binaries. If I run purely thexmake
command to build the project, everything works as I would expect, and the output binaries are generated. However, I would also like to convert thexmake.lua
to other formats for other tooling such as to amakefile
orcmakelists.txt
The issue I am seeing is that given the command
xmake project -k makefile -v
, I get the error:error: no suitable linker for object.{cc cxx}
.I'm unsure how this makes sense, given that the project can build just fine when running
xmake
by itself. It seems like the toolchain settings are not applying when generating other project formats.Expected Behavior
Given that the project builds fine just just
xmake
, I would expect thatxmake project -k makefile
and other kinds would correctly work.Project Configuration