That's great, thanks for the write-up! Good point about the check for raspberry-pi-ness. I'll tweak that in a bit so it only does it if no other environment variables were set.
Just FYI, the huge delay on
LDis because GCC is doing link-time optimisation. It means that it can optimise (and inline) between source files, which wouldn't normally happen. It's just a bit on the slow side!
I see you just tweaked the "raspberry-pi-check" in the Makefile. Thanks for that!
Post edited to reflect those changes.
(edit: also the linenumbers. Not sure how long I can keep that up ;)
(edit2: also noticed you have to actually comment out one or more of the "USE_NET", "USE_GRAPHICS", or "USE_FILESYSTEM" vars to keep it within size restrictions while using "-03". Setting them to "0" just doesn't cut it.)
If you want to compile and upload the latest version of Espruino yourself -and you happen to have a Raspberry Pi running Raspbian- here's how to do it. For reference, this topic explains how to do it in a Linux Virtual Machine: http://forum.espruino.com/conversations/151/
Before powering up the Raspberry Pi, connect the Espruino board to the Pi with a USB cable. Sometimes if you plug in the Espruino board while the Pi is running, it will reboot because of the sudden power draw. With a USB hub, you can plug in and unplug the Espruino board to your heart's content.
On the latest version of Raspbian (2014-06-20) you have all the basic tools you need (except for the necessary toolchain to compile it, and maybe 'minicom' or 'screen' to test if it worked). Older versions of Raspbian may lack some of these, so let's just try to install them all. Packages you already have will be ignored anyway.
You'll need an 'arm-none-eabi-gcc' toolchain for Raspbian to compile Espruino. I have a script on github that automatically downloads and install it.
The toolchain by default will be installed in '/opt/arminarm/*' on the Raspbian SD card. The next step shouldn't be necessary, but if you get complaints that 'arm-none-eabi-something' can't be found, you'll have to tell Raspbian where to look for it:
If you want Raspbian to remember this path permanently, you may want to add it to the .bashrc file in your home directory. Put the same line as above at the end of the file, without the 'export'.
The toolchain is now covered. Next get the latest Espruino from github, and step into the Espruino directory.
At the moment the "fully fledged" .bin file is a little bit too big to be uploaded to the Espruino. The toolchain Gordon is using probably handles "O3" optimization better than mine. One way to fix this is to optimize for size. Gordon mentions in aforementioned topic that save() doesn't work in this case, which is unfortunate. I'm hoping to learn more about that specific compiler Gordon is using.
In the Makefile, search for "else ifdef ESPRUINO_1V3". This is where the compile flags and vars are set for the Espruino board. Currently, that's on line 101. The vars for the next board (OLIMEXINO_STM32) start at line 111 (so that's 10 lines below where it starts).
The line before the OLIMEXINO_STM32 one (line 110, the last line for the Espruino board) says:
Change the "-O3" part into "-Os"
If you insist on being able to use save(), you could also still use "-O3" and comment out one or more of the "USE_NET", "USE_GRAPHICS", or "USE_FILESYSTEM" vars, whichever you don't intend to use.
Save the Makefile. We're ready to build and upload in a single step:
This would be a good moment to put the Espruino board into bootloader mode. Press and release the RST button while holding BTN1. The blue LED will fade in and out.
The compiling is done in a couple of minutes. The last step takes the longest. It will say 'LD espruino_1v67_espruino_1r3.elf' (or whatever version number is the current one) and seems to hang. It's not hanging, it's just really busy. So busy that it keeps quiet for about 5 minutes.
After that, it'll show that it's uploading a lot of bytes and reading them back in. When you're back on a commandline prompt, the latest version of Espruino is uploaded to your board and ready to go!
Press the reset button on the Espruino board, and start minicom:
Or screen. Whatever blows your skirt up.
Please let me know if you run into trouble.