Puck.js Cross Compilation

Posted on
  • I'm evaluating Puck.js for a project that would require modifying existing custom firmware with jswrap. To get started I figured I would start with the basic steps of re-building the libraries.

    After following the instructions within /master/README_Building.md and installing BASH under Windows 10 I can successfully build for Espruino, but I am running into problems for cross compilation for Puck.js.

    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-no­ne-eabi-5_4-2016q3-20160926-linux.tar.bz­2
    tar xjf gcc-arm-none-eabi-5_4-2016q3-20160926-li­nux.tar.bz2
    sudo mv gcc-arm-none-eabi-5_4-2016q3-20160926 /usr/local
    export PATH=/usr/local/gcc-arm-none-eabi-5_4-20­16q3/bin:$PATH
    cd ~/source/repos/github/espruino/Espruino
    make clean && DFU_UPDATE_BUILD=1 BOARD=PUCKJS RELEASE=1 make
    ls -l *puckjs*

    First I assume line 8 should read since that is the folder that is created from the prior step:
    sudo mv gcc-arm-none-eabi-5_4-2016q3 /usr/local

    The error I'm encountering during the build process:

    #@#:~/source/repos/github/espruino/Espru­ino$ make clean && DFU_UPDATE_BUILD=1 BOARD=PUCKJS RELEASE=1 make
    Cleaning targets
    Generating platform configs
    Generating pin info
    Generating JS wrappers
    WRAPPERSOURCES = src/jswrap_array.c src/jswrap_arraybuffer.c src/jswrap_dataview.c src/jswrap_date.c src/jswrap_error.c src/jswrap_espruino.c src/jswrap_flash.c src/jswrap_functions.c src/jswrap_interactive.c src/jswrap_io.c src/jswrap_json.c src/jswrap_modules.c src/jswrap_pin.c src/jswrap_number.c src/jswrap_object.c src/jswrap_onewire.c src/jswrap_pipe.c src/jswrap_process.c src/jswrap_promise.c src/jswrap_serial.c src/jswrap_spi_i2c.c src/jswrap_stream.c src/jswrap_string.c src/jswrap_waveform.c libs/math/jswrap_math.c libs/graphics/jswrap_graphics.c libs/network/jswrap_net.c libs/network/http/jswrap_http.c libs/network/js/jswrap_jsnetwork.c libs/bluetooth/jswrap_bluetooth.c libs/puckjs/jswrap_puck.c libs/crypto/jswrap_crypto.c libs/neopixel/jswrap_neopixel.c
    CC libs/compression/heatshrink/heatshrink_e­ncoder.o
    /usr/local/gcc-arm-none-eabi-5_4-2016q3/­bin/arm-none-eabi-gcc: 1: /usr/local/gcc-arm-none-eabi-5_4-2016q3/­bin/arm-none-eabi-gcc: Syntax error: word unexpected (expecting ")")
    make: *** [libs/compression/heatshrink/heatshrink_­encoder.o] Error 2
    make: *** Waiting for unfinished jobs....
    make: *** wait: No child processes.  Stop.

    Any help would be appreciated.


  • Maybe try just running the compiler? arm-none-eabi-gcc - it looks like there's some problem with it.

    Can you try running source scripts/provision.sh PUCKJS and then building? That'll pull all the tools into the Espruino directory and set up the paths for you, which is the nice easy way to do it - it's possible there's something odd about /usr/local on Bash for Windows 10.

  • Gordon,

    Thanks for the quick reply. I'll try running that this evening when I get a chance to dive back into this.

    When I run source scripts/provision.sh PUCKJS that goes off without a hitch. The first time it did install gcc-arm-embed in the Espruino directory as a new folder "gcc-arm-none-eabi-6-2017-q1-update".

    I take it I just need to change the export path to that location.

    Regards and thank you,

  • Yes, I bet that's it then. It must be something about /usr/local...

    provision.sh won't download the files if they already exist, so it's actually pretty quick to just call that every time you want to start cross compilation. Otherwise you could add the relevant paths to .profile in your home directory.

  • That appears to have done it. I can make clean && make for BOARD=PUCKJS and a new PUCKJS file is put into the boards folder. Alternately a simple make clean && make creates a LINUX file in the boards folder, and either or a new espruino file in the Espruino directory. So all appears to be normal.

    I did have to add a line to my hosts file to include YOURCOMPUTERNAME
    so bash would stop with the unable to resolve host lines.


  • Now that I know I'm setup to compile under normal circumstances I can get on with the heavy lifting.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Puck.js Cross Compilation

Posted by Avatar for JDowns @JDowns