by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Terry Ellison
    @TerryE
    See Wikipedia article on this. In fact the smallest write we do is 1 bit.
    There is an overhead with writing, as the ICache is disabled by the SDK during the flash write and hence write to flash has a per record overhead. The block size is somewhat arbitrary, and is as compromise between reducing the per write overheads and RAM needed.
    Thomas Jakober
    @tjakober
    I am struggling with the new ESP32 time module. When I set the timezone to EST I get one hout less than it is actually. When I set it to UTC+1 which should be equivalent to EST, I get two hours less. Only when I set it to UTC-1 I get the correct time. I am in Switzerland and we currently do not have DST. What I am thinking wrong?
    Thomas Jakober
    @tjakober
    I have also another problem: How can I clear the wifi configuration? The previous wifi.sta.clearconfig() does'nt exist anymore. And even wifi.sta.disconnect() does not work:
    KT819GM
    @KT819GM
    try wifi.setmode(wifi.NULLMODE, true) to see if it will clear wifi credentials
    Thomas Jakober
    @tjakober
    No after this and then revert to station mode it connects again to the previous ap
    KT819GM
    @KT819GM
    after that you should do restart, not go back to STA, but still it’s highly possible that on esp32 it will not work :(
    Thomas Jakober
    @tjakober
    After restart it goes to nullmode but after setting station mode it connects anyway
    M.K.
    @mk-pmb
    hi :)
    What are the technical reasons we have to decide at compile time which modules we want to include?
    Could we move towards something like Dynamic Kernel Module Support?
    Maybe have a directory modules/ in the flash file system and at boot time inject modules/*.so into the firmware memory? (I'd like it to ignore subdirs, reasons on demand.)
    What would it take to also make the firmware provide an additional USB endpoint that offers the flash file system as a mass storage device?
    KT819GM
    @KT819GM
    About USB endpoint - it’s hardware limitation on esp8266 (and current esp32) in first place, as you can't translate 5V signals into 3V ones in firmware. Or you mean to use USB to UART like cp2102 and somehow mount it as disk?
    KT819GM
    @KT819GM
    And technical reasons should be obvious - you have limited ram and storage and you can’t recompile firmware to add C modules on mcu itself. But it’s possible to add / remove Lua modules on the fly. But maybe I’m wrong.
    M.K.
    @mk-pmb
    Originally I meant using the USB port that I use to power it and upload the firmware. My board looks very similar to this: http://www.nodemcu.com/images/thumbnail/z1s_1.jpg_450x300.jpg but if we can afford the resources to run a second USB device personality, it would sound interesting to do that. I do have a 2 port logic level converter circuit board.
    were your "obvious" reasons meant for doing the DKMS compile on the MCU itself? yeah that was so obviously wasteful I didn't even consider it as the goal. :-) I meant it just as a direction, and I also now I see it was a misleading one because turns out you don't even need DKMS just to load kernel modules at runtime, sorry. I had just that latter part in mind, loading pre-compiled additional drivers from the flash disk at boot, so toggling a vendor-specific module would be just rename a file and reboot.
    M.K.
    @mk-pmb
    more importantly, you could easily free up space of unused modules, and upload new ones.
    KT819GM
    @KT819GM
    I think it’s not possible to mount it as disk trough uart, thats why I wrote “somehow". Software like nodemcu-uploader, nodemcu-tool exists for exact this purpose - to upload file into spiffs. With Lua it’s a bit different development metodology, usually you create “bones" - firmware with modules predefined modules which you cant replace with Lua code, and you modify / update just Lua parts trough cable / air. All goes fast and painless. I trully understand what your point is, but I doubt that even ecosystems like arduino / mbed have this “modules / dependencies on the fly” feature.
    M.K.
    @mk-pmb
    emulating traditional USB mass storage would have been just a nice bonus, and I can replace that with a specialized virtual file system driver on the host (i.e. FUSE in my case).
    I'm trying however to make the build process as simple as possible, so people can just get started and postpone as many decisions as possible. especially don't have to worry about backupping their flash-stored files just to try a new module for whatever latest blinkentoy vendor.
    ideally we could get down to one firmware image per CPU architecture and number type (int/float) and people with more flash will just have more flash storage, then put the optional modules there.
    thinking of it, that would even enable me to change modules via wifi, that would be a LOT cooler.
    KT819GM
    @KT819GM
    With LFS I think it’s now possible to load almost all C modules into firmware and run code from LFS. You can change Lua code trough wifi easily, like trough FTP.
    think of this - how many times you need to remove / add module ads1115.c from firmware?
    x^n times less than updating your lua code, which you can update in any way you like
    HTTP_OTA Lua module as example will take your LFS and update it for you, you choose how to launch it
    M.K.
    @mk-pmb
    yeah that's a good step in the right direction already. as I understood it though, LFS only works for ESP32, right?
    KT819GM
    @KT819GM
    no
    it’s for ESP8266 mainly because of ram
    M.K.
    @mk-pmb
    oh ok thanks! then I shall have a look again. still, most of the vendor modules are in C it seems.
    KT819GM
    @KT819GM
    besides, if you leave filesystem size and boundaries untouched, you even can update firmware and it will leave your spiffs untouched
    they are working on the direction to replace as many C modules as possible to Lua ones
    from what I see
    M.K.
    @mk-pmb
    yeah, under optimal circumstances. it's a bit like knowing how to backup your partition table and a binary image of your OS boot drive makes it a lot easier to experiment with exotic boot loaders. people new to the field rightfully assume a risk of data loss if they try it.
    transfering most modules to LUA sounds like a good idea independently. still, wouldn't it be great to have the capability to change selection of C modules after firmware compile time? would you consider it useless? would it be useful but way to hard to do?
    if I tried myself, could I start by just adding a buffer overflow vuln and then have some exploit framework inject the module code, or is a firmware fundamentally different in that attack vector?
    oh I see that would not survive reboots.
    M.K.
    @mk-pmb
    I should probably leave the task of fetching the bytecode to a LUA script, and try to write a C module that just injects bytecode.
    if it works as planned, people could even download it via wifi without reboot and without requiring flash file memory. (unloading and cleanup might be trickier, dunno.)
    M.K.
    @mk-pmb
    Research notes in case someone else wants to continue later:
    M.K.
    @mk-pmb
    Has anyone tried to load the C modules via LUA require yet? I'm rather noob with both C and LUA but it seems LUA is especially designed to help with this.
    Gregor Hartmann
    @HHHartmann
    It sure would be nice to be able to load c libraries at runtime. But keep in mind that there are only about 40k of ram available on the esp8266. LFS was invented to keep the lua code out of ram to have some more space for application data.
    There is a partition table containing entries for SPIFFS, firmware, LFS and others. As long as your new firmware fits in the existing partition the files on SPIFFS will survive.
    Gregor Hartmann
    @HHHartmann
    There are plans to implement updating the firmware over the air. But this will take some more time.
    M.K.
    @mk-pmb
    Is there way more overhead when loading the lib at runtime, rather than compiling it into the firmware? I'd have thought it takes just a table of function name + pointer for each extern function, can't imagine that would be very much data.
    oh did you mean that any C code loaded has to go to RAM, whereas LUA code can reside on flash, and thus LUA code will always be cheaper than a C module?
    in that case it might be worth trying to invest a few of the precious RAM bytes in a swap mechanism.
    … which probably won't work without hardware support like a Memory Management Unit.
    KT819GM
    @KT819GM
    LFS play kind a swap (read-only) role for Lua. About C modules, still, it’s easy to build firmware and easy to reload it. You barely need to change C modules at all to be honest. On my daily test unit I have 35 C modules enabled and I still get more than 32K free ram on latest dev. Firmware compile / chip erase / firmware write / LFS load / init.lua is a one-liner bash script.
    M.K.
    @mk-pmb
    ok then I'm probably overthinking it and we should just rewrite the beginner's guide some time to make it sound less complicated. after all, having to decide the module selection upfront, before I had any idea about MCUs at all, was what had turned me away at first. only came back because MicroPython still doesn't have the features I want.
    back then especially because I had no way to export/import my module selection in the cloud build service to incrementally refine my selection, I'd have had to fill the entire form again for each attempt. at least that's going to be easier soon.
    KT819GM
    @KT819GM
    You sound like a linux guy, isn't native or docker ways looks to you complicated? Mostly 2 files need editing before compile: user_config.h and user_modules.h everything well commented inside files