Using a C Written Board Wrapper


I'm new to Rust and have been tasked with writing embedded rust for an ARM-Cortex board. We have been provided with a wrapper for this board that provides many functions for our intended purposes. I've done some research and found a package called cc which if I'm understanding allows me to call these functions from Rust only requiring me to declare the functions parameter types and return types.

Although this wrapper uses many other header files itself and not sure how that would effect what I'm doing.

Does anyone have any advice for this task and am I going in the right direction.

You're looking for ffi, which is how you call C code from Rust (See also Foreign Function Interface - Rust By Example). Depending on which board you have, you may be able to use an existing Rust API (e.g cortex-m) instead.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.