Can't build BangleJS2 firmware

Posted on
  • After drowning my KS BangleJS2 in my local swimming pool, I purchased an SMA Q3 from Alibaba (I was keen to get back into my Bangling without bothering Gordon).

    I've bought an nRF52, made a USB adapter cable and started following the instructions at https://github.com/espruino/Espruino/blo­b/master/README_Building.md

    Building a native Espruino seemed to work, as did cross-compiling a PUCKJS version (the 'make' instruction is wrong in an obvious way). Then I tried making a BANGLEJS2 version, but I got the following message:

    make: *** No rule to make target '/home/andrew/source/repos/github/esprui­no/Espruino/targetlibs/nrf5x_15/modules/­nrfx/mdk/gcc_startup_nrf52840.S', needed by 'espruino_2v11_banglejs2.elf'. Stop.

    It looks like I'm missing an assembler?

  • I've figured it out. The line

    source scripts/provision.sh BOARDNAME

    needs to be between

    cd ~/source/repos/github/espruino/Espruino

    and

    make clean && make DFU_UPDATE_BUILD=1 BOARD=BOARDNAME RELEASE=1

  • For Q3 you need to build full firmware hex - without DFU_UPDATE_BUILD=1 and you need to have swd debugger dongle that can unlock locked nrf52 chip = anything except stlink v2.

    maybe most flexible and easy is getting raspberry pico and flashing it with ready made cmsis-dap firmware from https://github.com/majbthrd/DapperMime/r­eleases

  • Last night I had been able to use my nRF52DK to load the bootloader and application hex files that I'd built, but couldn't get past a boot loop. It appeared to keep on timing out with a "WATCHDOG" message. I could get it into a DFU state (hold BTN1 then release as the ='s appear), but that wouldn't create a DfuTarg for updating.

    At that point I gave up and went to bed. As expected this morning, the watch had fully discharged and was blank. I plugged it in to charge and it all booted up like a new Bangle2! It said the storage was corrupt (no surprise there), then formatted it and proceeded to the Welcome app. Now I'm just letting it charge for a couple of hours before doing anything more.

    What is the importance of the DFU_UPDATE_BUILD=1? Should I rebuild the firmware without that option and re-program them using the nRF52DK?

  • Actually, I think I can answer my own question. I had been following the instructions on the page:

    https://github.com/espruino/Espruino/blo­b/master/NRF_Bootloader.md

    They are now outdated, but I ended up doing:

    make clean;BOARD=BANGLEJS2 RELEASE=1 BOOTLOADER=1 make

    and

    make clean;BOARD=BANGLEJS2 RELEASE=1 make

    Then loaded the bootloader.hex file first, followed by the application.hex. Then power-down overnight and here I am...

  • The 'application' hex made by your last line should include everything including bootloader. It is actually softdevice + application + bootloader + bootloader settings + UICR so five different pieces merged into one. there should be hexinfo.py installed (part of intelhex pip package needed by nrfutil) that can be used to examine the hex file.

    The BOOTLOADER=1 should not be needed as long as there is bootloader : 1 in board file https://github.com/espruino/Espruino/blo­b/master/boards/BANGLEJS2.py#L28

    DFU_UPDATE_BUILD=1 makes DFU update zip

    Anyway, great that you got it working :-)

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

Can't build BangleJS2 firmware

Posted by Avatar for andrewg_oz @andrewg_oz

Actions