wasp-bootloader: a robust SoftDevice bootloader for PineTime
#3
Here is a quick update on what I've found these last 2 days. These are mostly random notes I've taken while discovering how it's working. I hope they will be useful to anyone wanting to work on OTA updates and DFU Wink


My firmware (https://github.com/JF002/Pinetime) works out of the box with wasp-bootloader. This is because they are built around the same version of Noric's BLE SoftDevice (BLE stack).


@SteveA (on the chat) tried his own firmware (https://github.com/xriss/timecake, which does not use the SoftDevice) without success for now : the bootloader just resets every 1/2 second.


I've also tried to run @Koen's (on the chat too) firmware (https://github.com/bosmoment/PineTime-apps) with no much luck either. This firmware uses Nimble bluetooth stack. I did some modification to the code and the linker script but it would also reset every 500ms. A quick analysis on GDB showed me that it would hardfault in cortex_vector_base() which is pretty bad...


I don't know what causes this issue. It could be a conflict with the softdevice and Nimble, as they both try to drive the BLE radio.
Also, the softdevice is accompanied by an MBR : a small block of code the receives all the IRQ and forward them to the bootloader, softdevice and the application. And I really don't know what happens when the MBR expect the softdevice to be there, but it's not there because the application does not use it...


On the technical side, wasp-bootloader uses GPRERET (General Purpose Retention registers) and UICR (User Information Configuration Register) to store state and other info even when the MCU is reset. It also provides a factory reset option, which is a quite good idea!


Here is the general workflow of the wasp-bootloader:
  • Init board (watchdog, buttons, leds, task scheduler, timer and display)
  • Init bootloader (from the lib nrf_bootloader, provided by NRF52-SDK)
  • Init SoftDevice
  • Start DFU and wait for completion / error / timeout
  • Disable Softdevice
  • Teardown board peripheral
  • If there is a valid image : Jump to the image code
  • else reset and start again

Some links:
Working on InfiniTime, the FOSS firmware for the PineTime: https://github.com/InfiniTimeOrg/InfiniTime

Mastodon : https://mastodon.codingfield.com/@JF
Twitter : https://twitter.com/codingfield
Matrix : @JF002:matrix.org


Messages In This Thread
RE: wasp-bootloader: a robust SoftDevice bootloader for PineTime - by JF002 - 04-11-2020, 10:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Develop a new firmware for PineTime belushi 2 1,365 09-25-2023, 12:32 PM
Last Post: ccchan234
  Bluetooth BLE-MIDI-controller app for PineTime / InfiniTime Luno 0 553 08-20-2023, 05:17 AM
Last Post: Luno
  Zephyr Backlight Examples for PineTime lcj 0 734 05-06-2023, 02:54 PM
Last Post: lcj
  Zephyr is ready for pinetime jandy 1 2,143 05-06-2023, 02:15 PM
Last Post: lcj
  Send a message from Android to pinetime via BLE razrosman 0 945 11-05-2022, 08:24 AM
Last Post: razrosman
  PineTime Stuck in DFU Mode Eesha Barua 1 2,098 07-25-2022, 09:17 PM
Last Post: heyhewmike
  Idle tracking with PineTime: how versatile it is? schaman 1 1,676 07-13-2022, 12:50 AM
Last Post: wibble
  PineTime implemented with partial of pebble API jandy 0 1,583 03-20-2022, 08:58 PM
Last Post: jandy
  "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? ITCactus 4 4,002 03-02-2022, 05:58 AM
Last Post: wibble
  Zephyr based Pinetime jandy 4 4,755 11-11-2021, 05:53 AM
Last Post: jandy

Forum Jump:


Users browsing this thread: 2 Guest(s)