There are several options to building Espruino on various platforms for the OS and board versions that are avaiable.
To build and run Espruino on the OS that one is using is as simple as the following, if prerequisits are met:
make clean && make
Note:
make clean
before you compile for the new target.RELEASE=1
for performance and code size, without it, assertions are kept for debugging.DEBUG=1
is available.Espruino is easy to build under Linux, for either for Espruino running on Linux or a board.
The current reference OS for building is Ubuntu 16.04.1 LTS, and the following can ensure problem free development:
Simply run the following with the name of your board to set your computer up ready for a build:
source scripts/provision.sh BOARDNAME
This should work for common platforms on Linux, but will only set paths up for your current session. You'll have to run it again next time you log in.
sudo apt-get update
sudo apt-get install -y \
build-essential git python python-pip
sudo pip install --upgrade pip
# User choice for placement of source repos
mkdir -p ~/source/repos/github/espruino
cd ~/source/repos/github/espruino
git clone https://github.com/espruino/Espruino.git
cd Espruino
make clean && make
chmod +x espruino && sudo cp espruino /usr/local/bin
Having successfully created an native OS Espruino, try a cross compilation.
sudo apt-get update
sudo pip install nrfutil
sudo apt-get install -y \
lib32z1 lib32ncurses5
wget https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
tar xjf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
sudo mv gcc-arm-none-eabi-5_4-2016q3 /usr/local
export PATH=/usr/local/gcc-arm-none-eabi-5_4-2016q3/bin:$PATH
cd ~/source/repos/github/espruino/Espruino
make clean && DFU_UPDATE_BUILD=1 BOARD=PUCKJS RELEASE=1 make
ls -l *puckjs*
mkdir ~/diskimages
hdiutil create -size 10g -fs "Case-sensitive HFS+" -volname Espruino ~/diskimages/Espruino.sparsebundle
hdiutil attach ~/diskimages/Espruino.sparsebundle
sudo ln -s /Volumes/Espruino/ /Espruino
cd /Espruino
hdiutil detach /Volumes/Espruino
hdiutil resize -size 15G ~/diskimages/Espruino.sparsebundle
hdiutil attach ~/diskimages/Espruino.sparsebundle
mkdir /Espruino/{gcc,sdk,repos,tmp}
/Espruino -+- gcc GNU Compiler Collection for different processors
+- sdk Software Development Kits
+- repos like Espruino EspruinoDocs ...
+- tmp temporary files
brew upgrade gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake
# version 1.4.0
brew upgrade stlink
# version 2.1
pip install esptool
# Espruino, Pico, PuckJS, EspruinoWifi
# gcc arm https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
curl -Ls https://goo.gl/42fcKX | tar -C gcc -xvzf -
# xtensa gcc - pre buid from https://github.com/MaBecker/esp8266
curl -Ls https://github.com/MaBecker/esp8266/xtensa-lx106-elf-4.8.5.tgz | tar -C gcc -xvzf -
# ESP8266/esp8285 starting with 01
# espressif ESP8266 2.0 <- actual one
wget -P tmp https://github.com/espressif/ESP8266_NONOS_SDK/archive/v2.0.0.zip
unzip -d sdk tmp/v2.0.0.zip
rm tmp/v2.0.0.zip
# add esptool.py
mkdir /Espruino/sdk/ESP8266_NONOS_SDK-2.0.0/esptool
ln -s /usr/local/bin/esptool.py /Espruino/sdk/ESP8266_NONOS_SDK-2.0.0/esptool/
The other stuff is similar to Linux
It is possible to build Espruino under Windows with the following addition to the Linux explanation:
Note:
Or use a Virtual machine as described below dependent on ones taste.
Using RASPBIAN JESSIE WITH PIXEL, getting Espruino is easy.
To enable the full power of Espruino on the Pi, WiringPi:
sudo apt-get install wiringpi
Getting Espruino:
make clean && make
chmod +x espruino && sudo cp espruino /usr/local/bin
Follow the instructions for OpenWRT build system
After a successful OpenWRT build, OpenWRT Espruino packages
make clean && BOARD=BOARDNAME RELEASE=1 make
Where BOARDNAME is one of:
PICO_R1_3
for Espruino PicoESPRUINOBOARD
for Original EspruinoESPRUINOWIFI
for Espruino WiFiOr choose another board name based on the files in boards/*.py
BOARD=BOARDNAME RELEASE=1 make serialflash
will flash to /dev/ttyUSB0 using the STM32 serial bootloader (what's needed for the Espruino and HY boards)BOARD=BOARDNAME RELEASE=1 make flash
will flash using st-flash if it's a discovery board, the maple bootloader if using that board, or will copy the binary to /media/NUCLEO
if using a Nucleo board.It may complain that there isn't enough space on the chip. This isn't an issue unless you save to flash, but you can fix the error in a few ways:
TRAVIS=1
-O3
to -Os
in the Makefile
USE_GRAPHICS=1
) that you don't need in the Makefile
Note: Espruino boards contain a special bootloader at 0x08000000
(the default address), with the Espruino binary moved on 10240 bytes to 0x08002800
. To load the Espruino binary onto a board at the correct address, use BOARD=ESPRUINO_1V3 RELEASE=1 make serialflash
. If you want to make a binary that contains the bootloader as well as Espruino (like the ones that the Espruino Web IDE expects to use) use the script scripts/create_espruino_image_1v3.sh
which will compile the bootloader and Espruino, and then join them together.
Dependant on the board, either usb or bluetooth can be used to program the board or install the bootloader from different devices.
Espruino XYZ
where XYZ
is the board nameThe Puck.js and Pixl.js are based on the nRF52
# Puck.js
make clean && DFU_UPDATE_BUILD=1 BOARD=PUCKJS RELEASE=1 make
# Pixl.js
make clean && DFU_UPDATE_BUILD=1 BOARD=PIXLJS RELEASE=1 make
The resulting file is a zip that has to be transferred via Bluetooth Low Energy. See the Puck.js and Pixl.js pages for information concerning transferring the ZIP.
All boards based on the nRF52 have RAM and Flash to support Espruino without feature disablement.
make clean && BOARD=NRF52832DK RELEASE=1 make
The micro:bit is based on the nRF51.
make clean && BOARD=MICROBIT RELEASE=1 make
Note:
All boards based on the nRF51 are limited in RAM and Flash so many features are disabled.
make clean && BOARD=NRF51822DK RELEASE=1 make
In order to compile for the esp8266 on Linux several pre-requisites have to be installed:
To run make you need to pass a couple of environment variables to make
. These include:
BOARD=ESP8266_BOARD
FLASH_4MB=1
if you have an esp-12ESP8266_SDK_ROOT=<Path to the 2.21 SDK>
PATH=<Path to esp-open-sdk/xtensa-lx106-elf/bin/>
COMPORT=</dev/ttyUSB0|COM1|...>
The easiest is to place the following lines into a script, adapt it to your needs and then run it.
#! /bin/bash
export BOARD=ESP8266_BOARD
export FLASH_4MB=1
export ESP8266_SDK_ROOT=/esp8266/sdk/ESP8266_NONOS_SDK-2.2.1
export PATH=$PATH:/esp8266/gcc/xtensa-lx106-elf/bin/
export COMPORT=/dev/ttyUSB0
make clean && make $*
make flash
it will try to flash your esp8266 module over serialmake wiflash
it will try to flash you esp8266 module over wifi, which assumes
that it's already running Espruinoespruino_2v0x_*_esp8266.tgz
archive, which contains everything you
need to flash a module (except for esptool.py), including a README_flash.txtOn 64 bit linux:
git clone https://github.com/espruino/Espruino.git
cd Espruino
source scripts/provision.sh ESP32
make clean && BOARD=ESP32 make
If you are on a different platform such as the Mac, you will need to install the toolchain and esp-idf for your platform, see http://esp-idf.readthedocs.io/en/latest/macos-setup.html
The easiest way to get the esp-idf environment is to install: https://github.com/espruino/EspruinoBuildTools
and then replace the toolchain with what is required for your platform.
You only need to use the EspruinoBuildTools if you want to compile esp-idf libaries
When building on Eclipse, update the Makefile properties to include the definitions show above. The easiest way to achieve
that task is to right-click your Espruino project and select properties
. From there, navigate to C/C++ Build > Environment
.
Note: the emw3165 port is very preliminary and does not include Wifi support at this time. The text below is what is planned in order to support Wifi, but it doesn't exist yet.
The EMW3165 port uses WICED, which is an application framework provided by Broadcom for its wifi chips, such as the BCM43362 used in the EMW3165 module. The module consists of an STM32F411CE processor and the BCM43362. The WICED framework comes with everything and the kitchen sink plus a rather complex build process in order to support umpteen different processor and wifi chip combinations, plus various use-cases. WICED includes FreeRTOS and LwIP plus proprietary code to manage the Wifi chip.
The strategy employed is to compile portions of WICED into a library using the WICED toolchain and then linking this into Espruino.
Setting up WICED:
./make EMW3165-FreeRTOS-LwIP-snip.apsta download run JTAG=stlink-v2
./make EMW3165-FreeRTOS-LwIP-snip.scan ...
Compiling WICED into a library:
Compiling Espruino:
WICED_ROOT=/home/emw3165/WICED-for-EMW/WICED-SDK-3.3.1 make $*
sudo pip install markdown
python scripts/build_docs.py
This will create a file called functions.html
that is a version of the reference pages,
but based on your source code.
The easiest solution for a Virtual Machine for Windows and MacOS is VirtualBox. A really easy way to provision, ie setup the system for development, is Vagrant.
Note:
brew cask install virtualbox vagrant
vagrant plugin install vagrant-auto_network
vagrant up
vagrant ssh
cd /vagrant && make clean && make
exit
.vagrant suspend
vagrant halt
If one does not wish to use vagrant, then install Virtual Box and use the Linux method.
In order to access USB, bluetooth or connected USB devices, one has USB filters to dedicate access to the guest OS. The easiest method is via the VirtualBox Manager, and select which devices should be dedicated to the VM with the device filter. Note: VirtualBox Guest Additions from VirtualBox are required.
USB
, then click on the icon with the +
sign (With the tooltip 'Adds a new USB filter ... selected USB device')STMicroelectronics STM32 ...
sudo BOARD=ESPRUINO_1V3 RELEASE=1 make serialflash
Note: if you want to you can change permissions so you don't need sudo
by typing sudo cp misc/45-espruino.rules /etc/udev/rules.d;sudo udevadm control --reload-rules
and then re-inserting the board.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。