Add kernel/userspace and nuttx_syscall libraries to build

Build NuttX proxies, stubs and separate user space and kernel space libraries

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen
2021-09-22 13:19:47 +03:00
parent 169eb616c6
commit 7c94bc8f02
3 changed files with 197 additions and 13 deletions
+36 -12
View File
@@ -288,14 +288,21 @@ add_dependencies(nuttx_build nuttx_apps_build)
target_link_libraries(nuttx_build INTERFACE nuttx_apps)
# helper for all targets
function(add_nuttx_dir nuttx_lib nuttx_lib_dir kernel extra)
function(add_nuttx_dir nuttx_lib nuttx_lib_dir kernel extra target)
if (${target} STREQUAL all)
set(nuttx_lib_target all)
else()
set(nuttx_lib_target lib${target}.a)
endif()
file(GLOB_RECURSE nuttx_lib_files
LIST_DIRECTORIES false
${CMAKE_CURRENT_SOURCE_DIR}/nuttx/${nuttx_lib_dir}/*)
add_custom_command(OUTPUT ${NUTTX_DIR}/${nuttx_lib_dir}/lib${nuttx_lib}.a
COMMAND find ${nuttx_lib_dir} -type f -name *.o -delete
COMMAND make -C ${nuttx_lib_dir} ${nuttx_build_options} --no-print-directory all TOPDIR=${NUTTX_DIR} KERNEL=${kernel} EXTRAFLAGS=${extra}
COMMAND make -C ${nuttx_lib_dir} ${nuttx_build_options} --no-print-directory ${nuttx_lib_target} TOPDIR=${NUTTX_DIR} KERNEL=${kernel} EXTRAFLAGS=${extra}
DEPENDS
${nuttx_lib_files}
nuttx_context ${NUTTX_DIR}/include/nuttx/config.h ${NUTTX_DIR}/include/nuttx/version.h
@@ -309,19 +316,36 @@ function(add_nuttx_dir nuttx_lib nuttx_lib_dir kernel extra)
target_link_libraries(nuttx_build INTERFACE nuttx_${nuttx_lib})
endfunction()
# add_nuttx_dir(NAME DIRECTORY KERNEL EXTRA)
add_nuttx_dir(arch arch/${CONFIG_ARCH}/src y -D__KERNEL__)
add_nuttx_dir(binfmt binfmt y -D__KERNEL__)
add_nuttx_dir(boards boards y -D__KERNEL__)
add_nuttx_dir(drivers drivers y -D__KERNEL__)
add_nuttx_dir(fs fs y -D__KERNEL__)
add_nuttx_dir(sched sched y -D__KERNEL__)
add_nuttx_dir(c libs/libc n "")
add_nuttx_dir(xx libs/libxx n "")
add_nuttx_dir(mm mm n "")
add_nuttx_dir(binfmt binfmt y -D__KERNEL__ all)
add_nuttx_dir(boards boards y -D__KERNEL__ all)
add_nuttx_dir(drivers drivers y -D__KERNEL__ all)
add_nuttx_dir(fs fs y -D__KERNEL__ all)
add_nuttx_dir(sched sched y -D__KERNEL__ all)
add_nuttx_dir(xx libs/libxx n "" all)
if (NOT CONFIG_BUILD_FLAT)
add_nuttx_dir(arch arch/${CONFIG_ARCH}/src n "" arch)
add_dependencies(nuttx_arch_build nuttx_karch_build) # can't build these in parallel
add_nuttx_dir(karch arch/arm/src y -D__KERNEL__ karch)
add_nuttx_dir(c libs/libc n "" c)
add_dependencies(nuttx_c_build nuttx_kc_build) # can't build these in parallel
add_nuttx_dir(kc libs/libc y -D__KERNEL__ kc)
add_nuttx_dir(mm mm n "" mm)
add_dependencies(nuttx_mm_build nuttx_kmm_build) # can't build these in parallel
add_nuttx_dir(kmm mm y -D__KERNEL__ kmm)
add_nuttx_dir(proxies syscall n "" proxies)
add_dependencies(nuttx_proxies_build nuttx_stubs_build) # can't build these in parallel
add_nuttx_dir(stubs syscall y -D__KERNEL__ stubs)
else()
add_nuttx_dir(arch arch/${CONFIG_ARCH}/src y -D__KERNEL__ all)
add_nuttx_dir(c libs/libc n "" all)
add_nuttx_dir(mm mm n "" mm)
endif()
if(CONFIG_NET)
add_nuttx_dir(net net y -D__KERNEL__)
add_nuttx_dir(net net y -D__KERNEL__ all)
endif()
###############################################################################