Skip to content

Espruino Inline C

fanoush edited this page May 15, 2020 · 3 revisions

Espruino device can run native code dynamically from binary data array. The easiest way to generate such binary data in proper format is to use inline C compiler as described here

This allows you to develop and test quickly and interactively even low level C code without building and uploading full native application.

Espruino website hosts InlineC compiler service for official boards only, however you can run your own version quite easily and even with additional features enabled.

Running locally

The source is hosted on github so check its and try something like this with nodejs and ARM compiler in path.

git clone
cd EspruinoCompiler
npm install
node server.js

Then go to web IDE and configure it as per README ( set Communications / JavaScript Compiler URL to http://localhost:32766) and try some example from

Patch needed

If you have it correctly setup it will fail for you for two reasons but you should still see in console of EspruinoCompiler some output. To get it really running you need to:

  • Enable CORS headers so that can call http://localhost:32766 (can be also fixed by running IDE locally too)
  • Disable check for official boards

And also for better functionality you can:

  • enable compiler options tuned for your board CPU e.g. NRF52832 has Cortex M4 with hardware floating point
  • enable C preprocessor so that commands like #define work.

For that you can apply this patch or do those changes in server.js and compile.js files by hand.

Advanced examples of Inline C

fast hardware floating point math

display driver using nrf52 hardware SPI with DMA