examples/sotest/elf: rename romfs_img to run test with CONFIG_NSH_ROMFSETC

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2023-11-18 21:18:30 +08:00 committed by Xiang Xiao
parent fdc35d0bad
commit 15c90ac17e
4 changed files with 13 additions and 11 deletions

View file

@ -124,8 +124,8 @@ static char fullpath[128];
****************************************************************************/
#if defined(CONFIG_EXAMPLES_ELF_ROMFS) || defined(CONFIG_EXAMPLES_ELF_CROMFS)
extern const unsigned char romfs_img[];
extern const unsigned int romfs_img_len;
extern const unsigned char elf_romfs_img[];
extern const unsigned int elf_romfs_img_len;
#elif !defined(CONFIG_EXAMPLES_ELF_EXTERN)
# error "No file system selected"
#endif
@ -223,9 +223,9 @@ int main(int argc, FAR char *argv[])
CONFIG_EXAMPLES_ELF_DEVMINOR);
desc.minor = CONFIG_EXAMPLES_ELF_DEVMINOR; /* Minor device number of the ROM disk. */
desc.nsectors = NSECTORS(romfs_img_len); /* The number of sectors in the ROM disk */
desc.nsectors = NSECTORS(elf_romfs_img_len); /* The number of sectors in the ROM disk */
desc.sectsize = SECTORSIZE; /* The size of one sector in bytes */
desc.image = (FAR uint8_t *)romfs_img; /* File system image */
desc.image = (FAR uint8_t *)elf_romfs_img; /* File system image */
ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
if (ret < 0)

View file

@ -85,7 +85,8 @@ $(ROMFS_IMG): install
$(FSIMG_SRC): $(ROMFS_IMG)
$(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" >>$@)
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" | \
sed -e "s/romfs_img/elf_romfs_img/g" >>$@)
else
# Make sure that the NuttX gencromfs tool has been built

View file

@ -64,7 +64,8 @@ $(ROMFS_IMG): install
$(ROMFS_SRC): $(ROMFS_IMG)
$(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" >>$@)
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" | \
sed -e "s/romfs_img/sotest_romfs_img/g" >>$@)
endif
# Create the exported symbol table

View file

@ -85,8 +85,8 @@
****************************************************************************/
#ifdef CONFIG_EXAMPLES_SOTEST_BUILTINFS
extern const unsigned char romfs_img[];
extern const unsigned int romfs_img_len;
extern const unsigned char sotest_romfs_img[];
extern const unsigned int sotest_romfs_img_len;
#endif
extern const struct symtab_s g_sot_exports[];
@ -127,10 +127,10 @@ int main(int argc, FAR char *argv[])
#ifdef CONFIG_EXAMPLES_SOTEST_BUILTINFS
/* Create a ROM disk for the ROMFS filesystem */
desc.minor = 0; /* Minor device number of the ROM disk. */
desc.nsectors = NSECTORS(romfs_img_len); /* The number of sectors in the ROM disk */
desc.minor = CONFIG_EXAMPLES_SOTEST_DEVMINOR; /* Minor device number of the ROM disk. */
desc.nsectors = NSECTORS(sotest_romfs_img_len); /* The number of sectors in the ROM disk */
desc.sectsize = SECTORSIZE; /* The size of one sector in bytes */
desc.image = (FAR uint8_t *)romfs_img; /* File system image */
desc.image = (FAR uint8_t *)sotest_romfs_img; /* File system image */
for (; desc.minor <= CONFIG_EXAMPLES_SOTEST_DEVMINOR_MAX; desc.minor++)
{