Note: There is now improved documentation at https://github.com/espruino/Espruino#building-under-windowsmacos-with-a-vm
I've been playing around the last three days with the espruino source code and I want to share my experience with the build system.
First I wanted to make it work under windows (yes, I'm a masochist :-) ) and after I burned the midnight oil I concluded: Forgot it! I have an MSYS environment and the included shell doesnt' work properly. I'm afraid that for windows there will be the need for a different build system like ant (java based) or nant (same as ant, .net version).
Next try: Linux in a virtual machine (virtual box). I installed the compiler (just untared the archive), installed a additional library for python, changed some little things in the makefile, typed "make" - and voila!
Here's a step by step guide.
I guess vour linux system or linux vm is up and running.
Check if python 2.6 / 2.7 is installed. On the shell type python -V (be careful! Big 'V'!). You need python 2.6 or 2.7. python3 doesn't work!
Check if importlib ist installed. On the shell type python -c 'import importlib' . If the lib isn't there you got an error like this "ImportError: No module named importlib".
Optional: Install importlib. You need easy_install from the package python-setuptools. I'm assuming that it's already installed. On the bash type easy_install importlib . That's all.
Check if make ist installed. Type make -v (little "v")
Download and install a compiler. I'm using this:
On the linked website got to the section ARM Processors -> Download the EABI Release.
You need to register and after that you'll get an email with a link to the download page. (I've chosen the linux tar.bz). You're best off using version 2013.05-23-arm-none-eabi, as other versions produce larger binaries which may be too big to go in Espruino's available flash memory.
Install it in your home-dir or elsewhere.
Download the source code. You can find the source of the js interpreter here: https://github.com/espruino/Espruino
Download an ZIP-archive with the code https://github.com/espruino/Espruino/archive/master.zip (last button on the right side) and unzip it in your home dir or elsewhere (unzip master.zip). The root dir of the unzipped archive is "Espruino-master".
There seems to be an error in the Makefile. It always stops at the same position saying it can't find the directory 'gen'. I've created it by hand (mkdir gen) and it works.
Edit Makefile. Open Makefile in an editor, search for the string "CCPREFIX" (it's in the section "ifdef ARM"), change it to /path-to-compiler/arm-2013.05/bin/arm-none-eabi-
Check the head of the Makefile for environment variables and options (boards, creating of debug version and final releases etc)
I'm using a STM32F4DISCOVERY. For that board just type on the shell STM32F4DISCOVERY=1 RELEASE=1 make . You can also "hard code" these variables on top of the makefile or just uncomment the examples in the header.
After some time (30 seconds I guess, virtual box VM with opensuse 11.2, host system Windows Vista with core i7) you get 5 files espruino_stm32vldiscovery with the endings .bin .srec .elf .lst and .hex. Take the hex-file and upload it with ST-Link to your board. Reconnect the board to the pc and it will respond in your terminal window as "Espruino V1.40 KickStarter Version".
That's all. Have fun!
© Espruino, powered by microcosm.
Report a problem