EMBEDDED JS WITH ESPRUINO AND STM32 NUCLEO

getting started with embedded javascript using nucleo-f401re and the espruino firmware

Tomer Weller / Fall 2015 (updated Fall 2016)

Contents

Interpreters?

Javascript?

Embedded JS options

NUCLEO-F401RE

ESPRUINO

Performance Benchmark - Ring Oscillator

Interpreters?

Javascript?

Embedded JS options

NUCLEO-F401RE

setup

        

        os x: $brew install stlink

compile

flash

flashing espruino with st-link utility (unofficial)

$st-flash write espruino_1v81_nucleof401re.bin 0x08000000

ESPRUINO

interactive js console via serial

$ screen /dev/tty.usbmodemXXXX

Espruino IDE (Chrome App)

commandline - npm espruino package (beta)

$ espruino main.js /dev/tty.usbmodemXXXX

Examples: http://www.espruino.com/Tutorials 

Performance Benchmark - Ring Oscillator

#include "mbed.h"

DigitalOut out(PC_8);

DigitalIn in(PC_9);

 

int main() {

  while(1) out = !in;

}

pinMode(C8, "output");

pinMode(C9, "input");

digitalWrite(C8, 0);

while(1) {

  digitalWrite(C8,1-digitalRead(C9));

}

Update (Fall 2016)

1.38MHz

2.15KHz

460Hz

Espruino is about 650 3000 times slower. But hey - there’s more to life than performance!