nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.64k stars 3.12k forks source link

Add modules to luac.cross which do not have hardware dependencies #3229

Open HHHartmann opened 4 years ago

HHHartmann commented 4 years ago

Missing feature

Use non HW dependent modules in luac.cross

Modules are at least: struct.c bit.c color_utils.c sjson.c // work without problems bloom.c crypto.c encoder.c // would need some more work

Justification

help creating tests and allow usage of known functionality on the host.

Workarounds

none

pjsg commented 4 years ago

file could be added without much difficulty.

TerryE commented 4 years ago

The luac.cross environment already supports os and io. I did look at adding file but decided that given we already support io, I could not see the point of doing this dev work.

struct since this is already implemented in the Lua 5.3 string library (see String pack and unpack), so it is really redundant in a 5.3 world.

Ditto for deprecating bit as these bitwise operations are natively supported in Lua 5.3.

sjson and possibly crypto.c encoder.c might make sense, but I see the main potential advantage if we have some form of LFS object so that we can use the -e option to generate Protos for saving in a multi-TLF compiled file. This way developers could create resource functions. But let me get on-ESP LFS update and two LFS regions working first, eh? Because this is going to rework luac.cross quite a lot.

HHHartmann commented 4 years ago

file could be added without much difficulty.

Hmm file depends on vfs which operates on SPIFFS or FAT. SPIFFS uses platform_flash_read/write to access the storage. So some work to add another blockdevice would be necessary.

TerryE commented 4 years ago

@HHHartmann Gregor, as I said: we already have io for host filesystem I/O. The one potential use for file that could be of benefit is as a wrapper around SPIFFS the same way that spiffsimg does. This way you could use Lua scripts to provision a SPIFFS on host. A well-scoped and entirely doable little project: use io to access the host FS and file to access a host-based SPIFFS image.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

HHHartmann commented 2 years ago

Still would like the associated PR to get in. Is anybody willing to back this?