#include #include #include "js-root.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define CONFIG_JS_RAMFS 1 #define STR_RAMDEVNO(m) #m #define MKMOUNT_DEVNAME(m) "/dev/ram" STR_RAMDEVNO(m) #define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_JS_RAMFS) #ifndef CONFIG_EXAMPLES_ROMFS_SECTORSIZE # define CONFIG_EXAMPLES_ROMFS_SECTORSIZE 64 #endif #define NSECTORS(b) (((b)+CONFIG_EXAMPLES_ROMFS_SECTORSIZE-1)/CONFIG_EXAMPLES_ROMFS_SECTORSIZE) int main(int argc, char *argv[]) { struct boardioc_romdisk_s desc; /* Create a RAM disk for the test */ desc.minor = CONFIG_JS_RAMFS; /* Minor device number of the ROM disk. */ desc.nsectors = NSECTORS(js_img_len); /* The number of sectors in the ROM disk */ desc.sectsize = CONFIG_EXAMPLES_ROMFS_SECTORSIZE; /* The size of one sector in bytes */ desc.image = (FAR uint8_t *)js_img; /* File system image */ boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc); mkdir("/js", 0755); printf("%d\n", mount(MOUNT_DEVNAME, "/js", "romfs", MS_RDONLY, NULL)); return 0; }