Skip to content

cores: arduino: Split zephyrCommon.cpp#375

Open
soburi wants to merge 3 commits intoarduino:mainfrom
soburi:split_zephyrcommon
Open

cores: arduino: Split zephyrCommon.cpp#375
soburi wants to merge 3 commits intoarduino:mainfrom
soburi:split_zephyrcommon

Conversation

@soburi
Copy link
Copy Markdown

@soburi soburi commented Mar 1, 2026

Split zephyrCommon.cpp into small cpp files.

@soburi soburi force-pushed the split_zephyrcommon branch 2 times, most recently from a2f7406 to 4fbaf90 Compare March 1, 2026 14:32
@soburi soburi marked this pull request as ready for review March 1, 2026 17:02
Copilot AI review requested due to automatic review settings March 1, 2026 17:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Arduino Zephyr core by splitting the large zephyrCommon.cpp implementation into smaller, more focused compilation units. It also updates multiple sample CMakeLists.txt files to locate devicetree overlay files from variant directories (including revision-specific variants).

Changes:

  • Remove cores/arduino/zephyrCommon.cpp and replace it with separate wiring/utility/interrupt/tone source files.
  • Add cores/arduino/wiring_private.h to share devicetree-derived pin/port constants across the new units.
  • Update sample builds to select overlays from variant directories (including ${NORMALIZED_BOARD_TARGET}_${BOARD_REVISION}) and enable ADC/PWM in the blinky sample config.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
samples/threads_arduino/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/spi_controller/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/serial_event/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/i2cdemo/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/hello_arduino/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/fade/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/button_press_led/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/blinky_arduino/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/attach_interrupt/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/analog_input/CMakeLists.txt Adds variant directory + overlay selection logic.
samples/blinky_arduino/prj.conf Enables ADC/PWM configs for the blinky sample.
cores/arduino/zephyrCommon.cpp Removed; functionality redistributed into new files.
cores/arduino/wiring.cpp Adds yield/delay/micros/millis wiring functions.
cores/arduino/wiring_digital.cpp Adds pinMode/digitalRead/digitalWrite implementation.
cores/arduino/wiring_analog.cpp Adds PWM/ADC/DAC wiring implementation (gated by Kconfig).
cores/arduino/wiring_pulse.cpp Adds pulseIn() implementation.
cores/arduino/WInterrupts.cpp Adds attach/detach/noInterrupts/interrupts implementation.
cores/arduino/WMath.cpp Adds random/randomSeed implementation (when non-minimal libc).
cores/arduino/Tone.cpp Adds tone/noTone implementation.
cores/arduino/wiring_private.h Introduces shared devicetree-derived pin/port constants.
cores/arduino/CMakeLists.txt Replaces zephyrCommon.cpp with the new split source list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread samples/button_press_led/CMakeLists.txt Outdated
Comment thread samples/blinky_arduino/CMakeLists.txt Outdated
Comment thread samples/analog_input/CMakeLists.txt Outdated
Comment thread cores/arduino/wiring_private.h
Comment thread samples/serial_event/CMakeLists.txt Outdated
Comment thread cores/arduino/WInterrupts.cpp
Comment thread samples/blinky_arduino/prj.conf Outdated
Comment thread samples/threads_arduino/CMakeLists.txt Outdated
Comment thread samples/threads_arduino/CMakeLists.txt Outdated
Comment thread samples/spi_controller/CMakeLists.txt Outdated
@soburi soburi force-pushed the split_zephyrcommon branch 2 times, most recently from 8c8d243 to 9fb90ae Compare March 1, 2026 21:42
@soburi soburi requested a review from Copilot March 1, 2026 21:42
@soburi soburi force-pushed the split_zephyrcommon branch from 9fb90ae to 48685d8 Compare March 1, 2026 21:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cores/arduino/WInterrupts.cpp
Comment thread cores/arduino/Arduino.h Outdated
Comment thread cores/arduino/wiring_private.h Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@soburi soburi force-pushed the split_zephyrcommon branch from 83753ff to 97e1a67 Compare March 1, 2026 23:00
@soburi soburi marked this pull request as draft March 1, 2026 23:52
@per1234 per1234 added the enhancement New feature or request label Mar 2, 2026
@soburi soburi force-pushed the split_zephyrcommon branch 5 times, most recently from ae2cd5c to ed51751 Compare March 2, 2026 23:21
@soburi soburi marked this pull request as ready for review March 2, 2026 23:45
@soburi soburi marked this pull request as draft March 16, 2026 23:05
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 18, 2026

CLA assistant check
All committers have signed the CLA.

@soburi soburi force-pushed the split_zephyrcommon branch 3 times, most recently from 385e4f9 to 2518d18 Compare April 18, 2026 15:06
@soburi soburi force-pushed the split_zephyrcommon branch from 2518d18 to 5c09229 Compare April 18, 2026 22:12
@soburi soburi marked this pull request as ready for review April 18, 2026 22:21
@soburi soburi force-pushed the split_zephyrcommon branch from 5c09229 to e3bfd9f Compare April 18, 2026 22:29
@soburi soburi marked this pull request as draft April 19, 2026 04:19
@soburi soburi force-pushed the split_zephyrcommon branch 2 times, most recently from c8b9983 to 31a64ac Compare April 19, 2026 07:51
@github-actions
Copy link
Copy Markdown

Built 0.54.2-0.dev+31a64acd

CI run PASSED 🟢

ArtifactBoardCoreTestsRAMSketchesWarningsErrors
✅* zephyr_contrib ek_ra8d1 📗 ✅*

11.9%

22-
frdm_mcxn947 6 🏷️ ✅*

58.0%

22-
frdm_rw612 1 🏷️ ✅*

83.0%

22-
✔️* zephyr_main giga 4 🏷️ ✅*

54.6%

5612-
nano33ble 1 🏷️ ✅*

78.8%

2810-
nano_matter 📗 ✔️*

⚠️ 85.7%

2010(2*)
nicla_vision 4 🏷️ ✔️*

56.9%

5012(10*)
niclasense 2 🏷️ ✅*

⚠️ 87.4%

2610-
opta 4 🏷️ ✅*

56.5%

6028-
portentac33 3 🏷️ ✔️*

⚠️ 95.2%

6226(8*)
portentah7 3 🏷️ ✅*

57.2%

7026-
✅* zephyr_unoq unoq 📗 ✅*

26.9%

748-
Legend

BoardTestStatus description
🔥 🔥 Test run failed to complete.
🔴 Test completed with unexpected errors.
✔️* 🚫 Test completed with errors, but all are known/expected.
✅* 🟡 Test completed with some warnings; no errors detected.
🟢 Test passed successfully, with no warnings or errors.
🌑 🌑 Test was skipped.

@soburi soburi marked this pull request as ready for review April 19, 2026 08:46
soburi added 3 commits April 20, 2026 22:20
Replace {0} with {} for port_callback, set dac_channel_cfg::internal
explicitly, and expand adc_sequence initialization to make default
values explicit and avoid C++ initializer warnings.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Move constexpr-specified constants and functions used for compile-time
calculations from zephyrCommon.cpp to wiring_private.h

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Split zephyrCommon.cpp into small cpp files.

wirinig_digital.cpp:
  - pinMode
  - digitalWrite
  - digitalRead

wirinig_analog.cpp:
  - analogRead
  - analogWrite
  - analogReference
  - analogReadResolution
  - analogWriteResolution

wirinig_pulse.cpp:
  - pulseIn

WInterrupts.cpp:
  - attachInterrupt
  - detachInterrupt
  - interrupts
  - noInterrupts
  - digitalPinToInterrupt

WMath.cpp:
  - randomSeed
  - random

Tone.cpp:
  - tone
  - noTone

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
@soburi soburi force-pushed the split_zephyrcommon branch from 31a64ac to 75df269 Compare April 20, 2026 13:24
@github-actions
Copy link
Copy Markdown

Built 0.55.0-rc1-0.dev+75df2691

CI run FAILED: ❌ giga, ❌ nano33ble, ❌ nano_matter, ❌ niclasense, ❌ nicla_vision, ❌ opta, ❌ portentac33, ❌ portentah7, ❌ unoq, ❌ ek_ra8d1, ❌ frdm_mcxn947, ❌ frdm_rw612

ArtifactBoardCoreTestsRAMSketchesWarningsErrors
zephyr_contrib ek_ra8d1 📗

11.9%

2-2
frdm_mcxn947 6 🏷️

58.0%

2-2
frdm_rw612 1 🏷️

83.0%

2-2
zephyr_main giga 4 🏷️

54.6%

56-56
nano33ble 1 🏷️

78.8%

28-28
nano_matter 📗

⚠️ 85.7%

20-18 (+2*)
nicla_vision 4 🏷️

56.9%

42-36 (+6*)
niclasense 2 🏷️

⚠️ 87.4%

26-26
opta 4 🏷️

56.5%

60-58 (+2*)
portentac33 3 🏷️

⚠️ 95.2%

62-54 (+8*)
portentah7 3 🏷️

57.2%

70-68 (+2*)
zephyr_unoq unoq 📗

26.9%

74-74
Legend

BoardTestStatus description
🔥 🔥 Test run failed to complete.
🔴 Test completed with unexpected errors.
✔️* 🚫 Test completed with errors, but all are known/expected.
✅* 🟡 Test completed with some warnings; no errors detected.
🟢 Test passed successfully, with no warnings or errors.
🌑 🌑 Test was skipped.

Caution

zephyr_contrib is blocked due to failures on ek_ra8d1, frdm_mcxn947, frdm_rw612!

Caution

zephyr_main is blocked due to failures on giga, nano33ble, nano_matter, nicla_vision, niclasense, opta, portentac33, portentah7!

Caution

zephyr_unoq is blocked due to failures on unoq!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants