Skip to content

Conversation

@saidinesh5
Copy link
Contributor

@Quick-Flash 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

  • 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.

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
@Quick-Flash
Copy link
Member

Do you know any of the process of adding this to our automation system? as you can see it breaks some of our checks :(

@saidinesh5
Copy link
Contributor Author

@Quick-Flash I couldn't find any logs on Codacy Static Code Analysis page. All it says is not analyzed: https://app.codacy.com/gh/emuflight/EmuFlight/commit?cid=659668051&fileBranchId=30902143

Can someone with access to the Static Analysis page login and see why it wasn't running?

Locally I made changes to the github builder workflow but that isn't even used in the 1.x branch so didn't push one.

@nerdCopter
Copy link
Member

nerdCopter commented Sep 8, 2022

i'll see what i can do, i just enabled Codacy on theemuflight:1.0.0-experimental branch yesterday upon seeing the comments.

Side-note: someone may have to setup new .github/workflows/build.yml for rust-compilation

@nerdCopter
Copy link
Member

fails even upon retires. i've had this happen before, sometimes a new push repairs, sometimes not.
image

@saidinesh5
Copy link
Contributor Author

@nerdCopter Yeah we need a new build.yml . Haven't added that because i am not sure how different our setup will be from betaflight's in 1.x

I think adding this should be enough for the build though.

    - name: Setup Rust
      run: |
        rustup update stable
        rustup target add thumbv7em-none-eabihf
        cargo install cbindgen

We didn't have to do this but i did it just to trigger a new CI build
@saidinesh5
Copy link
Contributor Author

Closing this pull request because Opened #866 to merge the rust changes into the correct branch

@saidinesh5 saidinesh5 closed this Sep 13, 2022
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