Building Espruino for Puck

Posted on
  • Hi @Gordon,

    I tried building the Espruino firmware for the Puck myself. I am doing it from a Mac, checked out the top of the master from github.

    I started the build with

    PUCKJS=1 RELEASE=1 make

    Building works mostly, lots of warnings, but no apparent errors. I get to the stage where it links the firmware. That seems to work. Then it fails with the following log:

    GEN espruino_1v90.1890_puckjs.hex
    Merging SoftDevice and Bootloader
    # nrfutil settings generate --family NRF52 --application espruino_1v90.1890_puckjs.hex --application-version 0xff --bootloader-version 0xff --bl-settings-version 1 dfu_settings.hex
    FIXME - had to set --overlap=replace
    python scripts/ --overlap=replace /Users/stevie/Desktop/github/Espruino/ta­rgetlibs/nrf5x/components/softdevice/s13­2/hex/s132_nrf52_3.0.0_softdevice.hex bootloader_espruino_1v90.1890_puckjs.hex­ espruino_1v90.1890_puckjs.hex -o tmp.hex
    Traceback (most recent call last):
      File "scripts/", line 178, in <module>
      File "scripts/", line 158, in main
        ih = intelhex.IntelHex(fname)
      File "/Users/stevie/Desktop/github/Espruino/s­cripts/intelhex/", line 93, in __init__
      File "/Users/stevie/Desktop/github/Espruino/s­cripts/intelhex/", line 202, in loadhex
        fobj = open(fobj, "r")
    IOError: [Errno 2] No such file or directory: 'bootloader_espruino_1v90.1890_puckjs.he­x'

    Any advise? What am I doing wrong?


  • try make clean;DFU_UPDATE_BUILD=1 PUCKJS=1 RELEASE=1 make - that's what you need I think (but you'll need to pip install nrfutils)

    The normal build will try and merge with the bootloader, which needs building with make clean;BOOTLOADER=1 PUCKJS=1 RELEASE=1 make

    However that merged hex file is only really any good if you've got a debugger connected to the Puck - for wireless firmware updates you want the DFU_UPDATE_BUILD bit

    Hope that helps!

  • Thanks, that worked! I will have to tested it later today, but at least I could build.

    Just for reference, installing nrfutil on Mac needs the following:

    sudo pip install --ignore-installed six nrfutil

  • Great - thanks for letting me know!

  • Okay, I have uploaded the new firmware to the Puck and can confirm that it works fine. Thanks a lot!

  • @stevie4711 thanks for sharing the pip command.

    However, I had to install gcc-arm to do the build (OS X Sierra here, using homebrew):
    brew install Caskroom/cask/gcc-arm-embedded

    Will still have to test the compiled ZIP though to verify that it works...

  • You are welcome!

    For gcc what I did was actually to just download the arm gcc binary distribution, unpack to some location and put it in the path. That way I can have multiple different versions and can just set the path from some project related build script.

  • OK - given I have managed to create a working ZIP for OTA flashing.

    A test cycle is quite complex and time consuming:

    • create the ZIP
    • send it to iPhone
    • set Puck to Bootmode and flash (this takes several minutes)

    Any hints or howtos to do it via serial connection from the commandline?

  • Afraid not - ideally you'd connect the GND, SWD, and SWCK pads to something like an nRF52832DK board, then you can use make flash to flash it over SWD (which takes ~15 seconds). It's even possible to debug.

    Having said that, I actually do a lot of development on a nRF52832DK board as it's easier, and then flash the Pucks only when needed (I made a jig with pogo pins to make it faster/easier)

  • OK thanks. Ordered the board.
    Seems to be needed for serious development...
    I'm just chewing myself through the nordic docs to understand what happens on the lower levels...
    This is the right link­om.nordic.infocenter.s310.api.v3.0.0/mod­ules.html - could you just confirm?

  • It's the S132 softdevice you need:­om.nordic.infocenter.softdevices52/dita/­softdevices/s130/s130.html?cp=2_3_0

    (and the S130 for nRF51 - they're pretty much identical API-wise)

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

Building Espruino for Puck

Posted by Avatar for stevie4711 @stevie4711