core: PWM/ADC constants make into constexpr#476
Open
soburi wants to merge 1 commit into
Open
Conversation
ff489bf to
140730b
Compare
Built
|
| Artifact | Board | Core | Tests | RAM | Sketches | Warnings | Errors |
|---|---|---|---|---|---|---|---|
✅* zephyr_contrib |
ek_ra8d1
| 📗 | ✅* |
11.9% |
2 | 2 | - |
frdm_mcxn947
| 7 🏷️ | ✅* |
58.0% |
2 | 2 | - | |
frdm_rw612
| 2 🏷️ | ✅* |
83.0% |
2 | 2 | - | |
✔️* zephyr_main |
giga
| 5 🏷️ | ✅* |
54.7% |
56 | 16 | - |
nano33ble
| 1 🏷️ | ✅* |
78.8% |
28 | 10 | - | |
nano_matter
| 1 🏷️ | ✅* |
|
20 | 8 | - | |
nicla_vision
| 5 🏷️ | ✔️* |
57.0% |
50 | 8 | (10*) | |
niclasense
| 2 🏷️ | ✅* |
|
26 | 10 | - | |
opta
| 5 🏷️ | ✅* |
57.7% |
62 | 18 | - | |
portentac33
| 3 🏷️ | ✔️* |
|
64 | 8 | (8*) | |
portentah7
| 4 🏷️ | ✅* |
58.4% |
72 | 16 | - | |
✅* zephyr_unoq |
unoq
| 📗 | ✅* |
26.9% |
74 | 8 | - |
Legend
Board Test Status 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.
There was a problem hiding this comment.
Pull request overview
This PR moves PWM/ADC devicetree-derived constant arrays out of wiring_analog.cpp into wiring_private.h, and converts them to constexpr so they can be evaluated/initialized at compile time alongside other pin mapping constants.
Changes:
- Add
constexprPWM/ADC dt-spec and pin-mapping arrays tocores/arduino/wiring_private.h. - Remove the corresponding
constarrays and helper macros fromcores/arduino/wiring_analog.cpp.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cores/arduino/wiring_private.h |
Introduces constexpr PWM/ADC spec + pin mapping arrays and supporting DT helper macros. |
cores/arduino/wiring_analog.cpp |
Removes local PWM/ADC arrays/macros and relies on the shared definitions from wiring_private.h. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+18
to
+26
| #define PWM_DT_SPEC(n, p, i) PWM_DT_SPEC_GET_BY_IDX(n, i), | ||
| #define PWM_PINS(n, p, i) \ | ||
| DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), p, i)), \ | ||
| DT_PHA_BY_IDX(DT_PATH(zephyr_user), p, i, pin)), | ||
|
|
||
| #define ADC_DT_SPEC(n, p, i) ADC_DT_SPEC_GET_BY_IDX(n, i), | ||
| #define ADC_PINS(n, p, i) \ | ||
| DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), p, i)), \ | ||
| DT_PHA_BY_IDX(DT_PATH(zephyr_user), p, i, pin)), |
Move the constant array derived from devicetree to wiring_private.h and convert it to constexpr. Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Built
|
| Artifact | Board | Core | Tests | RAM | Sketches | Warnings | Errors |
|---|---|---|---|---|---|---|---|
✅* zephyr_contrib |
ek_ra8d1
| 📗 | ✅* |
11.9% |
2 | 2 | - |
frdm_mcxn947
| 7 🏷️ | ✅* |
58.0% |
2 | 2 | - | |
frdm_rw612
| 2 🏷️ | ✅* |
83.0% |
2 | 2 | - | |
✔️* zephyr_main |
giga
| 5 🏷️ | ✅* |
54.7% |
56 | 16 | - |
nano33ble
| 1 🏷️ | ✅* |
78.8% |
28 | 10 | - | |
nano_matter
| 1 🏷️ | ✅* |
|
20 | 8 | - | |
nicla_vision
| 5 🏷️ | ✔️* |
57.0% |
50 | 8 | (10*) | |
niclasense
| 2 🏷️ | ✅* |
|
26 | 10 | - | |
opta
| 5 🏷️ | ✅* |
57.7% |
62 | 18 | - | |
portentac33
| 3 🏷️ | ✔️* |
|
64 | 8 | (8*) | |
portentah7
| 4 🏷️ | ✅* |
58.4% |
72 | 16 | - | |
✅* zephyr_unoq |
unoq
| 📗 | ✅* |
26.9% |
74 | 8 | - |
Legend
Board Test Status 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.
|
Memory usage change @ 7422deb
Click for full report table
Click for full report CSV |
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.
Move the constant array derived from devicetree to wiring_private.h and convert it to constexpr.