This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 245bbfa466a7c3aa935eef3768e8b073144ed1cd Author: xuxin19 <[email protected]> AuthorDate: Fri Nov 20 17:34:55 2026 +0800 cmake(bugfix):fix romfs_img missing aligned The Make build generates the romfs image array with "const unsigned char aligned_data(4)" (see boards/Board.mk), but the CMake build only added "const", so the image could be placed at an address that is not 4-byte aligned. Add aligned_data(4) to the generated array in nuttx_add_romfs() and process_all_directory_romfs(), and include <nuttx/compiler.h> in the generated source so that the aligned_data() macro is defined. Signed-off-by: xuxin19 <[email protected]> --- cmake/nuttx_add_romfs.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmake/nuttx_add_romfs.cmake b/cmake/nuttx_add_romfs.cmake index ea122edf2f6..0815497fb84 100644 --- a/cmake/nuttx_add_romfs.cmake +++ b/cmake/nuttx_add_romfs.cmake @@ -188,8 +188,13 @@ function(nuttx_add_romfs) copy_directory ${PATH} romfs_${NAME} \; fi COMMAND genromfs -f ${IMGNAME} -d romfs_${NAME} -V ${NAME} COMMAND xxd -i ${IMGNAME} romfs_${NAME}.${EXTENSION} - COMMAND if ! [ -z "${NONCONST}" ]\; then sed -E -i'' -e - "s/^unsigned/const unsigned/g" romfs_${NAME}.${EXTENSION} \; fi + COMMAND + if ! [ -z "${NONCONST}" ]\; then sed -E -i'' -e + "s/^unsigned char/const unsigned char aligned_data\\(4\\)/g" + romfs_${NAME}.${EXTENSION} \; fi + COMMAND + bash -c + 'sed -i \"1i\\\#include <nuttx/compiler.h>\" romfs_${NAME}.${EXTENSION}' DEPENDS ${DEPENDS}) if(NOT HEADER) @@ -482,7 +487,10 @@ function(process_all_directory_romfs) etc romfs_etc \; fi COMMAND genromfs -f romfs.img -d romfs_etc -V etc COMMAND xxd -i romfs.img romfs_etc.c - COMMAND sed -E -i'' -e "s/^unsigned/const unsigned/g" romfs_etc.c + COMMAND + sed -E -i'' -e + "s/^unsigned char/const unsigned char aligned_data\\(4\\)/g" romfs_etc.c + COMMAND bash -c 'sed -i \"1i\\\#include <nuttx/compiler.h>\" romfs_etc.c' DEPENDS ${DEPENDS}) add_custom_target(target-romfs DEPENDS ${DEPENDS})
