common bootloader?
#1
I've just ordered my pinetime devkit so it'll be a while before it arrives, but I was thinking the first thing we should probably do in common before we all go off to do our own things is develop a bootloader that will work in common with all our projects. It's all very well writing the flash via SWD with the devkits, but in the production version presumably we're going to need another way of writing the flash that doesn't involve opening the case.

The bootloader should be able to:
  • Drive the display, bluetooth and SPI flash.
  • Present a nice liveness/progress bar indicator during the boot process.
  • Delay on boot, check if the button is pressed.
  • If the button is pressed, enter "rescue" mode that will offer a serial console over bluetooth with xmodem (or similar) support to download a (compressed?) firmware image.
  • Write any firmware image received to SPI flash, verify checksums.
  • Check on boot if a new firmware image is available in external flash, if so write it to internal (memory mapped) flash.
  • Protect the internal flash.
  • Set the watchdog timer.
  • Branch to whatever address we agree the kernel entry point should live at.


Is anyone working on anything like this? If not, I guess that's my first job when I get hold of my devkit.
  Reply
#2
I'm porting Mynewt OS to PineTime but I haven't done a proper bootloader yet. Would the new bootloader be based on MCUboot, which supports Zephyr, RIOT and Mynewt? https://juullabs-oss.github.io/mcuboot/
  Reply
#3
(12-05-2019, 04:43 AM)lupyuen Wrote: I'm porting Mynewt OS to PineTime but I haven't done a proper bootloader yet. Would the new bootloader be based on MCUboot, which supports Zephyr, RIOT and Mynewt? https://juullabs-oss.github.io/mcuboot/

We could use that code as part of it, sure. I think the bulk of the effort is going to be writing a very minimal bluetooth stack though, just enough of the link layer to reply to scans and advertise a serial port.
  Reply
#4
(12-05-2019, 05:24 AM)Jeeves Wrote:
(12-05-2019, 04:43 AM)lupyuen Wrote: I'm porting Mynewt OS to PineTime but I haven't done a proper bootloader yet. Would the new bootloader be based on MCUboot, which supports Zephyr, RIOT and Mynewt? https://juullabs-oss.github.io/mcuboot/

We could use that code as part of it, sure. I think the bulk of the effort is going to be writing a very minimal bluetooth stack though, just enough of the link layer to reply to scans and advertise a serial port.

Hmmm the Bluetooth part might be challenging... My Mynewt OS port uses the open-source NimBLE stack (also available for Zephyr OS): https://github.com/apache/mynewt-nimble

Other ports may choose to use the proprietary Nordic SoftDevice stack. I wrote about NimBLE vs SoftDevice here: https://medium.com/swlh/sneak-peek-of-pi...38e99ec20d
  Reply
#5
(12-05-2019, 06:07 AM)lupyuen Wrote: Hmmm the Bluetooth part might be challenging... My Mynewt OS port uses the open-source NimBLE stack (also available for Zephyr OS): https://github.com/apache/mynewt-nimble

Other ports may choose to use the proprietary Nordic SoftDevice stack. I wrote about NimBLE vs SoftDevice here: https://medium.com/swlh/sneak-peek-of-pi...38e99ec20d

Do you have any data about the object size the NimBLE stack compiles down to? Ideally, the bootloader would probably be less than 4KB so it fits in just the first page of the internal flash. I'd be only too delighted to use a pre-written bluetooth stack if it's small enough.
  Reply
#6
The nRF5's SDK has a bootloader with a few ways to enter it (button on startup, set a bit and force a restart over a normal BLE). Almost every commercial sports tech sensor is using the Nordic Reference or a modified derivative. The down side is that the reference is really setup for "no backsies", as in firmware is given a version, and you can't put on an older one. There was an open bootloader in 15.3.0 (haven't checked 16 yet) but it's nrF52840 USB and not BLE.
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  wasp-bootloader: a robust SoftDevice bootloader for PineTime danielt 0 138 02-12-2020, 04:58 AM
Last Post: danielt

Forum Jump:


Users browsing this thread: 1 Guest(s)