Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export macro_XXX_DEV macros (I2C_DEV) #17

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

chrysn
Copy link
Member

@chrysn chrysn commented Feb 14, 2023

This makes a build time assertion on the signature being (on the C side) compatible with a single unsigned value. For many types that's a property documented in C tests; for the others, it's conjecture that is aligned with their general perception.

Contributes-To: RIOT-OS/rust-riot-wrappers#37

This makes a build time assertion on the signature being (on the C side)
compatible with a single unsigned value. For many types that's a
property documented in C tests; for the others, it's conjecture that is
aligned with their general perception.

Contributes-To: RIOT-OS/rust-riot-wrappers#37
@chrysn
Copy link
Member Author

chrysn commented Feb 14, 2023

In addition to the CI tests, I'm also running a full buildtest (currently at k) on the rust_minimal test, with these extra lines:

FEATURES_OPTIONAL += periph_i2c
FEATURES_OPTIONAL += periph_spi
FEATURES_OPTIONAL += periph_pwm
FEATURES_OPTIONAL += periph_uart
FEATURES_OPTIONAL += periph_gpio
FEATURES_OPTIONAL += periph_adc
FEATURES_OPTIONAL += periph_timer
FEATURES_OPTIONAL += periph_qdec

(Otherwise, the relevant functions would not be built for lack of macro definitions.)

Before doing the bors test when merging the PR that'll pull this in to main RIOT, it may make sense to add a similar alteration there, just to make sure the tests actually cover relevant parts.

@chrysn
Copy link
Member Author

chrysn commented Feb 14, 2023

... and it's failing on samd10-xmini, investigating...

@chrysn
Copy link
Member Author

chrysn commented Feb 14, 2023

... which it also does without the changes of this commit, so let's see how the larger build test goes.

The concrete error I got is:

"make" -C /home/chrysn/git/RIOT/sys/picolibc_syscalls_default
/home/chrysn/git/RIOT/sys/picolibc_syscalls_default/syscalls.c:319:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  319 | _READ_WRITE_RETURN_TYPE read(int fd, void *dest, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/home/chrysn/git/RIOT/sys/picolibc_syscalls_default/syscalls.c:351:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  351 | _READ_WRITE_RETURN_TYPE write(int fd, const void *src, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~

which has the suspicious "picolibc" in there. Nothing wrong with picolibc probably, but it could be triggering some rarer code paths. I'll try not to lose track of it, but this is several layers of yak fur in.

@chrysn
Copy link
Member Author

chrysn commented Feb 14, 2023

OK, full boards survey:

  • samd10-xmini, nucleo-l011k4 and stm32f030f4-demo: same picolibc issue.
  • The riscv boards generally fail on my host, but built fine in Docker when using this branch and the modified rust_minimal test.

As this PR would only break things build time, that's all I can test.

@chrysn chrysn merged commit 3496769 into main Feb 14, 2023
@chrysn chrysn deleted the export_dev_init_macros_with_fixed_signature branch February 14, 2023 16:12
bors bot added a commit to RIOT-OS/RIOT that referenced this pull request Feb 20, 2023
19288: rust: Update riot-sys and riot-wrappers r=kaspar030 a=chrysn

### Contribution description

rust: Update riot-sys and riot-wrappers

* riot-wrappers:
  * Fix infinite loop when using a Mutex
  * Make ValueInThread Copy/Clone
* riot-sys:
  * Export xxx_DEV (eg. I2C_DEV) C macros as functions
  * Add auto_init_utils.h

### Testing procedure

CI checks should suffice.

### Issues/PRs references

This pulls in fixes from

* RIOT-OS/rust-riot-sys#18
* RIOT-OS/rust-riot-sys#17 / RIOT-OS/rust-riot-wrappers#37
* RIOT-OS/rust-riot-wrappers#42 / RIOT-OS/rust-riot-wrappers#41


Co-authored-by: chrysn <chrysn@fsfe.org>
chrysn added a commit that referenced this pull request Feb 24, 2023
This item was missed because it doesn't follow the XXX_DEV pattern used
by other peripherals.

See-Also: #17
Contributes-To: RIOT-OS/rust-riot-wrappers#36
@chrysn chrysn mentioned this pull request Feb 24, 2023
chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request Oct 12, 2023
chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request Oct 12, 2023
chrysn added a commit that referenced this pull request Oct 12, 2023
ADC_DEV does not exist in RIOT (and thus, no corresponding code was
generated for this ever); the macro that goes into adc_init's argument
is ADC_LINE.

Follow-up-for: #17
chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request Oct 12, 2023
chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request Oct 12, 2023
chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request Oct 13, 2023
chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request Oct 13, 2023
chrysn added a commit to RIOT-OS/rust-riot-wrappers that referenced this pull request Oct 20, 2023
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.

1 participant