When trying to compile RIOT with Rust for esp32(s2,c3) targets i encountered some problems:
(The first two problems are unrelated to this crate but are mentioned since they should show up when testing this.)
- C2Rust compiled with xtensa compatible llvm needed (esp32,s2)
- C2Rust problematic macro translation https://github.com/immunant/c2rust/issues/803
causing non compiling code (esp32, s2, c3) - Some small things here in
rust-riot-sysneed to be considered:- Duplicate definitions are created (activate
keep-extern-typesto fix) - When using e.g.
netdev_defaultC++ files are pulled in and "pollute"compile-commands.json - The esps use
stdatomic.hwhen modulenetdev_defaultis in
- Duplicate definitions are created (activate
To circumvent the C2Rust macro problem the fork linked in the issue might be used or for simple test-cases the option --translate-const-macros can be removed from build.rs.
For the other 3 things concerning this crate i added ideas how to address them or make them more easily to find, but they definitely need further discussion:
- Duplicate definition of
__lockoccurs because it is transpiled differently by c2rust and thus doesn't get removed. I only added a warning for this to alert the user that something didn't go as expected - C++ files: added placeholder just kicking
clang++out not sure how to address this correctly- The problem here is that C++ files don't have the
std=c11flag and thus it gets kicked out by the consent strategy
- The problem here is that C++ files don't have the
- The atomic case is explained in
riot-c2rust.hi thought it might be nice to make this controllable via a feature.