JavaScript on ESP32 - Duktape

Posts: 1
Joined: Thu Jul 27, 2017 3:41 pm

Re: JavaScript on ESP32 - Duktape

Postby TimHaines » Thu Jul 27, 2017 3:47 pm

I'm having the following issue:

Code: Select all

$ make
CC duktape_main.o
AR libmain.a
LD esp32-duktape.elf
C:/esp/proto/build/main\libmain.a(duktape_main.o):(.literal.app_main+0x28): undefined reference to `xPortGetFreeHeapSizeTagged'
C:/esp/proto/build/main\libmain.a(duktape_main.o): In function `app_main':
C:/esp/proto/main/duktape_main.c:105: undefined reference to `xPortGetFreeHeapSizeTagged'
collect2.exe: error: ld returned 1 exit status
make: *** [C:/esp/esp-idf/make/ /c/esp/proto/build/esp32-duktape.elf] Error 1
The code it references is here:

Code: Select all

	LOGD("Free IRAM: %d",  xPortGetFreeHeapSizeTagged(MALLOC_CAP_32BIT)); 
but there doesn't seem to be anything unusual with it. I'm quite the beginner so it's really stumped me. The only thing that's different to the original document is the includes, which are:

Code: Select all

#include <FreeRTOS.h>
#include <heap_regions.h>
#include <task.h>
#include <esp_event.h>
#include <esp_event_loop.h>
#include <esp_log.h>
#include <esp_system.h>
#include <esp_wifi.h>
#include <esp_heap_caps.h>
#include <nvs_flash.h>

#include "duktape_task.h"
#include "duktape_event.h"
#include "logging.h"
#include "sdkconfig.h"
Any help would be much appreciated!


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

Re: JavaScript on ESP32 - Duktape

Postby kolban » Sat Jul 29, 2017 8:20 am

Apologies, I haven't compiled it in a while. I'll need to get back to it ASAP. It seems that API (xPortGetFreeHeapSizeTagged) is no longer in the ESP-IDF (but I believe it used to be). Since the failing statement is a log/debug statement... in the interim, we can comment it out. I'll start examining immediately and repair the source.
Free book on ESP32 available here:

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

Re: JavaScript on ESP32 - Duktape

Postby kolban » Sat Jul 29, 2017 11:20 pm

Status update: 2017-07-29

After a few months hiatus, the ESP32 Duktape project is getting some love again. I have a couple of ESP32 WROVER modules which (as you may know) are ESP32 + 4MByte psRAM. This means that the RAM available to the application increases dramatically.

On the basic WROVER module which only has the default 512K, we didn't have enough free space for all the features I wanted including a built in IDE, WiFi, WebSockets and much more. With the build on the WROVER, we are holding steady at 4.2MBytes of free heap with everything loaded (WiFi connected, IDE running, Web Server running, Web Sockets running etc etc). This is more than enough for some meaty applications.

If you have a WROVER module and wish to test it out, contact me and we'll work together.

Next plans are to expose BLE from JavaScript.
Free book on ESP32 available here:

Posts: 1
Joined: Mon Sep 18, 2017 3:04 pm

Re: JavaScript on ESP32 - Duktape

Postby captain-normal » Mon Sep 18, 2017 3:18 pm

Hi Kolban,

I'm reading about your project here with interest. Absolutely fantastic work! I'm looking at doing something similar which may be able to contribute to your project, or maybe it's too far off. In any case I think you will be able to suggest an appropriate path forward.

I'd like a web browser to run on the ESP32, with at least basic HTML and Javascript support. I'm developing at the moment on the Wrover (will use its display), but want to later run on the ESP32 without external RAM etc. For the HTML part, I'm not sure what to use. For Javascript I'm looking at Jerryscript and Duktape. I like your idea of running the ESP32 with Javascript, but I don't _think_ that's necessary in my case, as long as I can get the underlying C/C++ libraries to play nicely with the Javascript callbacks.

Any input very welcome. As mentioned, I'm not sure if this is on-topic for your project, but I am sure that you will be able to steer me in the right direction!

Posts: 1
Joined: Fri Oct 13, 2017 1:38 pm

Re: JavaScript on ESP32 - Duktape

Postby mhelander » Fri Oct 13, 2017 1:55 pm

Hello Kolban, all,

I'm new in this forum so brief introduction is in place I guess... I've been doing electronics & programming 35+ years, and currently quite deep in JavaScript full-stack world.
My house, which was built 19999, is kind of "smart" having 24V relays controlling all lightning and 2/4 push-buttons in every room. Relays are DIN rail types in our double cabinet "fuse wall", and there is three DIY relay cards each with 8 inputs and 8 pull-down outputs.


So it's 18 years to date and still haven't completed the "smart" part of my system, and then found ESP32 & this forum!

Got so excited that immediaterly ordered two ESP-WROVER32 ESP32 modules, one "quick burn" module and some more HW for getting in speed with this.

My target is to prototype with I2C connected IO submodules to replicate current functionality, then enter to "smart". Modules will be built using MCP23017 and using other 8-bit bank for inputs and other for 8 relays. Haven't yet found good enough (and cheap) open relay driver having this nice chip thus it's time to DIY schematics & layout for these boards.

What comes to software, let's see how far I can go with JavaScript, but likely need to code submodules controlling code using C. Then I'll do my best to port GunDB to run under Duktape control, and map that to input events and control outputs.

So, awesome job this far, and let's see how far beyond Duktape in ESP32 can go...

Posts: 2
Joined: Mon Dec 07, 2015 3:45 pm

Re: JavaScript on ESP32 - Duktape

Postby MakerAsia » Sun Jul 01, 2018 4:31 am

Dear Kolban and all,

Could anyone update the status of JavaScript on ESP32 right now in 2018?

Best Regards,
Jimmy (MakerAsia)

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

Re: JavaScript on ESP32 - Duktape

Postby kolban » Sun Jul 01, 2018 9:26 am

I continue to have hope that one day I'll get back to my own project on JavaScript on ESP32 but there are just so many other pretty shiny objects our there.

I note the following which also looks exciting ...

and I understand that Espruino on the ESP32 continues to get love.
Free book on ESP32 available here:

Posts: 197
Joined: Mon Oct 17, 2016 3:11 pm

Re: JavaScript on ESP32 - Duktape

Postby jumjum123 » Mon Jul 02, 2018 7:32 am

As Neil mentioned,
Espruino, javascript for a lot of different bards is also available for ESP32.
It supports everything which is standard like SPI, I2C, Uart, http, etc. etc. see
Bluetooth is also supported in early state
Most actual download is here
I would recommend to take the tgz file (espruino_1v99.168_esp32.tgz)

Posts: 1
Joined: Tue Apr 23, 2019 2:15 pm

Re: JavaScript on ESP32 - Duktape

Postby JohnBl » Tue Apr 23, 2019 2:43 pm

I'm trying to flash the esp32-duktape binaries into an ESP32-pico-devkit-v4, using Neil Kolban's installation cheatsheet.
The flashing goes well, but after reboot I keep getting following message
Guru Meditation Error of type LoadProhibited occurred on core 0. Exception was unhandled.
, after which the module gets stuck on:
Entering gdb stub now.
Can anybody tell me if it is possible to run esp32-duktape on an ESP32-pico-devkit-v4?
Do I need to recompile the binaries from the sourcecode?
Thanks in advance for your help.



Who is online

Users browsing this forum: No registered users and 3 guests