Skip to content

Add RMC-RA4M1(rev.2.0) - #26

Open
todateman wants to merge 3 commits into
platformio:developfrom
todateman:develop
Open

todateman wants to merge 3 commits into
platformio:developfrom
todateman:develop

Conversation

@todateman

Copy link
Copy Markdown

Add RMC-RA4M1(R7FA4M1AB3CFP)
https://www2.himdx.net/mcr/product/download.html#ra4m1

"rmc_ra4m1_20.json" was created based on "uno_r4_minima.json".
"svd_path" is the same as R4 MINIMA, so you may need to modify it if you want to debug. (I haven't checked this.)

@ivankravets
ivankravets requested a review from valeros January 1, 2025 19:05
@valeros

valeros commented Jan 2, 2025

Copy link
Copy Markdown
Member

Hi @todateman, thanks for the PR. I'm afraid your manifest won't work as you expect, mainly because there is no such variant rmc_ra4m1_20 in the Arduino core for Renesas devices. You could use the same variant as for the R4 MINIMA board just to compile the code, but I believe the pinout of RMC-RA4M1 differs significantly from R4 MINIMA which will lead to non-obvious issues.

@todateman

Copy link
Copy Markdown
Author

Hi, @valeros
Thank you for confirming.

I forked a repository that includes rmc_ra4m1_20 in the variants directory of ArduinoCore-renesas.

https://github.com/todateman/framework-arduinorenesas-uno-mcr_rev20

You may be able to approve my pull request after the pull request to ArduinoCore-renesas is approved.

@valeros

valeros commented Jan 2, 2025

Copy link
Copy Markdown
Member

You may be able to approve my pull request after the pull request to ArduinoCore-renesas is approved.

Great, your PR will be merged, once a new stable version of ArduinoCore-renesas is released.

…MSIS variant folder

- boards/rmc_ra4m1_20.json: extra_flags had "-DARDUINO_RMC-RA4M1",
  a hyphenated string that is not a valid C macro identifier. Passed
  straight through to gcc as -D, this makes every compile fail with
  "error: macro names must be identifiers". Changed to
  -DARDUINO_RMC_RA4M1_20 (matches the framework-arduinorenesas-uno
  boards.txt fix).
- boards/rmc_ra4m1_20.json: debug.jlink_device was "ra4m1", not a
  device J-Link recognizes; changed to "R7FA4M1AB" to match
  uno_r4_minima.json/uno_r4_wifi.json.
- builder/frameworks/fsp.py, cmsis.py: framework-renesas-fsp and
  framework-cmsis-renesas only ship pre-generated variant folders for
  MINIMA, UNOWIFIR4 and PORTENTA_C33 -- there is no "rmc_ra4m1_20"
  folder in either package, so LDSCRIPT_PATH/CPPPATH/LIBPATH pointed
  at nonexistent paths and the build would fail before even reaching
  framework-arduinorenesas-uno. RMC-RA4M1 uses the same R7FA4M1AB
  silicon/memory map as MINIMA, so alias the lookup in these two
  files only ("MINIMA" when board.id == "rmc_ra4m1_20"); framework-
  arduinorenesas-uno's own variant resolution (arduino.py) is
  untouched and still uses the real rmc_ra4m1_20 variant.
Syncs with platformio/platform-renesas-ra (v1.5.0 -> v1.9.0: Nano R4
board support, other platform.py/fsp.py updates), resolving the
board.id-tuple conflicts in builder/frameworks/fsp.py and platform.py
that both upstream's nano_r4 addition and this fork's rmc_ra4m1_20
addition touched -- merged to include both board ids rather than
picking one side. boards/rmc_ra4m1_20.json and its extra_flags/
jlink_device fixes are untouched.
@todateman

Copy link
Copy Markdown
Author

Rebased on top of develop (v1.5.0 -> v1.9.0) to resolve the merge conflicts against upstream's Nano R4 addition -- builder/frameworks/fsp.py and platform.py both had the board.id in (...) tuple touched by both changes, merged to include both nano_r4 and rmc_ra4m1_20 rather than picking one side. Verified locally that pio run still builds successfully for rmc_ra4m1_20 after the rebase.

Also fixed two build-breaking issues found while verifying:

  • boards/rmc_ra4m1_20.json's extra_flags had -DARDUINO_RMC-RA4M1, which contains a hyphen and isn't a valid C preprocessor identifier -- passed straight through as a -D flag this made every compile fail with error: macro names must be identifiers. Changed to -DARDUINO_RMC_RA4M1_20.
  • debug.jlink_device was "ra4m1", not a device J-Link recognizes; changed to "R7FA4M1AB" to match uno_r4_minima.json/uno_r4_wifi.json.

On @valeros's earlier point about the MINIMA-variant workaround: framework-arduinorenesas-uno (the Arduino core fork this board depends on, https://github.com/todateman/framework-arduinorenesas-uno-mcr_rev20) now has its own dedicated rmc_ra4m1_20 variant with RMC-RA4M1's actual pin mapping, clock config and peripherals -- it's not sharing MINIMA's variant for pin/peripheral purposes. The MINIMA fallback in fsp.py/cmsis.py here is narrower than that: framework-renesas-fsp and framework-cmsis-renesas only ship pre-generated BSP/CMSIS config and linker files for MINIMA, UNOWIFIR4 and PORTENTA_C33, with no rmc_ra4m1_20 folder of their own. Since RMC-RA4M1 uses the same R7FA4M1AB silicon and the same clock/BSP config and linker script as MINIMA (verified bit-identical against framework-arduinorenesas-uno-mcr_rev20's own MINIMA variant), aliasing just that lookup to MINIMA's folder is safe without affecting the actual pin/peripheral definitions, which come entirely from framework-arduinorenesas-uno's own rmc_ra4m1_20 variant.

I understand getting rmc_ra4m1_20 upstreamed into arduino/ArduinoCore-renesas itself (so framework-renesas-fsp/framework-cmsis-renesas could ship a real variant folder for it) is a separate, bigger effort -- happy to discuss further if that's still a blocker for merging this.

@todateman

Copy link
Copy Markdown
Author

Hi @valeros, could you approve the pending workflow run for this PR?

The Examples workflow run (https://github.com/platformio/platform-renesas-ra/actions/runs/32871283274) never started any jobs — it required maintainer approval (since I'm an external/first-time contributor) and that approval window expired after 30 days, so it failed without actually running anything. The workflow file itself is fine; it's just stuck on the approval gate.

Could you approve it from the Actions tab, or let me know if I should push a new commit to trigger a fresh run for you to approve?

@todateman

todateman commented Sep 24, 2026 •

Copy link
Copy Markdown
Author

Sorry, @valeros.
I'll wait until a new stable release of ArduinoCore-renesas includes arduino/ArduinoCore-renesas#555, and follow up here once that's out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants