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

Emuflight 1.0.0 master rust #866

Draft
wants to merge 7 commits into
base: emuflight-1.0.0-master
Choose a base branch
from

Conversation

saidinesh5
Copy link
Contributor

@saidinesh5 saidinesh5 commented Sep 13, 2022

Here's a pull request for how to get started with Rust Integration in EmuFlight 1.0.0 . The code size is still slightly higher (~1kb) But overall, the integration was smooth. The idea is we move more and more functions to the rustemu crate (and delete them from the C codebase)

To test this out,

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Restart the terminal to make sure your PATH variable can use the rustup command and make sure to install the bare metal arm toolchain for rust installed:
rustup target add thumbv7em-none-eabihf
  • Then you can build emuflight using the regular Makefile
make TARGET=STM32F411

Let me know if there are any issues, so I can fix them before this is merged.

nerdCopter and others added 4 commits July 15, 2022 09:13
* github actions workflow

* Makefile
Rewrote encoding.c's zigzagEncode and castFloatBytesToInt in Rust
Added a basic Makefile integration to the rust sources
Ensured the unit tests pass on host
@saidinesh5 saidinesh5 mentioned this pull request Sep 13, 2022
@saidinesh5 saidinesh5 force-pushed the emuflight-1.0.0-master-rust branch 2 times, most recently from a29d856 to 2f1197a Compare September 16, 2022 06:00
@nerdCopter
Copy link
Member

nerdCopter commented Sep 16, 2022

@saidinesh5 , does make EXTRA_FLAGS=-Werror test-all work for you locally? This may or may not be external to the rust mods.

@saidinesh5
Copy link
Contributor Author

@nerdCopter this is weird error still. Makefile automatically deciding to compile the generated rustemu.h and failing..

$ make EXTRA_FLAGS=-Werror test-all
make: *** No rule to make target 'test-all'.  Stop.

@nerdCopter
Copy link
Member

nerdCopter commented Sep 16, 2022

without rust installed locally, i do sill have the test-all rule; albeit failing obviously

## emuflight-1.0.0-master-rust
$ make EXTRA_FLAGS=-Werror test-all
cd src/test && make test-all
make[1]: Entering directory '/media/disk2/SYNC/nerdCopter-GIT/EmuFlight_nerdRepo/src/test'
Falling back to 'clang'.
CC version: Debian clang version 11.0.1-2 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin
CXX version: Debian clang version 11.0.1-2 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin
compiling ../main/sensors/boardalignment.c 
compiling ../main/common/sensor_alignment.c 
compiling ../main/common/maths.c 
cd ../../src/rustemu && cargo +nightly build --release
/bin/sh: 1: cargo: not found
make[1]: *** [Makefile:682: ../../src/rustemu/target/x86_64-unknown-linux-gnu/release/librustemu.a] Error 127
make[1]: Leaving directory '/media/disk2/SYNC/nerdCopter-GIT/EmuFlight_nerdRepo/src/test'
make: *** [Makefile:715: test-all] Error 2

@saidinesh5
Copy link
Contributor Author

Yeah you need to install rust first. It is complaining about missing cargo command. For me locally the rust side builds just fine. the tests are another story though

@Quick-Flash
Copy link
Member

@nerdCopter what would it take to get this merged? This I do believe would become a big point that would help separate us from other firmware.

@Quick-Flash
Copy link
Member

@nerdCopter any luck building this?

@nerdCopter
Copy link
Member

@nerdCopter any luck building this?

nope. rust installed via this method: https://rustup.rs/
then ran the new commands in the github action.

rustup install nightly
rustup target add thumbv7em-none-eabihf
cargo install cbindgen

then ran make test, which fails
then ran make, which fails.

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