Add RMC-RA4M1 (rev.2.0) and fix board definition issues - #555
Open
todateman wants to merge 12 commits into
Open
Conversation
Corrected preprocessor directives for RMC-RA4M1 (rev.2.0)
12 tracked entries (tinyusb tusb.{c,h}/tusb_option.h, FATFilesystem's
FatFs sources, LittleFilesystem's littlefs sources) had git mode
120000 (symlink) but blob content containing the full C source text
instead of a symlink target path. On checkout this produced either a
missing file (target too long for a valid symlink) or a dangling
symlink whose "target" was garbage source text, breaking any build
that compiles cores/arduino or these libraries.
Re-point each entry to the actual vendored source under extras/
(extras/tinyusb/src/... and extras/Filesystems/{FatFs,littlefs}/...),
matching the working symlink pattern already used for
libraries/ESPhost/src/protobuf-c/*.
libraries/WiFiS3/src/WiFiCommands.h has the same corruption but its
correct target could not be identified and is left untouched
(unrelated to this task; WiFiS3 is not used by the RMC-RA4M1 board).
Syncs with arduino/ArduinoCore-renesas, bringing in ~255 upstream commits (v1.3.2 -> v1.6.0: Nano R4 support, SE05X crypto rework, Arduino_SE05X submodule, WiFiS3/RTC/FreeRTOS/core fixes, etc.). While resolving conflicts it became clear that the previous "Add RMC-RA4M1(rev.2.0)" commit (a094156) had accidentally bundled in a full revert of many unrelated core/library files down to the v1.0.4 release (verified byte-for-byte identical to the v1.0.4 tag for every conflicting file: WMath.cpp, main.cpp, time.cpp, drivers/renesas.*, Arduino_FreeRTOS port.c, RTC.cpp + example, SoftwareSerial.cpp, the WiFiS3 sources, and Wire.cpp), alongside the legitimate RMC-RA4M1 additions. Conflicts in those files were resolved by taking upstream's current versions, discarding the accidental v1.0.4 regression; the RMC-RA4M1-specific content (boards.txt rmc_ra4m1_20 section, variants/rmc_ra4m1_20/, package.json) is preserved. Submodule pointers (extras/fsp, extras/tinyusb, extras/uno-r4-wifi-usb-bridge) were likewise rewound by that same commit; updated back to upstream's versions and initialized the new extras/Arduino_SE05X submodule.
- boards.txt: build.defines used "-DRMC-RA4M1_REV2.0", which contains a hyphen and a dot and is not a valid C preprocessor identifier (Arduino IDE compiles would fail with "macro names must be identifiers"). Changed to -DARDUINO_RMC_RA4M1_20. - boards.txt: added the debug.server.openocd.scripts.*/debug.svd_file lines (present for minima/unor4wifi but missing here) so Arduino IDE debugging works; R7FA4M1AB is the same silicon as MINIMA. - variants/rmc_ra4m1_20/cxxflags.txt: was missing -mfpu=fpv4-sp-d16 (present in cflags.txt and in MINIMA's cflags.txt/cxxflags.txt). PlatformIO's builder splits cflags.txt/cxxflags.txt into a CFLAGS/CXXFLAGS difference set, so every .cpp/.ino file was being compiled without the FPU flag while .c files had it, risking a float-ABI mismatch at link time. - variants/rmc_ra4m1_20/variant.cpp: initVariant() was missing the FspTimer::set_initial_timer_channel_as_pwm() calls for D3/D5/D6/ D9/D10/D11 that MINIMA's initVariant() has. These pins map to the same physical RA4M1 pins as MINIMA and support PIN_CFG_REQ_PWM, so analogWrite() would not have worked on them without this.
This entry was tracked with git mode 120000 (symlink) but its blob content was the full 4919-byte C header text instead of a short symlink target path -- the same corruption pattern fixed for 12 other files in f13bdaa, which explicitly left this one untouched because no correct symlink target could be identified. That omission broke CI: actions/checkout tries to materialize this tree entry as a real symlink, and a target this long overflows PATH_MAX, so checkout fails with "File name too long" before any job logic runs. This took down every job in both Compile Examples and Sync Labels (both failing at the initial checkout step, unrelated to RMC-RA4M1 or the upstream sync content). Since no other copy of this content exists to symlink to, materialize it as a regular file (mode 100644) instead -- the content itself was already correct.
Upstream tracks cores/arduino/api as a symlink into the ArduinoCore-API submodule/checkout, so a plain "rm" is enough there. This fork carries it as a real, fully-populated directory instead (needed since PlatformIO's builder reads these files directly, not through a symlink), so the same plain "rm" fails with "Is a directory" and aborts every compile-test matrix job before it gets to actually compiling anything. Use rm -rf so it works for both a symlink and a real directory.
The upstream sync merge (b0ab7af) only resolved files where a094156's old content and upstream's newer content touched the same lines, since those surfaced as real merge conflicts. Files a094156 reverted where upstream's subsequent history never touched the same lines merged "cleanly" -- silently keeping a094156's stale v1.0.4-era content instead of picking up upstream's changes. Found by diffing e9d112e (merge-base) against a094156 to get the full set of files that commit touched, then checking which of those have not been modified since (i.e. survived the merge unchanged) and still differ from upstream/main today. Confirmed concretely: libraries/RTC/src/RTC.h was missing the `setAlarm(RTCTime&, AlarmMatch&)` declaration that RTC.cpp (which *was* merge-conflicted and correctly updated) calls, breaking the build with "no 'bool RTClock::setAlarm(...)' member function declared" -- this is what "Compile Examples" was failing on. The other files in this commit (cores/arduino/*, libraries/Arduino_CAN, OTAUpdate, BlockDevices, Storage, WiFiS3, etc.) have the identical stale-revert signature and are restored to upstream/main's current content for the same reason. cores/arduino/api/* and cores/arduino/tinyusb/{class,common,device, host,osal,rusb2}/* also showed up in this analysis but are excluded here: upstream tracks those as symlinks (into a CI-checked-out ArduinoCore-API / the tinyusb submodule) rather than real files, so they aren't directly comparable, and the tinyusb ones were verified to already match extras/tinyusb's current content byte-for-byte.
The previous restoration (35d91d5) only caught files that a094156 touched and that were never modified again afterwards. These 12 files were also reverted by a094156, but the upstream merge (b0ab7af) did apply *some* of upstream's subsequent changes to them via non- conflicting hunks -- so git considered them "changed since a094156" and they were skipped, while other hunks in the same files silently kept a094156's stale v1.0.4-era content. Concretely this is what broke "Compile Examples" for the git_* build matrix (arduino-git:renesas:{minima,wifi,nanor4,c33}): - libraries/Storage/storage_common.h: symbols renamed upstream (rns_storage_dbg_buf/rns_storage_dbg) had reverted back to the old names (debug_buffer/debug), breaking every BlockDevices/*.cpp file that calls the rns_storage_dbg_if() macro. - libraries/Arduino_CAN/src/R7FA4M1_CAN.{cpp,h}: was missing the begin(uint32_t), setFilterMask_*/setFilterId_* API upstream added, causing a type-mismatch build error in the CAN examples. Re-derived the file set properly this time: intersect every file a094156 touched (vs merge-base e9d112e) with every file that still differs from upstream/main today, rather than only ones untouched since a094156. boards.txt, package.json, installed.json and libraries/WiFiS3/src/WiFiCommands.h also matched that intersection but were excluded after manual review -- their only remaining differences are legitimate fork-specific content (RMC-RA4M1 board section, package metadata, the already-fixed symlink) with nothing upstream to adopt. cores/arduino/api/* is excluded for the same reason as before (tracked as a symlink upstream, not comparable as a file).
cores/arduino/analog.cpp's AVCC-based analogReference() path uses AR_INTERNAL_VOLTAGE (already defined by MINIMA/UNOWIFIR4's pins_arduino.h), which rmc_ra4m1_20's pins_arduino.h never defined. This went unnoticed while analog.cpp itself carried a094156's stale content (which didn't reference this macro yet); restoring analog.cpp to upstream's current version in the previous commit surfaced the missing definition as a hard compile error. RMC-RA4M1 uses the same R7FA4M1AB internal reference circuit as MINIMA, so reuse the same value (1.43f).
… remaining symlinks The earlier upstream-sync merge (b0ab7af) silently kept a094156's reverted submodule pointers for these three, the same "clean merge picks the unchanged/stale side" pattern documented in 35d91d5: upstream never re-touched these gitlinks after the merge-base, so a 094156a's stale pointers merged without conflict. My follow-up `checkout --theirs` afterwards was a no-op since git only honors --theirs on paths that are actually unmerged, so it silently didn't fix anything either. Checked out all three to upstream/main's actual current pointers: - extras/fsp: 5d13f916 -> 9b5a853b - extras/tinyusb: c796dcfe -> ecfa7a04 - extras/uno-r4-wifi-usb-bridge: 54e83e40 -> 4394ba03 This picks up a real upstream tinyusb fix: tuh_hid_report_received_cb gained TU_ATTR_WEAK (upstream tinyusb PR "hid_fixes"), which is what "arduino-git:renesas:portenta_c33" was failing to link on (undefined reference, since the old tinyusb commit required an app-provided implementation that doesn't exist here). Also re-pointed cores/arduino/tinyusb/{class,common,device,host,osal, rusb2} as directory symlinks into the (now-current) extras/tinyusb checkout, matching upstream's actual layout (upstream symlinks each one individually; rusb2 in particular now lives under extras/tinyusb/src/portable/renesas/rusb2 following a tinyusb directory reorg, not extras/tinyusb/src/rusb2). These were previously materialized as real files with content that happened to match the old submodule commit, which is why the earlier corrupted-symlink pass didn't need to touch them -- but that also meant they wouldn't track future submodule updates, which is exactly the bug just described. libraries/WiFiS3/src/WiFiCommands.h: also re-pointed as a proper symlink to extras/uno-r4-wifi-usb-bridge/UNOR4USBBridge/commands.h (confirmed via the upstream repo's actual symlink target), rather than the plain-file materialization from 7e66211. That materialized content was a094156's stale version and was missing several AT command macros (_GETTIME, _CLIENTCONNECT, _SETECCSLOT, _SSLCLIENTCONNECT, _SERVERACCEPT, ...) that current WiFiS3 sources reference, which is what broke arduino-git:renesas:unor4wifi with "'_GETTIME' was not declared in this scope" etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a significant update to the Arduino core API by adding a full implementation of the
apidirectory undercores/arduino, which includes CAN bus support, core utility functions, and compatibility layers. It also updates the build workflow to improve reliability and adds a new board definition for the RMC-RA4M1 (rev.2.0).The most important changes are:
1. Addition of Arduino Core API Source Files
cores/arduino/api, includingArduinoAPI.h,Common.h/.cpp,Compat.h, and network/CAN-related files (CanMsg.h/.cpp,CanMsgRingbuffer.h/.cpp,HardwareCAN.h,Client.h). These provide standard Arduino API functionality, CAN bus message structures, and compatibility layers for legacy code. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]2. CAN Bus Support
CanMsg,CanMsgRingbuffer,HardwareCAN) to support CAN bus communication, including message representation, ring buffer management, and an abstract hardware interface for CAN peripherals. [1] [2] [3] [4] [5]3. Core Utility and Compatibility Enhancements
Common.h/.cpp, such as pin and analog I/O, bit manipulation, math helpers, and timing functions. AddedCompat.hfor backward compatibility with older Arduino code. [1] [2] [3]4. Build Workflow Improvement
.github/workflows/compile-examples.ymlto userm -rfinstead ofrmwhen removing the old API directory, ensuring that the directory is removed even if it contains files.5. New Board Definition
Arduino RMC-RA4M1(rev.2.0)board toboards.txt, enabling support for this new hardware variant, including build, upload, and debug parameters.These changes collectively modernize and extend the Arduino core, especially by adding CAN bus capabilities and support for new hardware.