Create a uf2 file to flash a custom bootloader

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jacob_preston
 
Posts: 10
Joined: Wed Feb 15, 2023 10:40 am

Create a uf2 file to flash a custom bootloader

Post by jacob_preston »

I'm using an nRF52840 Feather Express board and would like to flash my own custom bootloader to it. I would like to do this via UF2 so I don't have JTAG new devices that haven't been flashed with the bootloader yet.

I tried the following script on my own bootloader (this bootloader is largely based on Nordic's secure_bootloader example project in nRF5 SDK v17.1.0 with very little changes):

Code: Select all

uf2conv.py nrf52840_xxaa_s140.hex -c -f 0xADA52840
This produces a flash.uf2 file, but when I transfer it to the Feather Express it will not update. The Feather Express is running v0.7.0 of Adafruit's bootloader.

How can I create a .uf2 file to update to my own bootloader?

User avatar
adafruit_support
 
Posts: 108
Joined: Tue Feb 09, 2010 7:37 pm

Re: Create a uf2 file to flash a custom bootloader

Post by adafruit_support »

the uf2 bootloader is designed to update itself and not designed to side-load other bootloaders which may have different soft device requirements.

we placed a jlink compatible header on the board:
https://www.adafruit.com/product/4062

your best bet is to burn what code you need on the bootloader directly via the header.

https://www.segger.com/downloads/jlink/

User avatar
jacob_preston
 
Posts: 10
Joined: Wed Feb 15, 2023 10:40 am

Re: Create a uf2 file to flash a custom bootloader

Post by jacob_preston »

Our goal would be to do this without any external adapter required, in particular we don't want to require an expensive debugger. We're developing an open source project and the end users may not have access to these kinds of tools. We need to be able to do DFU over BLE as this device will be completely encapsulated in its final form.

We can perform this DFU comfortably with Nordic's stock bootloader over BLE. I looked into CircuityPython, and while compelling, it doesn't seem to support the kind of workflow we want nor was I able to find any documentation on how to update the code running on it via BLE.

Our custom bootloader (basically Nordic's stock bootloader) uses Softdevice s140 version 6.1.1, the same that the Adafruit uf2 bootloader uses. Is the softdevice the only requirement? Is there any way at all to do this? I'd even be open having to update the bootloader twice if needed: once to update to a modified uf2 that supports this kind of thing, and then the second time to a bootloader that supports DFU over BLE.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”