Re: Including Lua scripts on filesystem
I've put my source code here in case anyone wants to try it: https://github.com/RussellHaley/nuttx-russ-app-1 Thanks for the help everyone! Russ On Fri, Feb 3, 2023 at 2:31 AM Russell Haley wrote: > Hmmm... So far I've tried the romfs example, adding the mkrd command as > well as the suggestion by Sebastien but everything returns an error. Is > everyone sure that romfs works with the sim:nsh example code? > > rapp_main_1.c > static int open_romdisk_2(void) > { > int ret = 0; > ret = romdisk_register(0, // /dev/ram0 > scripts_img, //var in the xxd header > NSECTORS(scripts_img_len), > CONFIG_EXAMPLES_ROMFS_SECTORSIZE); > if (ret < 0) > { > printf("Failed to create a romdisk.\n"); > printf("Error Number is %d\n", errno); > printf("ERROR: Failed to create RAM disk: %s\n", strerror(errno)); > return 1; > } > >ret = nx_mount("/dev/ram0", "/romfs", "romfs", MS_RDONLY, NULL); > >if (ret < 0) > { > printf("Failed to mount ramdisk.\n"); > printf("Error NUmber is %d\n", errno); > printf("ERROR: Failed to create RAM disk: %s\n", strerror(errno)); > return 1; > } > } > > static int open_romdisk(void) > { > int ret = 0; > struct boardioc_mkrd_s ramdisk; > struct boardioc_romdisk_s desc; > > ramdisk.minor = CONFIG_EXAMPLES_ROMFS_RAMDEVNO; > ramdisk.nsectors = NSECTORS(scripts_img_len); > ramdisk.sectsize = CONFIG_EXAMPLES_ROMFS_SECTORSIZE; > > ret = boardctl(BOARDIOC_MKRD, (uintptr_t)); > > if (ret < 0) > { > printf("Failed to create a ramdisk.\n"); > printf("Error NUmber is %d\n", errno); > printf("ERROR: Failed to create RAM disk: %s\n", strerror(errno)); > return 1; > } > > /* Create a RAM disk for the test */ > desc.minor= CONFIG_EXAMPLES_ROMFS_RAMDEVNO; /* Minor device > number of the ROM disk. */ > desc.nsectors = NSECTORS(scripts_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 *)scripts_img; /* File system > image */ > > ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)); > > > if (ret < 0) > { > printf("Error NUmber is %d\n", errno); > printf("ERROR: Failed to create ROM disk: %s\n", strerror(errno)); > return 1; > } > /* Mount the test file system */ > > printf("Mounting ROMFS filesystem at target=%s with source=%s\n", > CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); > > ret = mount(MOUNT_DEVNAME, CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, "romfs", > MS_RDONLY, NULL); > if (ret < 0) > { > printf("Error NUmber is %d\n", errno); > printf("ERROR: Mount failed: %s\n", strerror(errno)); > return 1; > } > > return 0; > } > > / > * main > > / > > int main(int argc, FAR char *argv[]) > { > printf("Starting Russells App 1...\n"); > printf("Rom Disk Images says: %s\n", scripts_img+139); > // open_romdisk(); > open_romdisk_2(); > return 0; > } > > > OUTPUT: > > osboxes@osboxes ~/n/nuttx (master)> ./nuttx > > NuttShell (NSH) NuttX-12.0.0 > nsh> rapp > Starting Russells App 1... > Rom Disk Images says: require 'cjson' > > > function readAll(file) > local f = assert(io.open(file, "rb")) > local content = f:read("*all") > f:close() > return content > end > > local json = readAll('test.json') > local colors = cj.decode(json) > > for i,v in pairs(colors) do > for k,d in pairs(v) do > print(k,d) > end > end > > > Failed to create a romdisk. > Error Number is 0 > ERROR: Failed to create RAM disk: Unknown error > > On Thu, Feb 2, 2023 at 3:05 AM Xiang Xiao > wrote: > >> You need to prepare /dev/ram1 with the mkrd command. >> >> On Thu, Feb 2, 2023 at 2:29 PM Russell Haley >> wrote: >> >> > On Wed, Feb 1, 2023 at 9:23 PM Xiang Xiao >> > wrote: >> > >> > > You can debug sim nuttx with your favorite PC debugger just like a >> normal >> > > host program. >> > > Of course, please ensure the debug system is >> > > generated(CONFIG_DEBUG_SYMBOLS=y). >> > > >> > >> > I was able to set up KDevelop to run nuttx in the deb
Re: Including Lua scripts on filesystem
Hmmm... So far I've tried the romfs example, adding the mkrd command as well as the suggestion by Sebastien but everything returns an error. Is everyone sure that romfs works with the sim:nsh example code? rapp_main_1.c static int open_romdisk_2(void) { int ret = 0; ret = romdisk_register(0, // /dev/ram0 scripts_img, //var in the xxd header NSECTORS(scripts_img_len), CONFIG_EXAMPLES_ROMFS_SECTORSIZE); if (ret < 0) { printf("Failed to create a romdisk.\n"); printf("Error Number is %d\n", errno); printf("ERROR: Failed to create RAM disk: %s\n", strerror(errno)); return 1; } ret = nx_mount("/dev/ram0", "/romfs", "romfs", MS_RDONLY, NULL); if (ret < 0) { printf("Failed to mount ramdisk.\n"); printf("Error NUmber is %d\n", errno); printf("ERROR: Failed to create RAM disk: %s\n", strerror(errno)); return 1; } } static int open_romdisk(void) { int ret = 0; struct boardioc_mkrd_s ramdisk; struct boardioc_romdisk_s desc; ramdisk.minor = CONFIG_EXAMPLES_ROMFS_RAMDEVNO; ramdisk.nsectors = NSECTORS(scripts_img_len); ramdisk.sectsize = CONFIG_EXAMPLES_ROMFS_SECTORSIZE; ret = boardctl(BOARDIOC_MKRD, (uintptr_t)); if (ret < 0) { printf("Failed to create a ramdisk.\n"); printf("Error NUmber is %d\n", errno); printf("ERROR: Failed to create RAM disk: %s\n", strerror(errno)); return 1; } /* Create a RAM disk for the test */ desc.minor= CONFIG_EXAMPLES_ROMFS_RAMDEVNO; /* Minor device number of the ROM disk. */ desc.nsectors = NSECTORS(scripts_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 *)scripts_img; /* File system image */ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)); if (ret < 0) { printf("Error NUmber is %d\n", errno); printf("ERROR: Failed to create ROM disk: %s\n", strerror(errno)); return 1; } /* Mount the test file system */ printf("Mounting ROMFS filesystem at target=%s with source=%s\n", CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); ret = mount(MOUNT_DEVNAME, CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, "romfs", MS_RDONLY, NULL); if (ret < 0) { printf("Error NUmber is %d\n", errno); printf("ERROR: Mount failed: %s\n", strerror(errno)); return 1; } return 0; } / * main / int main(int argc, FAR char *argv[]) { printf("Starting Russells App 1...\n"); printf("Rom Disk Images says: %s\n", scripts_img+139); // open_romdisk(); open_romdisk_2(); return 0; } OUTPUT: osboxes@osboxes ~/n/nuttx (master)> ./nuttx NuttShell (NSH) NuttX-12.0.0 nsh> rapp Starting Russells App 1... Rom Disk Images says: require 'cjson' function readAll(file) local f = assert(io.open(file, "rb")) local content = f:read("*all") f:close() return content end local json = readAll('test.json') local colors = cj.decode(json) for i,v in pairs(colors) do for k,d in pairs(v) do print(k,d) end end Failed to create a romdisk. Error Number is 0 ERROR: Failed to create RAM disk: Unknown error On Thu, Feb 2, 2023 at 3:05 AM Xiang Xiao wrote: > You need to prepare /dev/ram1 with the mkrd command. > > On Thu, Feb 2, 2023 at 2:29 PM Russell Haley wrote: > > > On Wed, Feb 1, 2023 at 9:23 PM Xiang Xiao > > wrote: > > > > > You can debug sim nuttx with your favorite PC debugger just like a > normal > > > host program. > > > Of course, please ensure the debug system is > > > generated(CONFIG_DEBUG_SYMBOLS=y). > > > > > > > I was able to set up KDevelop to run nuttx in the debugger, but the > console > > never gave me a nsh> prompt so I wasn't able to enter my app name and run > > it. Nonetheless I was able to run in GDB on the command line. For some > > reason inode_search is returning 0, which is converted to -EEXIST or -17. > > > > Breakpoint 3, inode_reserve (path=0x7fff > memory at address 0x7fff>, mode=48, inode=0x55671220 > > ) at inode/fs_inodereserve.c:174 > > 174 { > > (gdb) n > > 184 *inode = NULL; > > (gdb) > > 186 if (path[0] == '\0') > > (gdb) p path > > $47 = 0x73f2f370 "/dev/ram1" > > (gdb) n > > 193 SETUP_SEARCH(, path, false); > > (gdb) > > 195 ret = inode_search(); > > (gdb) > > 196 if (ret >= 0) > > (gdb) p ret > > $49 = 0 > > (gdb) n > > 202 ret = -EEXIST; > >
Re: Including Lua scripts on filesystem
On Thu, Feb 2, 2023 at 6:35 AM Alan C. Assis wrote: > It should be nice to have a simple logic to let users to use ROMFS. > > Currently everyone needs to duplicate it in their own code/application. > > I'm thinking something like apps/romfiles/ where people just put the > files that they want to be in the ROM and it will be included > automatically, instead reinventing the wheel. > This is what I was hoping to find. I thought that since nuttx was already building a root filesystem there would be a simple way to include files with the image. Cheers, Russ > > BR, > > Alan > > On 2/2/23, Sebastien Lorquet wrote: > > Hi, > > > > Dont use boardctl for the romfs, this is too intertwined in the > > mechanism used to initialize nsh, which is not suitable for > customization. > > > > This need to be decoupled, I've done this in my own apps. I'll send it > > later, maybe. > > > > > > Here is the proper way to mount a romfs from your board bringup() > routines: > > > > I am using stm32 as example, the ROM fs directory holding the file is a > > brother to board/ > > > > boarddir: > > +-- romfs > > +-- your files... > > +-- board > > +-- include > > +-- src > > > > You can do something else if you change the makefile below > > > > First change your board/src makefile to add a dependency so that > > stm32_bringup.c depends on romfs.h > > > > .PHONY: myromfs.h #might not be required > > stm32_bringup.c: myromfs.h > > myromfs.h: > > @echo "ROMFS" > > @genromfs -v -f my.romfs -d $(BOARD_DIR)/../romfs > > @xxd -i my.romfs > myromfs.h > > > > Then do this in stm32_bringup.c: > > > > #include "myromfs.h" > > #define SECTORSIZE 64 > > #define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) > > #include > > #include > > #include > > > > and then in stm32_bringup(void): > > > > ret = romdisk_register(0, // /dev/ram0 > > myromfs, //var in the xxd header > > NSECTORS(myromfs_len), > > SECTORSIZE); > > > >ret = nx_mount("/dev/ram0", "/romfs", "romfs", MS_RDONLY, NULL); > > > > Then you will have your files mounted in /romfs at boot. > > > > You can do symlinks: > > > > ret = symlink("/romfs/etc" , "/etc"); > >_info("Linking /etc: %d\n", ret); > > > > Sebastien > > > > Le 02/02/2023 à 05:59, Russell Haley a écrit : > >> I am mistaken. I understood that the rom image was part of the > >> application > >> on flash, but had mis-read the documentation of > >> boardctl(BOARDIOC_ROMDISK, > >> (uintptr_t)); and thought that the command loaded the image into > >> *RAM* > >> (the BOARDIOC_MKRD command makes the RAM disk. oops!). > >> > >> Incidentally, neither the romfs example nor my attempt to re-create it > >> works in my sim: > >> > >> osboxes@osboxes ~/n/nuttx (master)> ./nuttx > >> > >> NuttShell (NSH) NuttX-12.0.0 > >> nsh> romfs > >> ERROR: Failed to create RAM disk: Unknown error > >> nsh> rapp > >> Starting Russells App 1... > >> ERROR: Failed to create RAM disk: Unknown error > >> nsh> > >> > >> I don't know how to debug this "unknown error". I guess I will try to > >> find > >> where that error message comes from and hook in GDB? I'm terrible at > this > >> stuff, someone needs to revoke my compiler license (tee hee). > >> > >> Cheers, > >> Russ > >> > >> On Wed, Feb 1, 2023 at 7:29 PM Xiang Xiao > >> wrote: > >> > >>> romfs is part of your image as the const string. There is no difference > >>> from the below manual step. > >>> > >>> On Thu, Feb 2, 2023 at 10:00 AM Russell Haley > >>> wrote: > >>> > >>>> On Tue, Jan 31, 2023 at 6:16 AM Fotis Panagiotopoulos < > >>> f.j.pa...@gmail.com > >>>> wrote: > >>>> > >>>>> Hello, > >>>>> > >>>>> Indeed the "proper" way of including a script would be to store it in > >>>>> a > >>>>> file system. > >>>>> > >>>>> However, when I needed to include a single and small script and I > &
Re: Including Lua scripts on filesystem
On Wed, Feb 1, 2023 at 9:23 PM Xiang Xiao wrote: > You can debug sim nuttx with your favorite PC debugger just like a normal > host program. > Of course, please ensure the debug system is > generated(CONFIG_DEBUG_SYMBOLS=y). > I was able to set up KDevelop to run nuttx in the debugger, but the console never gave me a nsh> prompt so I wasn't able to enter my app name and run it. Nonetheless I was able to run in GDB on the command line. For some reason inode_search is returning 0, which is converted to -EEXIST or -17. Breakpoint 3, inode_reserve (path=0x7fff , mode=48, inode=0x55671220 ) at inode/fs_inodereserve.c:174 174 { (gdb) n 184 *inode = NULL; (gdb) 186 if (path[0] == '\0') (gdb) p path $47 = 0x73f2f370 "/dev/ram1" (gdb) n 193 SETUP_SEARCH(, path, false); (gdb) 195 ret = inode_search(); (gdb) 196 if (ret >= 0) (gdb) p ret $49 = 0 (gdb) n 202 ret = -EEXIST; (gdb) Not sure what to do from here? Any feedback would be great? Thanks, Russ > > On Thu, Feb 2, 2023 at 1:00 PM Russell Haley wrote: > > > I am mistaken. I understood that the rom image was part of the > application > > on flash, but had mis-read the documentation of > boardctl(BOARDIOC_ROMDISK, > > (uintptr_t)); and thought that the command loaded the image into > *RAM* > > (the BOARDIOC_MKRD command makes the RAM disk. oops!). > > > > Incidentally, neither the romfs example nor my attempt to re-create it > > works in my sim: > > > > osboxes@osboxes ~/n/nuttx (master)> ./nuttx > > > > NuttShell (NSH) NuttX-12.0.0 > > nsh> romfs > > ERROR: Failed to create RAM disk: Unknown error > > nsh> rapp > > Starting Russells App 1... > > ERROR: Failed to create RAM disk: Unknown error > > nsh> > > > > I don't know how to debug this "unknown error". I guess I will try to > find > > where that error message comes from and hook in GDB? I'm terrible at this > > stuff, someone needs to revoke my compiler license (tee hee). > > > > Cheers, > > Russ > > > > On Wed, Feb 1, 2023 at 7:29 PM Xiang Xiao > > wrote: > > > > > romfs is part of your image as the const string. There is no difference > > > from the below manual step. > > > > > > On Thu, Feb 2, 2023 at 10:00 AM Russell Haley > > > wrote: > > > > > > > On Tue, Jan 31, 2023 at 6:16 AM Fotis Panagiotopoulos < > > > f.j.pa...@gmail.com > > > > > > > > > wrote: > > > > > > > > > Hello, > > > > > > > > > > Indeed the "proper" way of including a script would be to store it > > in a > > > > > file system. > > > > > > > > > > However, when I needed to include a single and small script and I > > > didn't > > > > > want to introduce a complete FS just for this, I used xxd. > > > > > xxd can convert any file to a C header file. > > > > > > > > > > You can then include the header, and access the whole file as a > > > variable. > > > > > Here is an example: > > > > > > > > > > I added this in my app Makefile: > > > > > > > > > > # Setup any special pre-build context > > > > > context: header > > > > > $(Q) cd path/to/libs/json.lua/ && xxd -i json.lua > > > json_lua.h > > > && > > > > > echo -n "const " | cat - json_lua.h > temp && mv temp json_lua.h > > > > > > > > > > > > > > > > > > > > And then I used the file like this: > > > > > > > > > > #include "lua.h"#include "lauxlib.h"#include > > > > > #include "json_lua.h" > > > > > static int luaopen_json(lua_State * L); > > > > > > > > > > void ExtLibs_load(lua_State * L){ > > > > > // json.lua#ifdef CONFIG_EXT_LIB_JSON_LUA > > > > > luaL_requiref(L, "json", luaopen_json, 1); > > > > > lua_pop(L, 1);#endif} > > > > > > > > > > int luaopen_json(lua_State * L){ > > > > > const char * modname = lua_tostring(L, 1); > > > > > > > > > > if (strcmp(modname, "json") != 0) > > > > > return luaL_error(L, "cannot load json module"); > > > > > > > > > > if (luaL_loadbufferx(L, (char*)json_lua, json
Re: Including Lua scripts on filesystem
I am mistaken. I understood that the rom image was part of the application on flash, but had mis-read the documentation of boardctl(BOARDIOC_ROMDISK, (uintptr_t)); and thought that the command loaded the image into *RAM* (the BOARDIOC_MKRD command makes the RAM disk. oops!). Incidentally, neither the romfs example nor my attempt to re-create it works in my sim: osboxes@osboxes ~/n/nuttx (master)> ./nuttx NuttShell (NSH) NuttX-12.0.0 nsh> romfs ERROR: Failed to create RAM disk: Unknown error nsh> rapp Starting Russells App 1... ERROR: Failed to create RAM disk: Unknown error nsh> I don't know how to debug this "unknown error". I guess I will try to find where that error message comes from and hook in GDB? I'm terrible at this stuff, someone needs to revoke my compiler license (tee hee). Cheers, Russ On Wed, Feb 1, 2023 at 7:29 PM Xiang Xiao wrote: > romfs is part of your image as the const string. There is no difference > from the below manual step. > > On Thu, Feb 2, 2023 at 10:00 AM Russell Haley > wrote: > > > On Tue, Jan 31, 2023 at 6:16 AM Fotis Panagiotopoulos < > f.j.pa...@gmail.com > > > > > wrote: > > > > > Hello, > > > > > > Indeed the "proper" way of including a script would be to store it in a > > > file system. > > > > > > However, when I needed to include a single and small script and I > didn't > > > want to introduce a complete FS just for this, I used xxd. > > > xxd can convert any file to a C header file. > > > > > > You can then include the header, and access the whole file as a > variable. > > > Here is an example: > > > > > > I added this in my app Makefile: > > > > > > # Setup any special pre-build context > > > context: header > > > $(Q) cd path/to/libs/json.lua/ && xxd -i json.lua > json_lua.h > && > > > echo -n "const " | cat - json_lua.h > temp && mv temp json_lua.h > > > > > > > > > > > > And then I used the file like this: > > > > > > #include "lua.h"#include "lauxlib.h"#include > > > #include "json_lua.h" > > > static int luaopen_json(lua_State * L); > > > > > > void ExtLibs_load(lua_State * L){ > > > // json.lua#ifdef CONFIG_EXT_LIB_JSON_LUA > > > luaL_requiref(L, "json", luaopen_json, 1); > > > lua_pop(L, 1);#endif} > > > > > > int luaopen_json(lua_State * L){ > > > const char * modname = lua_tostring(L, 1); > > > > > > if (strcmp(modname, "json") != 0) > > > return luaL_error(L, "cannot load json module"); > > > > > > if (luaL_loadbufferx(L, (char*)json_lua, json_lua_len, "json", > > > "t") != LUA_OK) > > > return lua_error(L); > > > > > > lua_call(L, 0, 1); > > > > > > return 1;} > > > > > > > > > I hope this helps... > > > > > That is very helpful, and not just for nuttx development! Thanks for the > > tip. > > > > The romfs example actually uses xxd as well to convert the filesystem > into > > hex code that is also stored in a header file. If I am reading the code > > correctly, the example app loads the entire filesystem into memory, which > > isn't very efficient and not at all what I wanted. Can someone tell me if > > that's true? > > > > Thanks, > > Russ > > > > > > > > > > > > > > On Sun, Jan 29, 2023 at 7:34 AM Xiang Xiao > > > wrote: > > > > > > > You can use the real file system on the device, there are many > choices: > > > > romfs, littlefs, fatfs, starmtfs and spiffs. > > > > > > > > On Sun, Jan 29, 2023 at 12:59 PM Russell Haley > > > > > wrote: > > > > > > > > > On Sat, Jan 28, 2023 at 7:35 PM Xiang Xiao < > > xiaoxiang781...@gmail.com> > > > > > wrote: > > > > > > > > > > > You can enable CONFIG_FS_HOSTFS/CONFIG_SIM_HOSTFS, put your > scripts > > > > into > > > > > > some PC folder and run mount this folder from nsh: > > > > > > mount -t hostfs -o fs=/path/to/your/pc/folder. /data > > > > > > > > > > > > While I appreciate the answer, I am using the sim as a testing > > > platform > > > >
Re: Including Lua scripts on filesystem
On Tue, Jan 31, 2023 at 6:16 AM Fotis Panagiotopoulos wrote: > Hello, > > Indeed the "proper" way of including a script would be to store it in a > file system. > > However, when I needed to include a single and small script and I didn't > want to introduce a complete FS just for this, I used xxd. > xxd can convert any file to a C header file. > > You can then include the header, and access the whole file as a variable. > Here is an example: > > I added this in my app Makefile: > > # Setup any special pre-build context > context: header > $(Q) cd path/to/libs/json.lua/ && xxd -i json.lua > json_lua.h && > echo -n "const " | cat - json_lua.h > temp && mv temp json_lua.h > > > > And then I used the file like this: > > #include "lua.h"#include "lauxlib.h"#include > #include "json_lua.h" > static int luaopen_json(lua_State * L); > > void ExtLibs_load(lua_State * L){ > // json.lua#ifdef CONFIG_EXT_LIB_JSON_LUA > luaL_requiref(L, "json", luaopen_json, 1); > lua_pop(L, 1);#endif} > > int luaopen_json(lua_State * L){ > const char * modname = lua_tostring(L, 1); > > if (strcmp(modname, "json") != 0) > return luaL_error(L, "cannot load json module"); > > if (luaL_loadbufferx(L, (char*)json_lua, json_lua_len, "json", > "t") != LUA_OK) > return lua_error(L); > > lua_call(L, 0, 1); > > return 1;} > > > I hope this helps... > That is very helpful, and not just for nuttx development! Thanks for the tip. The romfs example actually uses xxd as well to convert the filesystem into hex code that is also stored in a header file. If I am reading the code correctly, the example app loads the entire filesystem into memory, which isn't very efficient and not at all what I wanted. Can someone tell me if that's true? Thanks, Russ > > > > On Sun, Jan 29, 2023 at 7:34 AM Xiang Xiao > wrote: > > > You can use the real file system on the device, there are many choices: > > romfs, littlefs, fatfs, starmtfs and spiffs. > > > > On Sun, Jan 29, 2023 at 12:59 PM Russell Haley > > wrote: > > > > > On Sat, Jan 28, 2023 at 7:35 PM Xiang Xiao > > > wrote: > > > > > > > You can enable CONFIG_FS_HOSTFS/CONFIG_SIM_HOSTFS, put your scripts > > into > > > > some PC folder and run mount this folder from nsh: > > > > mount -t hostfs -o fs=/path/to/your/pc/folder. /data > > > > > > > > While I appreciate the answer, I am using the sim as a testing > platform > > > and hoping to move to either an STM32F4/7 or a Sony Spresense. I am > > hoping > > > for a solution that is applicable to an embedded project. If I can't > just > > > add files to the initial image then I will look at the romfs example > and > > > maybe the next best thing? > > > > > > > > > > > > > > On Sun, Jan 29, 2023 at 2:24 AM Russell Haley > > > > wrote: > > > > > > > > > Hi, > > > > > > > > > > Big thanks to Xiang Xiao for pointing me to the sim:lua > > configuration. > > > I > > > > > was unable to simply include the defconfig file that you linked to, > > > but I > > > > > was able to reconfigure for the sim:lua configuration. I've now > got > > an > > > > app > > > > > in the examples folder that includes the Lua interpreter. Is there > a > > > > > tutorial on how to include folders and lua scripts or extra files > in > > > the > > > > > initial file system? > > > > > > > > > > Much appreciated, > > > > > Russ > > > > > > > > > > > > > > >
Re: Including Lua scripts on filesystem
On Sat, Jan 28, 2023 at 7:35 PM Xiang Xiao wrote: > You can enable CONFIG_FS_HOSTFS/CONFIG_SIM_HOSTFS, put your scripts into > some PC folder and run mount this folder from nsh: > mount -t hostfs -o fs=/path/to/your/pc/folder. /data > > While I appreciate the answer, I am using the sim as a testing platform and hoping to move to either an STM32F4/7 or a Sony Spresense. I am hoping for a solution that is applicable to an embedded project. If I can't just add files to the initial image then I will look at the romfs example and maybe the next best thing? > > On Sun, Jan 29, 2023 at 2:24 AM Russell Haley > wrote: > > > Hi, > > > > Big thanks to Xiang Xiao for pointing me to the sim:lua configuration. I > > was unable to simply include the defconfig file that you linked to, but I > > was able to reconfigure for the sim:lua configuration. I've now got an > app > > in the examples folder that includes the Lua interpreter. Is there a > > tutorial on how to include folders and lua scripts or extra files in the > > initial file system? > > > > Much appreciated, > > Russ > > >
Including Lua scripts on filesystem
Hi, Big thanks to Xiang Xiao for pointing me to the sim:lua configuration. I was unable to simply include the defconfig file that you linked to, but I was able to reconfigure for the sim:lua configuration. I've now got an app in the examples folder that includes the Lua interpreter. Is there a tutorial on how to include folders and lua scripts or extra files in the initial file system? Much appreciated, Russ
Re: Lua fails to build
On Sat, Jan 28, 2023 at 3:18 AM Tim Hardisty wrote: > > On 28/01/2023, 08:51, "Russell Haley" wrote: > > > I am not receiving emails on this email account. > > I believe that the apache mail reflector is the root cause of this, if > emails are sent with a DKIM signature. The reflector adds new headers which > cause the DKIM signature to fail. Any email service that checks DKIM will > then reject the email as SPAM and may not even deliver it. Gmail is the > "worst" and unilaterally rejects emails for reasons of its own with no > rational explanation, for no technical reason, and no way to find out why. > I know this through bitter experience with our work email which rarely gets > through to any gmail recipient despite emails passing every deliverability > test I can find! > > I have moved to using my personal email for NuttX as that does not use > DKIM, and my emails now get through to most dev@NuttX subscribers. > My problem is that my own email (russ.ha...@winlua.net) is failing but I used to get the nuttx emails on that account. I am responding to you from gmail now, so gmail seems to work for me?
RE: Lua fails to build
Hi, I am not receiving emails on this email account. I see on the archive that Xiang Xiao has replied. I have checked my spam folder but it is empty. I had previously subscribed and un-subscribed to this list from this email address and I think maybe the mailing list is not sending the emails due to that previous cancelation? I have now subscribed from my gmail account and hope to have better luck. Regards, Russell Sent from Mail for Windows From: Russell Haley Sent: Thursday, January 26, 2023 9:37 PM To: dev@nuttx.apache.org Subject: Lua fails to build Hi, I am trying to build the Lua interpreter into the sim:nsh sample code using the menuconfig (Applications->Interpreters->Lua). The Lua interpreter seems to be missing libmath. I tried adding `CFLAGS += -lm` but it didn’t seem to help. Can anyone tell me how to add the Lua interpreter correctly? Thanks, Russ Build failure: … LD: nuttx CC: -x c allsyms.tmp /usr/bin/ld: nuttx.rel: in function `numarith': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lobject.c:80: undefined reference to `pow' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lobject.c:81: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `luaV_flttointeger': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:122: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `luaV_modf': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:755: undefined reference to `fmod' /usr/bin/ld: nuttx.rel: in function `luaV_execute': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:1372: undefined reference to `pow' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:1380: undefined reference to `floor' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:1430: undefined reference to `pow' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:1438: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `math_sin': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:41: undefined reference to `sin' /usr/bin/ld: nuttx.rel: in function `math_cos': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:46: undefined reference to `cos' /usr/bin/ld: nuttx.rel: in function `math_tan': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:51: undefined reference to `tan' /usr/bin/ld: nuttx.rel: in function `math_asin': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:56: undefined reference to `asin' /usr/bin/ld: nuttx.rel: in function `math_acos': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:61: undefined reference to `acos' /usr/bin/ld: nuttx.rel: in function `math_atan': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:68: undefined reference to `atan2' /usr/bin/ld: nuttx.rel: in function `math_floor': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:99: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `math_ceil': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:110: undefined reference to `ceil' /usr/bin/ld: nuttx.rel: in function `math_fmod': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:128: undefined reference to `fmod' /usr/bin/ld: nuttx.rel: in function `math_modf': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:147: undefined reference to `ceil' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:147: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `math_sqrt': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:157: undefined reference to `sqrt' /usr/bin/ld: nuttx.rel: in function `math_log': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:173: undefined reference to `log' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:178: undefined reference to `log2' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:181: undefined reference to `log10' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:183: undefined ref
Lua fails to build
Hi, I am trying to build the Lua interpreter into the sim:nsh sample code using the menuconfig (Applications->Interpreters->Lua). The Lua interpreter seems to be missing libmath. I tried adding `CFLAGS += -lm` but it didn’t seem to help. Can anyone tell me how to add the Lua interpreter correctly? Thanks, Russ Build failure: … LD: nuttx CC: -x c allsyms.tmp /usr/bin/ld: nuttx.rel: in function `numarith': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lobject.c:80: undefined reference to `pow' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lobject.c:81: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `luaV_flttointeger': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:122: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `luaV_modf': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:755: undefined reference to `fmod' /usr/bin/ld: nuttx.rel: in function `luaV_execute': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:1372: undefined reference to `pow' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:1380: undefined reference to `floor' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:1430: undefined reference to `pow' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lvm.c:1438: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `math_sin': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:41: undefined reference to `sin' /usr/bin/ld: nuttx.rel: in function `math_cos': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:46: undefined reference to `cos' /usr/bin/ld: nuttx.rel: in function `math_tan': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:51: undefined reference to `tan' /usr/bin/ld: nuttx.rel: in function `math_asin': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:56: undefined reference to `asin' /usr/bin/ld: nuttx.rel: in function `math_acos': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:61: undefined reference to `acos' /usr/bin/ld: nuttx.rel: in function `math_atan': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:68: undefined reference to `atan2' /usr/bin/ld: nuttx.rel: in function `math_floor': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:99: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `math_ceil': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:110: undefined reference to `ceil' /usr/bin/ld: nuttx.rel: in function `math_fmod': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:128: undefined reference to `fmod' /usr/bin/ld: nuttx.rel: in function `math_modf': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:147: undefined reference to `ceil' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:147: undefined reference to `floor' /usr/bin/ld: nuttx.rel: in function `math_sqrt': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:157: undefined reference to `sqrt' /usr/bin/ld: nuttx.rel: in function `math_log': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:173: undefined reference to `log' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:178: undefined reference to `log2' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:181: undefined reference to `log10' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:183: undefined reference to `log' /usr/bin/ld: /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:183: undefined reference to `log' /usr/bin/ld: nuttx.rel: in function `math_exp': /home/osboxes/nuttx86_64/apps/interpreters/lua/lua-5.4.0/src/lmathlib.c:190: undefined reference to `exp' /usr/bin/ld: nuttx.rel: in function `lua_array_length': /home/osboxes/nuttx86_64/apps/interpreters/luamodules/cjson/lua-cjson/lua_cjson.c:580: undefined reference to `floor' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:327: nuttx] Error 1 make[1]: Leaving directory '/home/osboxes/nuttx86_64/nuttx/arch/sim/src' make: *** [tools/Unix.mk:516: nuttx] Error 2 Sent from Mail for Windows
St-Link Issue
Hi there community, I have access to a couple of STM32F446RE Nucleo boards and wanted to get started with Nuttx. I was able to build the nucleo-f446re:nsh example code but I had a great deal of trouble running it because I was not able to gain access to the nsh shell. I say was, because I eventually did gain access. It turns out that I have two different kinds of nucleo boards but only one variant works. The main boards are all MB1136 Rev C (STM32F446RE), but the ST-Link attached to the boards is different. The ones that do not work say 1940 on the BACK of the ST-Link, where as the ones I can connect with say IQE 1915 on the FRONT of the ST-Link. So it appears that the older revision of ST-Link works, where as the newer revision does not? I am able to run the nsh example for now, but it would be good to know why the newer ST-Link doesn’t work, or even better, help to fix it. If anyone has suggestions please let me know. Thanks in advance, Russell Haley Sent from Mail for Windows
RE: NuttX Monthly Meetup
Sorry for the top posts, I’ll move to a new email client soon. I know nothing of the inclusivity rules, but Brave has just introduced an in browser video conference system that does not require a login. https://reclaimthenet.org/brave-introduces-brave-talk/ Might that help? Russell Sent from Mail for Windows From: Gregory Nutt Sent: Saturday, September 25, 2021 5:41 AM To: dev@nuttx.apache.org Subject: Re: NuttX Monthly Meetup I believe that the subject matter discussed in these meetings is inappropriate for an Apache project and must be stopped. The video conference is not fully open and it is not inclusive and it does not meet an of the requirements for use with an Apache project. On Sat, Sep 25, 2021 at 6:13 AM Alin Jerpelea wrote: > I am sorry if you feel like this. The meeting was open for anyone willing > to participate but we will stop the meetings if this is against the rules. > > Best Regards > Alin > > On Sat, Sep 25, 2021, 13:47 spudaneco wrote: > > > This is not "helping users", These are all project management topics. > > These kinds of discussions are not appropriate outside of ASF provided > > communication mechanism. You cannot create your own private project > > management team that excludes everyone else.Sent from my Galaxy > > Original message From: Alin Jerpelea < > jerpe...@gmail.com> > > Date: 9/25/21 1:11 AM (GMT-06:00) To: dev@nuttx.apache.org Subject: > Re: > > NuttX Monthly Meetup MOM jitsi meet 24.09.2021License updatesAlin asked > for > > contact ideas forHaltian and Omni Hooverboardswaiting for Adam Dunkels to > > answerhave an progress update regarding the license statusAlin is planing > > to create the next releasewe will start the release process for NuttX > 10.2 > > with mixed licensesAim to release NuttX 11.0 with Apache > licensesTodo:ping > > Bernan to create the release notes for NuttX 10.2New > > features/suggestionstoochain base on Clang. we should try to suport > > itimprove build time on non linux systemsexplore AI - tensorflow, NNabla > > interationexplore MicroROS integrationquestionaire to understand what OS > > are people usingwindows native / windows cygwin / linux / MacTopic for > the > > next meetingCmake - should we switch or not?October 22 next online > > MeetingOn Thu, Sep 23, 2021 at 5:35 AM Alin Jerpelea > > > wrote:> It is a an open meet and the plan is to discuss any topics (open > > issues,> plans, wishes)>> I will talk about license issues and next NuttX > > release>> On Wed, Sep 22, 2021, 21:41 Tim Hardisty > > wrote:>>> What sort of agenda, or purpose, > > Alan? Sounds like a good idea but some suggestion of what to expect > > would be>> good :) On 22/09/2021, 18:20, "Alan Carvalho de > Assis" < > > acas...@gmail.com>>> wrote: Dear NuttXers, We want to do > > monthly meets with our developers and users. The first online > meet > > will be this Friday (2021/09/24) at 18:00 GMT. Everybody can join > > using this link: https://meet.jit.si/NuttXMeetup > > BR, Alan>> >
RE: Poll: Which OS are you using to compile NuttX?
Thanks Alan, You are correct. I’m happy to join the group, but maybe best to move it for others. Cheers, Russ Sent from Mail for Windows From: Alan Carvalho de Assis Sent: Friday, September 24, 2021 1:19 PM To: dev@nuttx.apache.org Subject: Re: Poll: Which OS are you using to compile NuttX? Hi Russell, I think I know why it is happening: you are not in the NuttX Group in LinkedIn, are you? Let move it to other place... BR, Alan On 9/24/21, Russell Haley wrote: > Hi, > > That’s my point: the mothership is not giving me access through your link, > even though I am fully hive connected? (Is your link is broken or > restricted?) > > I use Linux (Ubuntu 20+ VM) for building nuttx. > > Any you think “Mail” is bad? Just think what they collect from VS Code! > > Russ > Sent from Mail for Windows > > From: Alan Carvalho de Assis > Sent: Friday, September 24, 2021 1:08 PM > To: dev@nuttx.apache.org > Subject: Re: Poll: Which OS are you using to compile NuttX? > > Sorry guys, I suppose you are using LinkedIn too. > > Yes, probably it will collect some data from you, but you are using a > better MS gather: > > "Sent from Mail for Windows" > > So, if you are already in the hell, please give a warm hug in the Lucifer > :-D > > Now, let be serious here: for those who don't have LinkedIn access, > please reply this email with one of these options: > > 1) Linux > 2) MacOS > 3) Windows using Cygwin > 4) Windows Native > > Thank you for the understanding. > > BR, > > Alan > > On 9/24/21, Russell Haley wrote: >> The link gives me “This post cannot be displayed”. I am logged into the >> Microsoft data collection site known as LinkedIn. >> >> Sent from Mail for Windows >> >> From: Tim Hardisty >> Sent: Friday, September 24, 2021 12:54 PM >> To: dev@nuttx.apache.org >> Subject: Re: Poll: Which OS are you using to compile NuttX? >> >> Needs a LinkedIn login? >> >> >> >> From: Alan Carvalho de Assis >> Reply to: "dev@nuttx.apache.org" >> Date: Friday, 24 September 2021 at 20:20 >> To: dev >> Subject: Poll: Which OS are you using to compile NuttX? >> >> Hi Everyone, Please help us to discover which OS people are using most to >> compile NuttX: >> https://www.linkedin.com/feed/update/urn:li:activity:6847246067046596609/ >> It >> will help us to decide how better support your host OS. BR, Alan >> >> > >
RE: Poll: Which OS are you using to compile NuttX?
Hi, That’s my point: the mothership is not giving me access through your link, even though I am fully hive connected? (Is your link is broken or restricted?) I use Linux (Ubuntu 20+ VM) for building nuttx. Any you think “Mail” is bad? Just think what they collect from VS Code! Russ Sent from Mail for Windows From: Alan Carvalho de Assis Sent: Friday, September 24, 2021 1:08 PM To: dev@nuttx.apache.org Subject: Re: Poll: Which OS are you using to compile NuttX? Sorry guys, I suppose you are using LinkedIn too. Yes, probably it will collect some data from you, but you are using a better MS gather: "Sent from Mail for Windows" So, if you are already in the hell, please give a warm hug in the Lucifer :-D Now, let be serious here: for those who don't have LinkedIn access, please reply this email with one of these options: 1) Linux 2) MacOS 3) Windows using Cygwin 4) Windows Native Thank you for the understanding. BR, Alan On 9/24/21, Russell Haley wrote: > The link gives me “This post cannot be displayed”. I am logged into the > Microsoft data collection site known as LinkedIn. > > Sent from Mail for Windows > > From: Tim Hardisty > Sent: Friday, September 24, 2021 12:54 PM > To: dev@nuttx.apache.org > Subject: Re: Poll: Which OS are you using to compile NuttX? > > Needs a LinkedIn login? > > > > From: Alan Carvalho de Assis > Reply to: "dev@nuttx.apache.org" > Date: Friday, 24 September 2021 at 20:20 > To: dev > Subject: Poll: Which OS are you using to compile NuttX? > > Hi Everyone, Please help us to discover which OS people are using most to > compile NuttX: > https://www.linkedin.com/feed/update/urn:li:activity:6847246067046596609/ It > will help us to decide how better support your host OS. BR, Alan > >
RE: Poll: Which OS are you using to compile NuttX?
The link gives me “This post cannot be displayed”. I am logged into the Microsoft data collection site known as LinkedIn. Sent from Mail for Windows From: Tim Hardisty Sent: Friday, September 24, 2021 12:54 PM To: dev@nuttx.apache.org Subject: Re: Poll: Which OS are you using to compile NuttX? Needs a LinkedIn login? From: Alan Carvalho de Assis Reply to: "dev@nuttx.apache.org" Date: Friday, 24 September 2021 at 20:20 To: dev Subject: Poll: Which OS are you using to compile NuttX? Hi Everyone, Please help us to discover which OS people are using most to compile NuttX: https://www.linkedin.com/feed/update/urn:li:activity:6847246067046596609/ It will help us to decide how better support your host OS. BR, Alan