Howto: Building the espruino code #1159
Replies: 47 comments
-
Posted at 2013-09-29 by bluecamel Thanks! I'm going to try this some evening next week on OS X and/or linux. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-09-30 by Frida Very good, although I could get it to work. thanks |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-01 by @gfwilliams Thanks! Using a VM is definitely a good way to go - I wonder if someone could wrap this up in a script that could be executed once a VM was set up? There's also USB stick Ubuntu as well - could be worth a try: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-01 by tickTock
This might be a little tricky, a challenge for a rainy weekend :-) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-01 by @gfwilliams I guess the more sensible thing is to put a Raspberry Pi SD card image online somewhere. It doesn't take that long to compile on a Pi, and a lot of folks have one. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-01 by bluecamel I could setup a Vagrant VM. It would require VirtualBox and takes a little time to setup initially (installing all the software, etc.), but should be easy to maintain the config in a repo. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-02 by user6091 @bluecamel : it would be really great! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-03 by bluecamel I got a basic vagrant vm created. I don't have the compile toolchain setup yet. I'm new to building for embedded processors, so I'm still trying to figure out how to build. I installed arm-linux-gnueabi-gcc-4.6 and made a soft link to that from arm-none-eabi-gcc and ran 'STM32F4DISCOVERY=1 RELEASE=1 make' but get loads of warnings. I'm guessing that arm-linux-gnueabi-gcc-4.6 isn't what I should be using? Anyhow, if you want to see the vm and maybe help get the correct compiler setup... To setup the vm on your machine:
For those interested in how I made it (or want to help with or suggest configuration):It just uses a bare-bones precise32 image that I added a few basic things to (python, pip, git, make, blueprint). I left out arm-linux-gnueabi-gcc-4.6 for now, since I'm not sure that's right. I used blueprint (http://devstructure.com/blueprint/) to generate the chef config files. Vagrant runs Chef Solo (http://docs.opscode.com/chef_solo.html) using these config files to install all of the packages we need/want in the vm. If you want to contribute your changes (installed packages and config files):
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-03 by bluecamel By the way, I think it should also be possible to install st-link on the vm and configure it to share the USB device from the host, and flash directly from the vm. At least I'm really, really hoping that'll work ;) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-06 by bluecamel Well, there were lots of fun hurdles, but I finally got a working build environment that can build itself automagically. The instructions are the same as before, with a few extensions:
It works! I've been able to build for my STM32F4DISCOVERY, flash it using stlink, and use screen to get to the virtual terminal - all within the vm. I wish it didn't take so long. For those more familiar with the toolchain, is an hour normal? I tried adding some settings to the vm to use more cores and added 'PROCS=2' before my make statement, but that didn't seem to change anything. Another option is I could just create an image of the vm at this state and that could be hosted somewhere (probably not in this repository since it would be fairly large). However, it would be much faster to setup for the first time. Please let me know how it goes if you give it a try. I hope this is useful to others ;) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-10-06 by bluecamel Oh, I forgot to mention some config you'll need to use stlink in the vm. Basically, you'll want to tell virtualbox the vendor and product ids for your device. Look in vm/Vagrantfile and you'll see a line that looks like:
Just change the values of vendorid and productid to match what lsusb ('system_profiler SPUSBDataType' on OS X) tells you for your device. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-11-05 by user6141 The arm-unknown-eab template from crosstool-ng seems to work fine.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-11-05 by user6141 Sorry, I imagined that. I forgot to set the BOARd variable. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-11-17 by gzip In Ubuntu 10.04 Lucid Lynx I got the following error:
After some digging I was able to resolve by installing the relevant package from: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-01-22 by user6336 I have managed to to install Ubunto 10.4 LTS in the Oracle VM, and I have done the steps described in the beginning of this chain. However, when I try to build the project I get the following error message. I'm a newbie to Linux, CodeSourcery and using make so the cause may be quite simple ... asko@asko-desktop:~/Espruino-master$ STM32FDISCOVERY=1 RELEASE=1 make |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-28 by arthurj Problem solved. I had first compiled espruino to run on Linux. GEN espruino_1v60_espruino_1r3.bin I guess I need to change some configuration files. I assumed espruino would have been the default. Also is it possible to program the espruino from the web IDE using a .bin file from the local file system? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-03-31 by @gfwilliams There's a bit of info on this here: https://github.com/espruino/Espruino/blob/master/README.md#for-arm-boards-incl-espruino-board At the moment I use a very specific compiler to keep the code size down, and some other compilers push it up too much. It's not a big deal though - just change the Makefile to use Right now I don't think it is possible to use the Web IDE to program from the local filesystem. Also the code that you get from the compiler won't include the bootloader, so it needs to be written to a different address. BUT it's nice and easy from the makefile. Just put the board into bootloader mode and do |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-04 by DrAzzy I'm trying to build the Espruino on Linux... I've installed the codesourcery compiler, and I can run: ESPRUINO_1V3=1 make And I get a deluge of warnings. But at the end, it checks the size, and gives pass/fail depending on the compiler flags I use, and I get my .bin file. So everything's grand right? I pull the .bin file down from the linux system via SCP, put it in the root of my local webserver. I use the webIDE to flash it (pointed at http://127.0.0.1/espruino_1v63_espruino_1r3.bin ). Flash goes normally and reports success. Then I press reset, and the blue and red LEDs stay on at about half brightness, and nothing else happens. Computer does not detect USB device. I can get it back into bootloader mode by mashing reset and btn1, and flash a working firmware to it, so that's not a problem.... but I'd like to be able to build Espruino firmwares myself. What am I doing wrong? I've tried with O3 and Os flags, and either way gives same result. This is using the code obtained via |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-06 by @gfwilliams Right, you're basically sorted then! Try running The issue is that If you can communicate with the board from the build environment, you should be able to just do |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-06 by DrAzzy Oh sweet! I'll give that a try today! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-07 by DrAzzy Huzzah! It worked! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-09 by DrAzzy UPDATE: There is now a new instance I've got an Amazon Web Services AMI for building Espruino code, if anyone wants it. If you're familiar with AWS, using this will be a snap. If you've got linux machines at home and aren't familiar with AWS, this is probably more work :-P
From EC2 Control Panel:
Everything is then set up to build Espruino. You do not need to adjust the CCPREFIX or anything - though you may need to tweak the CCFLAGS in the Makefile (see above), plus making any changes you might need. Just do something like:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-12 by @gfwilliams @drazzy - this is awesome, thanks! It should make it a lot easier for people to get started! Would you mind if I stuck this in the build instructions that are on GitHub? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-05-12 by DrAzzy Go for it :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-07-28 by user7249 Dear Espruino Fans, after some quick wins with my Espruino I thought "now let's use it for real things" and ordered some Wiznet LAN modules to get connected. Connecting the pins seems quite simple but I'm struggling quite some time to get the Firmware compiled. I used - like Gordon told - :
I downloaded the Compiler from the first post of this thread (mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/).
I'd be happy if someone could help me figure out how to get WizNet LAN working on my Espruino. Best regards, Jack |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-07-28 by @gfwilliams Hi Jack, I should have updated the WIZnet docs, but there are pre-compiled WIZnet binaries under: http://www.espruino.com/binaries/ Having said that, you're pretty close. I use a specific codesourcery compiler from that page (codesourcery-2013.05-23-arm-none-eabi) - and it makes the code small enough to go into the available memory. If you don't want to do that, edit the Makefile, scroll down to where it says |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-07-28 by user7249 Dear Gordon, thanks very much for the great project and the quick answer. Fortunately I now have a working version. Maybe some hints for anyone struggling to make wiznet working: http://www.espruino.com/WIZnet says to use dhcp you only need:
This didn't work for me (no connection was set up, there was an error "no sockets free" and App and Esprunio need a restart to work again afterwards), so I finally put in all params by hand (see below), which is my solution after some hours and a little bumpy ride this time.
Thanks for all the hard work, maybe there is a little room for improvement to get wiznet Moduls working as easy as reading temperatures via ADC or the one-wire sensors (which is insanely genius) . |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-07-28 by DrAzzy The reason the build you made first didn't work is that binaries flashed using the WebIDE need to have the bootloader included (the documentation doesn't hit you over the head with this like it ought to). Use the create_espruino_image_1v3.sh script Like this:
I've not had the problem you do with setIP() not working - mine just works. I suspect it's down to different network conditions. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-07-28 by user7249 @drazzy: Thanks I'll definitely try your solution next time. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-12 by @gfwilliams There is now some better documentation about building with a VM at https://github.com/espruino/Espruino#building-under-windowsmacos-with-a-vm However @drazzy's Amazon EC2 Instance may still be easier if you don't want to do any big downloads. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-09-29 by tickTock
Note: There is now improved documentation at https://github.com/espruino/Espruino#building-under-windowsmacos-with-a-vm
Hello all,
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.
Preparing the build environment
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:
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/
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.
Compiling the code
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!
Beta Was this translation helpful? Give feedback.
All reactions