Saw this a couple months too late to reply directly but as the author of ra-hal I'd like to clarify a couple things.
First, Carlos didn't quite fork ra-hal. He wrote and contributed the USB full-speed driver and updates to the ADC driver. He deserves quite a bit of appreciation for that, but what's on Github is his dev sandbox and shouldn't be used directly. Subsequent versions of ra-hal include support for other models in the RA lineup and the USB driver was updated to also support the high-speed USB peripheral on boards that have it.
Second, the RA4M1 is not beginner friendly. If you stray too far off the reservation you will likely brick your board. I did this a couple days ago to a Renesas RISC-V board because of similar footguns. Whoops. With ra-hal you don't need to modify or create your own memory.x or jump through similar hoops, and current versions no long expose memory.x directly. Using link.x from cortex-m-rt is very likely to brick your RA4M1 (and other RA models with a similar clock tree) if you don't pay attention to the fine print. Unfortunately I didn't explicitly call this out as important in the docs or README. The safest and easiest thing is to just use the cargo-generate compatible template linked to in the README.
ArduinoCore works because they use the Renesas C HAL (FSP) which generates the appropriate linker scripts on demand. The version of ra-hal Carlos used with provides its own linker scripts to replace the ones provided by the cortex-m-rt crate. Later versions of ra-hal also generate the memory.x portion on the fly depending on which board features are enabled. These are available on Sourcehut and periodically released on crates.io.
The examples in ra-hal work because the build script uses the linker scripts from ra-hal.
What you should not do is use the link.x script from the cortex-m-rt (or riscv-rt) crate with an RA or Tokyo5 board. The main linker script in ra-hal includes some minimal sanity checks to help avoid bricking the board. However, the template linked to in the README and the in-tree examples generate working binaries using the ra-hal linker scripts.
1 post - 1 participant