JavaScript on ESP32 - Duktape

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: JavaScript on ESP32 - Duktape

Postby kolban » Sat Dec 17, 2016 4:39 pm

Thank you Mr shadow,

The JavaScript environment continues to be my pet and hobby project. If you or anyone else get interested in it, you will find that I will make time to work with you to get it running and chat about it. Collaborators and commenters are very welcome. This is a long-haul project and not "one and done".
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

jimbob
Posts: 29
Joined: Fri Aug 05, 2016 10:47 pm

Re: JavaScript on ESP32 - Duktape

Postby jimbob » Mon Dec 19, 2016 10:39 am

Hello,

I'd be very interested in lending a hand -- currently really busy, but hopefully in the new year I'll have some time to help.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: JavaScript on ESP32 - Duktape

Postby kolban » Thu Dec 22, 2016 6:29 pm

Project status 2016-12-22 and request for testers

Howdy folks,
We have reached a reasonable level of stability and are ready to let some early folks get their hands on it. We are also writing up guides and documentation. See for example:

https://github.com/nkolban/duktape-esp3 ... llation.md

The technical status of the project is good. We have received a wonderful amount of support from the primary developer and owner of Duktape (JavaScript engine) and he has dramatically reduced RAM overhead meaning that there are lost more for our applications. There is also the hope for a lot more reduction to come.

The notion of using JavaScript to host the JavaScript framework above the native C JavaScript engine is working out well. Now that the engine and framework is in place we can start accelerating our ESP32 functional exploitation.

At this stage, I'm looking for some volunteers to get copies of the ESP32-Duktape flashable images. If you would like to assist, I will give you the ESP32 binaries and together we will flash those onto your ESP32 and get you up and running. No skills needed on your part other than either the ability to write simple JavaScript scripts or the desire to learn to do that. I'm not yet making the binaries publicly available as they haven't been tested on mass audiences yet and I'd prefer to personally assist you to learn what is working and what is not. If you contact me, I'll send you a link to download the binaries and make myself highly available for email, live IRC or Skype chat or other levels of assistance.

I'm hoping a few of you good folks will be willing to assist in the testing. You would truly be helping me out. I can be reached directly via:

* email: kolban1@kolban.com
* skype: neil.kolban
* Internet Relay Chat (IRC) on channel #ESP32 as user "kolban"

Ping anytime ...

Neil
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: JavaScript on ESP32 - Duktape

Postby kolban » Sat Dec 24, 2016 5:44 pm

Tutorial video on installing ESP-32 Dukatpe

Howdy folks,

We've put together a You Tube video (10 minutes) on installing ESP32-Duktape on your ESP32. The video can be found here:

https://www.youtube.com/watch?v=LGRFASrYrZc

In addition, there is now a documentation page on installing ESP32-Duktape that can be found here:

https://github.com/nkolban/duktape-esp3 ... llation.md

As always, any problems or questions, post here and we'll get back to you as soon as we can.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
Frida854
Posts: 14
Joined: Sat Dec 24, 2016 11:51 am
Location: Middelfart, Denmark

Re: JavaScript on ESP32 - Duktape

Postby Frida854 » Sun Dec 25, 2016 12:14 am

I have now compiled your source, and installed that on my "WIPY2.0", incl. file system, and are now running via web ide. Now I am ready to. explore and test your system. The first thing I like to test is input/output to pins.
Yes Frida is my watchdog!

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: JavaScript on ESP32 - Duktape

Postby kolban » Sun Dec 25, 2016 4:43 pm

Awesome. My first goal was to ensure that good folks like yourself can get the software running ... and now that we are making progress on that, we can start to go to the next level. I am working on documentation and my efforts can be found in this directory:

https://github.com/nkolban/duktape-esp3 ... aster/docs

Of those, some are in better state than others ... but all are being improves as fast as we can. Of these, the most important is one called "classes.md"

https://github.com/nkolban/duktape-esp3 ... classes.md

This is a first pass at documenting the classes exposed through the framework.

In there we will find a class called GPIO:

https://github.com/nkolban/duktape-esp3 ... es.md#gpio

I'm also trying to put together tests and samples ... a GPIO test can be found here:

https://github.com/nkolban/duktape-esp3 ... _blinky.js

Here is the reproduced code:

Code: Select all

var GPIO = require("gpio.js");
var pin = new GPIO(18);
var level = true;
pin.setDirection(GPIO.OUTPUT);
setInterval(function() {
	pin.setLevel(level);
	level = !level;
}, 1000);
This pulses GPIO pin 18 on and off once a second.

Some functions are in better shape than others ... again, this project is still being cooked and there is lots still to be done. Feedback and comments welcome so that we know what to focus upon ... and its a fully open source project ... so if anyone wants to join in, feel very welcome.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: JavaScript on ESP32 - Duktape

Postby loboris » Mon Dec 26, 2016 12:56 am

Congratulations on the great work.
I've tried to build from sources and all went without a problem.
First impressions are very good, I hope more modules and features will be added soon.
I suggest that you add flashing of the file system images to makefile, something like:

Code: Select all

#
#  Perform flashing of both ESPFS and SPIFFS to ESP32
#
flashdata: images
	echo "Flashing both ESPFS and SPIFFS to ESP32"
	$(ESPTOOLPY_WRITE_FLASH) --compress 0x360000 build/espfs.img
	$(ESPTOOLPY_WRITE_FLASH) --compress 0x180000 build/spiffs.img

#
#  Build all, flash app & flash both ESPFS and SPIFFS to ESP32
#
flashall: images all flash
	echo "Flashing both ESPFS and SPIFFS to ESP32"
	$(ESPTOOLPY_WRITE_FLASH) --compress 0x360000 build/espfs.img
	$(ESPTOOLPY_WRITE_FLASH) --compress 0x180000 build/spiffs.img
I think it is better than using the included scripts.
I have also configured flash mode to "qio/80MHz" and the difference in speed is noticeable.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: JavaScript on ESP32 - Duktape

Postby kolban » Mon Dec 26, 2016 12:05 pm

Thank you sir,
I added the Make additions into the Makefile and they'll be there in the next Github commit. Your fragments worked perfectly 1st time. As for the "qio/80MHz", to be honest, Ive no idea what that does. To increase flash speed, I've always set the baud rate to "921600". I wonder what "qio/80MHz" does?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: JavaScript on ESP32 - Duktape

Postby WiFive » Mon Dec 26, 2016 12:54 pm

kolban wrote:Thank you sir,
I added the Make additions into the Makefile and they'll be there in the next Github commit. Your fragments worked perfectly 1st time. As for the "qio/80MHz", to be honest, Ive no idea what that does. To increase flash speed, I've always set the baud rate to "921600". I wonder what "qio/80MHz" does?
Qio is quad spi mode and 80MHz is spi clock meaning all spi flash operations are faster

User avatar
Frida854
Posts: 14
Joined: Sat Dec 24, 2016 11:51 am
Location: Middelfart, Denmark

Re: JavaScript on ESP32 - Duktape

Postby Frida854 » Mon Dec 26, 2016 3:31 pm

I have truble with the latest "git pull".
In file: duktape-esp32/main/dukf_utils.c on

Code: Select all

line 41 LOGD("%s: heapSize=%d", localTag, dukf_get_free_heap_size(); , it seems to be missing the closing ')'

line 114 	LOGD(">> dukf_loadFile: (ESPFS) %s, heapSize=%d", path, dukf_get_freeHeap()); , it cant find the name, but this one exist 'dukf_get_free_heap_size()'
I corrected the lines, and it compiles ok, but I cant start the webide.

The last lines from console:

Code: Select all

D (41675) module_os: << js_os_send
D (41678) module_fs: >> js_fs_readSync
D (41680) module_fs: Buffer pointer size returned as 128
D (41685) duktape_spiffs: >> read fd=1, dst=0x3ffc3a84, size=128
D (41691) duktape_spiffs: vfs_read(SPIFFS): We read 128 
D (41696) module_fs: << js_fs_readSync: sizeRead: 128
D (41702) log: Size read: 128
D (41705) module_os: >> js_os_send
D (41706) module_os: About to send 128 bytes of data to sockfd=2
D (41712) module_os: - data: "he JavaScript editor used in this project is: https://ace.c9.io

Neil Kolban, 2016

 -->
<html lang="en">
<head>
<title>ESP32 - "

Yes Frida is my watchdog!

Who is online

Users browsing this forum: No registered users and 10 guests