Page 5 of 7
Posted: Tue Jan 03, 2017 8:30 pm
Wow ... that was a blunder. The RMT.js should indeed be in the filesystem folder. The change will be in the next Github push ... thanks for that.
The Serial console is present and working ... just not documented yet. At a high level, when ESP32-Duktape boots, it will check an NVS value (namespace: esp32duktape, name: useSerial) and if the value is 1, it will NOT start bootWifi and the IDE but instead it will run the script called "uart_processor.js". This will start monitoring UART 2 (I believe it was 2) ...
When an HTTP request is made down UART 2 (HTTP seemed as good a protocol as any) then it will be "run" as a script. See the example under "tools" directory.
As you can see ... its all very rough around the edges. My hope was that by switching off WiFi and web server, I could scare up enough RAM to get Bluetooth working under JS ... unfortunately that isn't going to happen soon ... with my minimal environment, after loading Duktape, the best I can get (so far) is 70K free and switching on BT wants to eat 64K ... and that doesn't leave enough. So for the time being, JS and BT aren't going to play well together.
Posted: Tue Jan 03, 2017 9:39 pm
After I have run the make in tools and started node uartScriptRunner.js -f txt.txt I got this:
Code: Select all
D (323688) log: Parsing completed
D (323689) log: Our accumulated data is: console.log("Hello!");
console.log("Free heap: " + ESP32.getState().heapSize);
D (323695) log: Command is: RUN
D (323707) modules: >> js_console_log called
D (323708) log: Console: Hello!
D (323709) modules: >> js_console_log called
D (323709) log: Console: Free heap: 72472
D (323720) log: We are ready to start parsing
I tried first with f but it did not work, then with -f and it ran.
Posted: Thu Jan 05, 2017 2:20 pm
Hi Neil, excellent stuff, i particularly like the concept of bootstrapping a JS interpreter, and then building on that with JS.
Presumably once we figure out how to integrate sourcemaps and commonjs modules, then the whole NodeJs ecosystem becomes available (subject to platform constraints of course).
I've ordered boards from Aliexpress and Sparkfun, looking forward to helping you with this.
ps: really enjoying your latest book, thanks for that!
Posted: Fri Jan 06, 2017 3:20 am
So there is good hope there ... In addition ... there is talk about a 4MByte RAM module for ESP32 coming 3Q17 which may make ALL these issues just disappear. My thinking is we'll keep plowing ahead with the assumption that one way or another the memory issues will resolve.
Posted: Sat Jan 07, 2017 4:56 am
Project Status: 2017-01-06
With the release of the I2C driver as part of the ESP-IDF, a first pass was made to integrate I2C support. Thankfully that worked first time with no serious issues. A world of questions was generated on I2C support though which will hopefully become clearer over time.
In other news, outbound SSL integration was added using the ESP-IDF "mbedtls" libraries. It took a bit of tinkering but in the end it worked out well. However, the persistent problem of available memory continues to plague us. Using SSL out of the box seems to want between 20K-40K per active connection. Combine that with a WiFi stack and Duktape ... and again we run out of RAM. Our sensitivity to low RAM continues to haunt us ... it means that we can't "sensibly" use SSL the way we want. We can disable a bunch of duktape memory consumers such as stack trace and line number recording which reduces RAM usage and gets SSL going happily, but I'd rather not have to perform these tasks. Hope springs eternal for Duktape memory reductions. Bluetooth is also unable to run properly because of RAM needs.
Thankfully, I2C wasn't a RAM user so anyone wanting high level access to I2C shouldn't have an issue.
And that's about it for this week. When SPI becomes available, we will add that too.
Posted: Wed Jan 11, 2017 5:28 pm
SPI support added
Docs for the SPI module can be found here:https://github.com/nkolban/duktape-esp3 ... ses.md#spi
A sample showing driving a 8 digit LED counter can be found here:https://github.com/nkolban/duktape-esp3 ... max7219.js
Hopefully as you can see, assembling solutions is becoming easier and easier (ignore the rats nest of wires on the breadboard ... all we actually need are 3 for this project - CLK, MOSI and CS ... plus a current source).
Posted: Tue Jan 17, 2017 1:18 pm
Today's download gives me 2 errors.
I have tried to change the lines, but the file is auto generated again, so what to do?
Code: Select all
In file included from /home/poul/Programmer/Duktape32/duktape-esp32/components/duktape/extras/module-duktape/duk_module_duktape.c:5:0:
/home/poul/Programmer/Duktape32/duktape-esp32/components/duktape/extras/module-duktape/duk_module_duktape.c: In function 'duk__resolve_module_id':
/home/poul/Programmer/Duktape32/duktape-esp32/components/duktape/src/duktape.h:453:127: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
(duk_error_raw((ctx), (duk_errcode_t) (err_code), (const char *) (DUK_FILE_MACRO), (duk_int_t) (DUK_LINE_MACRO), __VA_ARGS__), (duk_ret_t) 0)
/home/poul/Programmer/Duktape32/duktape-esp32/components/duktape/extras/module-duktape/duk_module_duktape.c:175:2: note: in expansion of macro 'duk_error'
duk_error(ctx, DUK_ERR_TYPE_ERROR, "cannot resolve module id: %s", (const char *) req_id);
/home/poul/Programmer/Duktape32/duktape-esp32/components/duktape/extras/module-duktape/duk_module_duktape.c: In function 'duk__require':
/home/poul/Programmer/Duktape32/duktape-esp32/components/duktape/src/duktape.h:445:23: error: right-hand operand of comma expression has no effect [-Werror=unused-value]
(duk_throw_raw((ctx)), (duk_ret_t) 0)
/home/poul/Programmer/Duktape32/duktape-esp32/components/duktape/extras/module-duktape/duk_module_duktape.c:427:2: note: in expansion of macro 'duk_throw'
duk_throw(ctx); /* rethrow original error */
cc1: some warnings being treated as errors
/home/poul/Programmer/Duktape32/esp-idf/make/component_wrapper.mk:176: recipe for target 'extras/module-duktape/duk_module_duktape.o' failed
make: *** [extras/module-duktape/duk_module_duktape.o] Error 1
/home/poul/Programmer/Duktape32/esp-idf/make/project.mk:382: recipe for target 'duktape-build' failed
make: *** [duktape-build] Error 2
Posted: Tue Jan 17, 2017 6:44 pm
To hear is to obey. I was able to track down the breakages and affect repairs. If you could refresh from Github and try again ... if there are more problems, let me know ASAP. I had exactly the same problems as you reported ... so I am quietly hopeful that the fixes on my environment will translate to fixes on yours.
Posted: Sat Jan 21, 2017 11:30 pm
Project status: 2017-01-21
Progress continues. A new build/compiled release has been distributed with all the latest goodies ... see:https://github.com/nkolban/duktape-esp3 ... llation.md
Posted: Mon Jan 23, 2017 12:34 am
Video: ESP32-Duktape as a Web Server
New You Tube video now available showing ESP32-Duktape as a web server.https://www.youtube.com/watch?v=DsuDcYnQB2U