Avatar for tve

tve

Member since Sep 2015 • Last active Mar 2019
  • 41 conversations
  • 465 comments

Most recent activity

    • 7 comments
    • 631 views
  • in ESP8266
    Avatar for tve

    I like to save code to Storage and than require it, this save a big amount of vars.

    @MaBe, can you explain the advantages of your scheme over what I'm using? It's quite a bit of additional work.

    It is actually linked quite a bit (FAQ,Troubleshooting,Quick start, etc). But where did you look where it wasn't mentioned and I'll get a link added.

    Hmmm, my bad. I could swear that typing 'saving' into the search box brought up nothing, but now it does, so I must have been too tired to see it or something... I mainly looked around in the tips&tricks, tutorials, modules, and esp8266 pages.

  • in ESP8266
    Avatar for tve

    After being away for a year it's nice to see all the progress on Espruino!

    I did struggle for quite some time to update my stuff and to get my code working again under V2.01, so I thought I'd write up a quick how-to so I remember the next time I try to do something :-) Maybe it also helps someone else 'cause very little of this is spelled out anywhere that I could find (the best info is at http://www.espruino.com/Saving but that page is not linked to from any other page on http://www.espruino.com!)

    Requirements:

    • I have a bunch of apps that are fairly large and must run from flash.
    • I use local modules.
    • The apps must run auto-run at boot time.
    • I prefer CLI over the IDE.

    I couldn't do an OTA update from pre-V2 of Espruino to V2.x due to a changed flash layout (512 vs 1024KB partitions). I have esp-12e modules with 4MB flash, so I installed the official espressif tool https://github.com/espressif/esptool/ and flashed using:

    esptool -p /dev/ttyUSB0 write_flash --flash_size 4MB-c1 --flash_mode qio 0 espruino_2v01_esp8266_4mb_combined_4096.­bin
    

    In the IDE I had to set the options SAVE_TO_FLASH to 1 and MODULE_AS_FUNCTION to true. But I don't want to use the IDE...

    So I installed the espruino cli:

    • Install node.js version 8 (old!), I'm using Linux and untarred the binary archive from the node.js site in /home/sw/node-v8 (non-std location, use any dir you like)
    • Install espruino using /home/sw/node-v8/bin/npm install espruino

    In order to ensure that I can run the cli using node-v8, I created a little shell script I call espruino-v8:

        #! /bin/bash
    export NODEJS_HOME=/home/sw/node-v8/bin
    export PATH=$NODEJS_HOME:$PATH
    espruino --no-ble --config SAVE_ON_SEND=1 --config MODULE_AS_FUNCTION=true "$@"
    

    To flash an application I have the main file in a projects subdirectory and the modules in a modules subdirectory. I simply require(...) the module in the main file. The flashing command is:

    ./expruino-v8 -p tcp://esp8266.local:23 -w -m projects/foo.js
    

    The -w option means that espruino stays connected and shows me the console output.

    The application uses an onInit() to start and that gets invoked automatically at the end of the upload.

    • 9 comments
    • 1,650 views
    • 197 comments
    • 43,643 views
  • in ESP8266
    Avatar for tve

    You can use the main UART to attach a peripheral, but it's somewhat tricky. You will get stuff printed on it at boot, so your periph better be able to ignore that. My onInit() function when using a nextion display attached to uart0 contains:

      // change logging so we don't clobber the nextion display on uart0
      esp8266.setLog(3); // log to memory and 2:uart0 3:uart1
      console.log("Bye bye...");
      Serial2.setConsole(false)
    

    The way I use it is to upload the code using telnet, so I see the "Bye bye..." printed via telnet when I run onInit() manually. By setting Serial2 as console the characters get dropped. By not forcing the console to stick to Serial2 I can telnet into the espruino at any time and have the console back. This has worked quite well for me.

  • in ESP8266
    Avatar for tve

    Make sure you turn the debug output off. esp8266.setLog(0) or esp8266.logDebug(false)
    I use an MCP23008 just fine, but not on gpio0 or gpio2...

  • in ESP8266
    Avatar for tve

    dump ends up writing to the UART non-stop at whatever rate the UART cranks stuff out until the WDT hits and then the esp resets. If you can increase the baud rate you may get more.
    Unfortunately there is no easy fix.

  • in ESP8266
    Avatar for tve

    Mhh, I think some guy on the internet wrote a free book on the esp8266, I think he goes by 'nkolban', you should take a look at his book ;-)
    The esp-01 modules have 512KB flash. The flash layout is described in https://github.com/espruino/EspruinoDocs­/blob/master/boards/EspruinoESP8266.md#f­lash-map-and-access as far as I can tell, people, especially beginners are still using these routinely.
    On larger modules we could use 1MB. On modules 2MB and up there's a layout that supports OTA with 1MB partitions. This is all described in Espressif's "user guide" or "OTA guide". But it's not just a matter of flipping a switch, there are a whole bunch of places that need changes, so to use that someone would really have to roll up their sleeves and make all the changes and get them reviewed.

  • in ESP8266
    Avatar for tve

    Good question, how does your output differ from the travis build? iram1_0_seg I believe is the 32KB of static instruction ram. They actually freed up some space there with SDK2 so I wonder what's going wrong for you. Nothing has changed in that area in Espruino in a while.

Actions