Uno R4 Wifi boot procedure

As a learning exercise, I am trying to run a minimal bare metal system on my Uno R4 Wifi. I've been able to make it work by reading the RA4M1 data sheet (https://www.renesas.com/us/en/document/mah/renesas-ra4m1-group-users-manual-hardware?r=1054146), and I can now make it blink an LED, print to uart, etc.

One thing that has been puzzling me though, is exactly how the boot procedure works. Normally, ARM Cortex M4f MCUs start by loading the reset address from the second entry of the vector table, and the vector table is expected to be at address 0x0. However, I need to set up the vector table at address 0x4000 for it to boot correctly. The RA4M1 data sheet says nothing about this - it seems that this is just defined by the standard Cortex M4 reference.

I found this out by looking into the Arduino core. Here in the linker script one can see that it does indeed put the vector table and everything else into flash starting at address 0x4000: https://github.com/arduino/ArduinoCore-renesas/blob/1c9b08697388a887d3a3114704661fdca0b4948c/variants/UNOWIFIR4/fsp.ld#L10

I cannot understand the reason for the 0x4000 location. Could it be that there is a boot loader running first that is involved in this?

Any help with understanding this would be greatly appreciated!

the reason for the 0x4000 location is the bootloader

Okay interesting. Is it possible to see how that works? Is the bootloader available anywhere in source or binary form?

hex is in the bootloader folder of the boards package. I already had to use it because I deleted it while making support for OTA update

ah thanks! found this here which refers on to the source code: https://github.com/arduino/ArduinoCore-renesas/tree/main/bootloaders/UNO_R4

the tinyusb fork is now here
https://github.com/arduino/tinyusb/tree/master

1 Like

but I don't see there the dfu example modified to a real bootloader

@ptillisch, can you help?

Oh, yeah I agree. The sources do not seem available currently. Thanks for notifying the developers!

Unfortunately I'm not able to help with this. I don't have any involvement in the development or management of the bootloaders for these boards.

I believe the bootloader source code has now been published:

and the documentation updated accordingly:

That does indeed seem to be the case! Well spotted!

1 Like