Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuttx/CMake: Fix build more dependencies for kernel mode build #882

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion platforms/nuttx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ if (CONFIG_BUILD_KERNEL)
COMMAND mv ${PX4_BINARY_DIR}/bin/nsh ${PX4_BINARY_DIR}/init
COMMAND install -D ${PX4_BINARY_DIR}/init -t ${PX4_BINARY_DIR}/boot
COMMAND rm -f ${PX4_BINARY_DIR}/init
DEPENDS ${PX4_BINARY_DIR}/bin/nsh
DEPENDS nuttx_app_bins
)
add_custom_target(boot_bins DEPENDS ${PX4_BINARY_DIR}/boot/init)

Expand Down
1 change: 0 additions & 1 deletion platforms/nuttx/NuttX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ if (CONFIG_BUILD_KERNEL)
ELFLDNAME="${LDSCRIPT}"
USERLIBS="${userlibs}" > ${CMAKE_CURRENT_BINARY_DIR}/nuttx_apps_install.log
COMMAND touch nuttx_install.stamp
BYPRODUCTS ${PX4_BINARY_DIR}/bin/nsh
DEPENDS ${nuttx_userlibs} nuttx_startup
)
add_custom_target(nuttx_app_bins DEPENDS nuttx_install.stamp)
Expand Down
20 changes: 12 additions & 8 deletions platforms/nuttx/cmake/bin_romfs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,29 @@ function(make_bin_romfs)

# Strip the elf files to reduce romfs image size

set(stripped_deps)

if (${STRIPPED} STREQUAL "y")
# Preserve the files with debug symbols

add_custom_target(debug_${OUTPREFIX}
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPREFIX}_copy.stamp
COMMAND cp -r ${BINDIR}/. ${BINDIR}_debug
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${OUTPREFIX}_copy.stamp
DEPENDS ${DEPS}
)

add_custom_target(${OUTPREFIX}_copy DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${OUTPREFIX}_copy.stamp)

# Then strip the binaries in place

add_custom_command(OUTPUT ${OUTPREFIX}_stripped_bins
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPREFIX}_stripped.stamp
COMMAND for f in * \; do if [ -f "$$f" ]; then ${CMAKE_STRIP} $$f --strip-unneeded \; fi \; done
DEPENDS ${DEPS} debug_${OUTPREFIX}
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${OUTPREFIX}_stripped.stamp
DEPENDS ${DEPS} ${OUTPREFIX}_copy
WORKING_DIRECTORY ${BINDIR}
)
else()
add_custom_command(OUTPUT ${OUTPREFIX}_stripped_bins
COMMAND touch ${BINDIR}
)

list(APPEND stripped_deps ${CMAKE_CURRENT_BINARY_DIR}/${OUTPREFIX}_stripped.stamp)
endif()

# Make sure we have what we need
Expand Down Expand Up @@ -128,7 +132,7 @@ function(make_bin_romfs)
${SED} 's/^unsigned char/const unsigned char/g' >${OUTPREFIX}_romfsimg.h
COMMAND mv ${OUTPREFIX}_romfsimg.h ${OUTDIR}/${OUTPREFIX}_romfsimg.h
COMMAND rm -f ${OUTPREFIX}_romfs.img
DEPENDS ${OUTDIR} ${DEPS} ${OUTPREFIX}_stripped_bins
DEPENDS ${DEPS} ${stripped_deps}
)
add_custom_target(${OUTPREFIX}_romfsimg DEPENDS ${OUTDIR}/${OUTPREFIX}_romfsimg.h)

Expand Down
Loading