Espruino on Magic3 watch flashing & build process

Posted on
  • Hello @fanoush & @jeffmer

    I'd like to understand more about the flashing & build process for getting a build of WatchApps onto a Magic3 watch. Specifically:
    1) What's the need for the SoftDevice downgrade step before uploading the WatchApps build?
    2) Would it be possible to build a complete image containing both @fanoush's base Espruino build and @jeffmer's WatchApps stuff that could be flashed in one go from DaFlasher?

    On 2), maybe it could be possible to image the whole memory of a watch that has already had everything flashed onto it, and clone that onto a new (identical) watch? I don't understand enough about how memory is structured on the device, and how bootloader flashing etc works to know if that's a sensible idea.

  • 1) there was a bug with advertising so device was not accessible with 6.1.x, it was fixed recently https://github.com/espruino/Espruino/iss­ues/2000 and there was another fix needed for internal flash to be stable with 6.1.x, if you build from latest Espruino source then S140 6.1.x works. my older builds have some quick fix so advertising works but without patch it does not work, jeffmer's builds may not have it, and nowadays it is not worth patching old source, better is updating to latest version. And BTW Bangle2 still uses 6.0.0 so moving down from 6.1.1 to 6.0.0 was also meant for better compatibility. 6.1.1 is needed only for coded phy with extended advertising support which is useful only in special cases.

    2) not in one go, dafit bin has limit on firmware size, first bin file is smaller and has some stuff compiled out to fit. maybe with some heavy compression and some custom installer that would unpack parts (bootloader, espruino, storage) into right places it could work

  • Thanks for the info, I think I understand more now.

    After reading your reply above, and poking around in your repo and jeffmer's: would I be right in thinking it'd be possible to flash your most recent Magic3 Espruino build, then upload some files from jeffmer's repo and have a reasonably working watch? I really only need to be able to run a clock app I've written for a Bangle.

    It looks like most of the code in jeffmer's repo is Espruino js code, to be run in the Espruino interpreter? e.g. not firmware patches.

    So the process would go like this (to borrow the one outlined in jeffmer's repo:
    1) Espruino bin using DaFlasher 2) DFU bootloader using WEBIDE 3) Most recent Magic3 Espruino zip file from fanoush repository 4) Upload enough of jeffmer's App js to get a decent watch environment 5) Upload my Bangle clock js

    With the understanding that I might need to update some of jeffmer's js to work with the newer version of Espruino.

  • more or less yes, there is also difference in display driver, there are three - one mine in javascript+inline c, two made by jeffmer - lcd_spi_unbuf -unbuffered driver - sends data to screen directly as it is drawn (a bit slow) - this is also part of my build but unused/untested. Later jeffmer also made buffered driver similar to mine. both of his drivers are part of espruino binary. so you need to check how the js code draws to screen - buffered driver needs to call g.flip() when you want to push currently modified area to screen.

    also another difference is where the storage is - internal nrf52 flash (about 600kb) or spi flash 8MB or both. my latest build on github is for internal flash but no problem to build other variants (i just don't use them much, 600kb was enough for me)

  • Awesome, that makes sense, thank you.

    For absolute clarity: does that mean that jeffmer’s unbuffered driver is part of the builds available from your repo?

    And when you say “both of his drivers are part of espruino binary” - which binary is that?

    And presumably, your js+inline c driver can be used with any build, because it gets compiled when a js file that includes it is uploaded via the web ide?

    Understood about internal vs spi flash. I think I’ll be okay with internal for now too.

    Time to get another fresh new watch and try it all out, I think :)

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

Espruino on Magic3 watch flashing & build process

Posted by Avatar for prehensile @prehensile

Actions