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!