Skip to content

Remove libbcm2835 in favour of spidev#252

Merged
petercsmith-x merged 16 commits into
xmos:developfrom
petercsmith-x:feature/rpi5-compat
Aug 1, 2025
Merged

Remove libbcm2835 in favour of spidev#252
petercsmith-x merged 16 commits into
xmos:developfrom
petercsmith-x:feature/rpi5-compat

Conversation

@petercsmith-x

Copy link
Copy Markdown
Contributor
  • Removes libbcm2835
  • Uses spidev ioctl to perform SPI instead, abstracting over the hardware so we have RPi 5 and 64-bit compatibility
  • Fixes a warning when building the I2C driver
  • Some clang-format changes

@xhuw xhuw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some comments. nice work though. Its great you got the proper linux drivers working, should make life easier for us in the future

As the deletion of device_access_spi_rpi.c could be a breaking change for users I think it would be good to check with @mbanth before we merge this change

@@ -0,0 +1,258 @@
// Copyright 2025 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#if USE_SPI && RPI

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is && RPI still correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suppose not, I assume we won't be shipping this out with the Linux build but any Linux machine with spidev could use this. I'll make it just USE_SPI.

Comment thread modules/sw_services/device_control/host/device_access_spi.c Outdated
@petercsmith-x

Copy link
Copy Markdown
Contributor Author

As the deletion of device_access_spi_rpi.c could be a breaking change for users I think it would be good to check with @mbanth before we merge this change

I've reverted the change after speaking with @mbanth.

Comment thread modules/sw_services/device_control/host/device_access_spi_rpi.c Outdated
struct timespec rem;
while(nanosleep(&req, &rem));
}
static long intertransaction_delay = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fair enough being explicit, but note ofc static variables are always 0 initialised anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm aware, just trying to stick to good practice of 0-initialising stuff that should be 0 lol.

{
data_len = control_build_spi_data(data_sent_recieved, resid, cmd, payload, payload_len);
}
if (resid == 0 && cmd == 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some ancient MISRA C senses from my first job are crying about this linter's decisions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Might have been a me decision as this would probably be a clippy issue in 🦀 Rust 🦀

@petercsmith-x
petercsmith-x merged commit be4d6b9 into xmos:develop Aug 1, 2025
4 checks passed
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.

3 participants