romfsimg: add attribute to set minimum 4 bytes aignment for romfs image data

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2022-01-27 16:32:39 +02:00 committed by Xiang Xiao
parent 6daec61423
commit 2498be1f40
8 changed files with 16 additions and 8 deletions

View File

@ -84,7 +84,8 @@ $(ROMFS_IMG): install
# Create the romfs.c file from the romfs.img file # Create the romfs.c file from the romfs.img file
$(FSIMG_SRC): $(ROMFS_IMG) $(FSIMG_SRC): $(ROMFS_IMG)
$(Q) (cd $(TESTS_DIR); xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" >$@) $(Q) (cd $(TESTS_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" >>$@)
else else
# Make sure that the NuttX gencromfs tool has been built # Make sure that the NuttX gencromfs tool has been built

View File

@ -72,7 +72,8 @@ $(ROMFS_IMG): install
# Create the romfs.c file from the romfs.img file # Create the romfs.c file from the romfs.img file
$(FSIMG_SRC): $(ROMFS_IMG) $(FSIMG_SRC): $(ROMFS_IMG)
$(Q) (cd $(DRIVER_DIR); xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" >$@) $(Q) (cd $(DRIVER_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" >>$@)
else ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y) else ifeq ($(CONFIG_EXAMPLES_MODULE_CROMFS),y)
# Make sure that the NuttX gencromfs tool has been built # Make sure that the NuttX gencromfs tool has been built

View File

@ -64,7 +64,8 @@ $(ROMFS_IMG): install
# Create the romfs.c file from the romfs.img file # Create the romfs.c file from the romfs.img file
$(ROMFS_SRC): $(ROMFS_IMG) $(ROMFS_SRC): $(ROMFS_IMG)
$(Q) (cd $(TESTS_DIR); xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" >$@) $(Q) (cd $(TESTS_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" >>$@)
# Create the dirlist.c file from the romfs directory # Create the dirlist.c file from the romfs directory

View File

@ -53,7 +53,8 @@ $(ROMFS_IMG): hello/hello redirect/redirect testdata.txt
# Create the romfs.c file from the romfs.img file # Create the romfs.c file from the romfs.img file
$(ROMFS_SRC): $(ROMFS_IMG) $(ROMFS_SRC): $(ROMFS_IMG)
$(Q) (cd $(FILESYSTEM_DIR); xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" >$@) $(Q) (cd $(FILESYSTEM_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" >>$@)
# Create the exported symbol table # Create the exported symbol table

View File

@ -63,7 +63,8 @@ $(ROMFS_IMG): install
# Create the romfs.c file from the romfs.img file # Create the romfs.c file from the romfs.img file
$(ROMFS_SRC): $(ROMFS_IMG) $(ROMFS_SRC): $(ROMFS_IMG)
$(Q) (cd $(LIB_DIR); xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" >$@) $(Q) (cd $(LIB_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" >>$@)
endif endif
# Create the exported symbol table # Create the exported symbol table

View File

@ -55,7 +55,8 @@ $(ROMFS_IMG): $(ROMFS_DIR)/index.html $(ROMFS_DIR)/style.css
# Create the romfs.c file from the romfs.img file # Create the romfs.c file from the romfs.img file
$(ROMFS_SRC): $(ROMFS_IMG) $(ROMFS_SRC): $(ROMFS_IMG)
$(Q) (cd $(CONTENT_DIR); xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" >$@) $(Q) (cd $(CONTENT_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" >>$@)
all:: $(ROMFS_SRC) all:: $(ROMFS_SRC)

View File

@ -58,7 +58,8 @@ $(ROMFS_IMG): install
# Create the romfs.c file from the romfs.img file # Create the romfs.c file from the romfs.img file
$(ROMFS_SRC): $(ROMFS_IMG) $(ROMFS_SRC): $(ROMFS_IMG)
$(Q) (cd $(CONTENT_DIR); xxd -i romfs.img | sed -e "s/^unsigned/const unsigned/g" >$@) $(Q) (cd $(CONTENT_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" >>$@)
# Create the exported symbol table list from the derived *-thunk.S files # Create the exported symbol table list from the derived *-thunk.S files

View File

@ -55,6 +55,7 @@ genromfs -f ${romfsimg} -d ${fsdir} -V "NuttXBootVol" || { echo "genromfs failed
# And, finally, create the header file # And, finally, create the header file
xxd -i ${romfsimg} | sed 's/unsigned/const unsigned/' >${headerfile} || \ echo '#include <nuttx/compiler.h>' >${headerfile}
xxd -i ${romfsimg} | sed 's/^unsigned char/const unsigned char aligned_data(4)/g' >>${headerfile} || \
{ echo "ERROR: xxd of $< failed" ; rm -f ${romfsimg}; exit 1 ; } { echo "ERROR: xxd of $< failed" ; rm -f ${romfsimg}; exit 1 ; }
rm -f ${romfsimg} rm -f ${romfsimg}