2023-08-24 17:15:02 +02:00
|
|
|
set(CMAKE_SYSTEM_NAME Generic)
|
|
|
|
set(CMAKE_SYSTEM_VERSION 1)
|
2023-12-18 10:17:26 +01:00
|
|
|
set(NUTTX 1)
|
2023-08-24 17:15:02 +02:00
|
|
|
|
2023-09-11 15:59:11 +02:00
|
|
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
|
|
|
|
2023-08-24 17:15:02 +02:00
|
|
|
set(NUTTX_PATH ${CMAKE_CURRENT_LIST_DIR}/..)
|
|
|
|
include(${NUTTX_PATH}/scripts/target.cmake)
|
|
|
|
|
|
|
|
set(LINKER_SCRIPT ${NUTTX_PATH}/scripts/${LDNAME})
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS "${ARCHCPUFLAGS} ${ARCHCFLAGS} -D__NuttX__")
|
|
|
|
set(CMAKE_CXX_FLAGS "${ARCHCPUFLAGS} ${ARCHCXXFLAGS} -D__NuttX__")
|
|
|
|
|
|
|
|
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${NUTTX_PATH}/include
|
|
|
|
${NUTTX_PATH}/arch/chip)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
|
|
|
|
${NUTTX_PATH}/include/libcxx ${NUTTX_PATH}/include ${NUTTX_PATH}/arch/chip)
|
|
|
|
|
2024-03-13 10:51:15 +01:00
|
|
|
file(GLOB STARTUP_OBJS ${NUTTX_PATH}/startup/*)
|
|
|
|
|
2023-08-24 17:15:02 +02:00
|
|
|
add_compile_options(-nostdlib)
|
|
|
|
add_compile_options(-ffunction-sections -fdata-sections)
|
|
|
|
|
2024-03-01 09:24:27 +01:00
|
|
|
set(CMAKE_C_LINK_EXECUTABLE
|
2024-03-13 10:51:15 +01:00
|
|
|
"<CMAKE_LINKER> ${LDFLAGS} --entry=__start -T${LINKER_SCRIPT} <OBJECTS> ${STARTUP_OBJS} -o <TARGET> <LINK_LIBRARIES> -L${NUTTX_PATH}/libs --start-group ${LDLIBS} ${EXTRA_LIBS} --end-group"
|
2024-03-01 09:24:27 +01:00
|
|
|
)
|
|
|
|
set(CMAKE_CXX_LINK_EXECUTABLE
|
2024-03-13 10:51:15 +01:00
|
|
|
"<CMAKE_LINKER> ${LDFLAGS} --entry=__start -T${LINKER_SCRIPT} <OBJECTS> ${STARTUP_OBJS} -o <TARGET> <LINK_LIBRARIES> -L${NUTTX_PATH}/libs --start-group ${LDLIBS} ${EXTRA_LIBS} --end-group"
|
2023-08-24 17:15:02 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|