Ada on Particle


#1

So, I’m experimenting with getting the Ada Ravenscar runtime going on a Particle device (the Argon).

The SoC in the Argon (nRF52840) happens to have the barebones of interface support already in the ada barebones project. From that I was able to put together a simple GPIO driver and get the binary built with the Ravenscar runtime.

Since Ravenscar can run on bare metal, the runtime I’m using includes its own initialization code and thus (I believe) the Particle boot loader isn’t needed.

My question: going from the memory layout I’m not totally certain what address I should be flashing to – I’m using the Particle debugger connector. From the hardware description files (https://github.com/AdaCore/bb-runtimes/blob/community-2019/arm/nordic/nrf52/memory-map_nRF52840.ld) it looks like I should be flashing to 0x00, but that seems to contradict what is in the data sheet.

I think the basis of my question is: if I want to do bare metal programming on the Argon, what is the correct address to flash to?


#2

On Particle devices, the bootloader is at 0xF4000. The SoftDevice is at 0x0.

The OpenOCD command to set the bld_addr (bootloader address) will look something like this:

openocd -f interface/$OPENOCD_IFACE.cfg -c 'adapter_khz 1000; transport select swd' -f target/nrf52-cfg -c "init" -c "bld_addr 0x0" -c "exit"

Replace or export $OPENOCD_IFACE with the interface file for your SWD/JTAG debugger.

To restore Particle firmware, set bld_addr back to 0xF4000, flash the softdevice to 0x0, flash the bootloader to 0xF4000. You’ll probably also want to restore system-part1 and user firmware/tinker as well, though you can do that by USB/DFU or SWD/JTAG.


#3

Hi Rick,

Thanks, that’s very helpful. While I was waiting on your response I went ahead and flashed it to 0x00 and it seems to work (my little program flashes the led). However, it seems then I’ve overwritten the soft device, which I will be needing presumably.

I’ll try flashing back the soft device and seeing if I can still get the program going from that address.

Thanks again!

Best,
JLS