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

fix native compilation for linux PCs #3895

Merged
merged 2 commits into from
May 15, 2024
Merged

fix native compilation for linux PCs #3895

merged 2 commits into from
May 15, 2024

Conversation

mverch67
Copy link
Collaborator

@mverch67 mverch67 commented May 15, 2024

  • fix compiler guard PORTDUINO_LINUX_HARDWARE
  • fix logic for GPIO_lines search max loop

It looks like the native target is running only on machines that have SPI and GPIO (e.g. raspberry), otherwise it will crash with a message that spidev0.0 cannot be opened. It's not simulating SpiChip anymore.

Note: this PR relies on meshtastic/framework-portduino#27 and needs pull in the corresponding platform-native.

@mverch67
Copy link
Collaborator Author

mverch67 commented May 15, 2024

For tests I've added a target native-linux-pc, which runs well on my fedora linux PC. Should we add that target permanently?

[env:native-linux-pc]
extends = portduino_base
; The pkg-config commands below optionally add link flags.
; the || : is just a "or run the null command" to avoid returning an error code
build_unflags = -DPORTDUINO_LINUX_HARDWARE
build_flags = ${portduino_base.build_flags} -O0 -DARCH_PORTDUINO -I variants/portduino -I /usr/include
  !pkg-config --libs libulfius --silence-errors || :
  !pkg-config --libs openssl --silence-errors || :
board = cross_platform
lib_deps = ${portduino_base.lib_deps}
build_src_filter = ${portduino_base.build_src_filter}

@jp-bennett
Copy link
Collaborator

For tests I've added a target native-linux-pc, which runs well on my fedora linux PC. Should we add that target permanently?

I don't love it. At least not for working around an issue.

@mverch67
Copy link
Collaborator Author

mverch67 commented May 15, 2024

For tests I've added a target native-linux-pc, which runs well on my fedora linux PC. Should we add that target permanently?

I don't love it. At least not for working around an issue.

I think the issue was introduced in #3049 by defining PORTDUINO_LINUX_HARDWARE. Normally this could be detected during runtime. I remember there was some logic that uses SimSPIChip when the spidev cannot be opened.

@caveman99
Copy link
Member

meshtastic/framework-portduino#27 merged

@caveman99 caveman99 merged commit 7810e59 into master May 15, 2024
80 checks passed
@caveman99 caveman99 deleted the fix-guards branch May 15, 2024 10:25
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