ragarnoy / a121-rs Goto Github PK
View Code? Open in Web Editor NEWAcconeer's A121 Rust Bindings
License: MIT License
Acconeer's A121 Rust Bindings
License: MIT License
We need to figure out a decent way to host the libs somewhere and fetch them in the CI
I haven't quite figured out the solution on arm yet, but it seems that adding this to the .cargo/config.toml
"-C", "link-arg=-lm"
combined with:
RUSTFLAGS='-L /usr/lib/arm-none-eabi/lib' cargo build --release
allows you to compile without needing any of them.
Might be a good idea to make a tag for the current version released on crates.io. I think this commit is the point-in-time. a0200a2
Cross-posting this issue: https://github.com/esp-rs/esp-wifi/issues/438
I use another crate which wraps some C code. That crate and this crate both rely on the C functions listed in the title. When both crates are used, the compiler dies of an aneurysm. Would it make sense to make a default-enabled feature which enables these functions inside the crate, but that users can opt-out of if they have implemented them inside their own parent project?
From my experience, I've had really odd results with the distance module
I either would get:
I'm trying to get this crate running on the esp32c6 (riscv32imac), which is very similar to the esp32c3 (riscv32imc).
The sample and static libraries provided by Acconeer (acconeer_esp32c3_xe121_a121-v1_5_0) already run fine on both the esp32c3 and the esp32c6, so I don't see any issues getting this crate to compile with the static binaries from there. Note that the esp32c3 sample/libraries are not available from the developer site directly (yet), but need to be requested via a support ticket.
So, I have already started working on this by creating a new no_std sample for the c6, see my fork here. I have placed the static libraries in ./acc inside the sample.
However, I'm still quite new to bindgen. In the current state, I'm running into two issues:
riscv32-unknown-elf-gcc
instead of riscv32-esp-elf-gcc
(what espup provides and what acconeer used to compile the static binaries) -> any idea how to make it use riscv32-esp-elf-gcc?riscv32-unknown-elf-gcc
via https://github.com/riscv-collab/riscv-gnu-toolchain, the compiler makes a little bit more progress before failing with: Compiling a121-rs v0.1.2 (/home/leon/Desktop/ivy/code/a121-rs)
The following warnings were emitted during compilation:
warning: [email protected]: Compiler version doesn't include clang or GCC: "riscv32-unknown-elf-gcc" "--version"
error: failed to run custom build command for `a121-rs v0.1.2 (/home/leon/Desktop/ivy/code/a121-rs)`
Caused by:
process didn't exit successfully: `/home/leon/Desktop/ivy/code/a121-rs/examples/esp32c6-hal/target/debug/build/a121-rs-aaaf6a900988df96/build-script-build` (exit status: 101)
--- stdout
cargo:rustc-link-search=/home/leon/Desktop/ivy/code/a121-rs/lib
cargo:rustc-link-lib=static=acconeer_a121
cargo:rustc-link-lib=static=acc_detector_distance_a121
cargo:rerun-if-changed=/home/leon/Desktop/ivy/code/a121-rs/rss/include
TARGET = Some("riscv32imac-unknown-none-elf")
OPT_LEVEL = Some("s")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CC_riscv32imac-unknown-none-elf
CC_riscv32imac-unknown-none-elf = None
cargo:rerun-if-env-changed=CC_riscv32imac_unknown_none_elf
CC_riscv32imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
RUSTC_LINKER = None
cargo:rerun-if-env-changed=CROSS_COMPILE
CROSS_COMPILE = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:warning=Compiler version doesn't include clang or GCC: "riscv32-unknown-elf-gcc" "--version"
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("a,c,m")
cargo:rerun-if-env-changed=CFLAGS_riscv32imac-unknown-none-elf
CFLAGS_riscv32imac-unknown-none-elf = None
cargo:rerun-if-env-changed=CFLAGS_riscv32imac_unknown_none_elf
CFLAGS_riscv32imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=AR_riscv32imac-unknown-none-elf
AR_riscv32imac-unknown-none-elf = None
cargo:rerun-if-env-changed=AR_riscv32imac_unknown_none_elf
AR_riscv32imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_AR
TARGET_AR = None
cargo:rerun-if-env-changed=AR
AR = None
cargo:rerun-if-env-changed=ARFLAGS_riscv32imac-unknown-none-elf
ARFLAGS_riscv32imac-unknown-none-elf = None
cargo:rerun-if-env-changed=ARFLAGS_riscv32imac_unknown_none_elf
ARFLAGS_riscv32imac_unknown_none_elf = None
cargo:rerun-if-env-changed=TARGET_ARFLAGS
TARGET_ARFLAGS = None
cargo:rerun-if-env-changed=ARFLAGS
ARFLAGS = None
cargo:rustc-link-lib=static=log
cargo:rustc-link-search=native=/home/leon/Desktop/ivy/code/a121-rs/examples/esp32c6-hal/target/riscv32imac-unknown-none-elf/debug/build/a121-rs-392adf043e17b2bb/out
cargo:rerun-if-changed=c_src/wrapper.c
cargo:rustc-link-lib=static=log
--- stderr
ACC_RSS_LIBS: /home/leon/Desktop/ivy/code/a121-rs/lib
/usr/lib/llvm-14/lib/clang/14.0.0/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
thread 'main' panicked at /home/leon/Desktop/ivy/code/a121-rs/build.rs:60:40:
Unable to generate bindings: ClangDiagnostic("/usr/lib/llvm-14/lib/clang/14.0.0/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found\n")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Any idea how to continue from here?
The include folder contains:
These are standard headers that should be included with your compiler install.
Having them in tree manually will at some point cause trouble like it did with me when I compiled things with the esp compiler that uses different versions of those headers.
The calibrate and prepare functions both take in a buffer that is only useful for the duration of the calibration/preparation, their size can depend on the user's requirements, but we can assume it should be superior to the size returned by acc_rss_get_buffer_size
I was going through the code and found this:
Lines 16 to 29 in 750ebff
A better API would be to let the user pass a `'static' instance of the hal impl themselves. This is already kinda done with the spi here:
Lines 64 to 69 in 750ebff
This would also allow for not using the dyn trait
and use full generics which would make things more efficient.
a121-rs/src/detector/distance/config.rs
Line 78 in 7510386
Currently the CI only runs for the A121 Library, it needs to have a new job that tries to compile the examples
It -should- not be very hard since the difference is mainly that the CS line needs to be switched which is already done by the SpiDevice... But it hasn't been tried yet
Current Sensor implementation is lackluster, the typestate doesn't work properly for a struct that is part of another struct, the typestate should only exist for Radar, radar should have the main big functions (calibration, prepare, measure, hibernate, etc), while sensor should just be an interface to the low level functions.
The build chain is becoming too complex, creating a -sys crate would help
I found this code:
Lines 18 to 26 in 750ebff
It should be up to the users to define the global allocator. They might want it in a special memory region or want to use a specific implementation.
But also, if all libraries do this, then they cannot coexist.
The distance detector module was implement, but the presence detector still needs to be done.
I have not looked at all at the code for now, no idea how hard it'd be.
There needs to be an alternative to the current way interfacing is done that preferably doesn't necessitate nightly
The C SDK has assembly tests that could be ran by rust code
target
directoriesCurrently, the fetches the acconeer libraries and builds against them, but it would be way more interesting to generate stub libraries with the same symbols. The CI only needs to build against the library, not to flash a board, so in theory it'd work.
Currently modifying the config when the antenna is running does not behave like expected. The new configuration is not applied.
Maybe there should be a mechanism to lock the config and require a reset to change it?
Currently defmt is forced on the end user, this needs to change
Most of it can be taken from the C code and adapted to Rust
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.