locka99 / opcua

A client and server implementation of the OPC UA specification written in Rust
Mozilla Public License 2.0
476 stars 129 forks source link

Supporting bare metal embedded environments #220

Open lulf opened 2 years ago

lulf commented 2 years ago

Hi, we're a bunch of developers playing with Industrial IoT over at Drogue IoT, and I'm looking into writing an OPC-UA server that can run on embedded devices, preferably in pure Rust :)

To run a Rust crate on bare metal embedded devices, it must be able to compile without the standard library (i.e. have the no_std flag enabled in the crate lib).

Obviously, this is not feasible with the full set of features turned on, but I'm wondering if you'd be open to extract a subset of the lib, specifically the type system (types module?), into a separate crate with the aim of making that crate consumable by both std and no_std environments. The easiest way to do this is by creating a separate crate with all the stuff that can compile to bare metal and std environments like and expose features for enabling 'std' support.

I'm willing to give this a try, but I'd like to know if it's something this project would be interested in if I submitted it.

jon-ton commented 1 year ago

I think this would be really interesting/helpful to have in the crate.

schroeder- commented 1 year ago

Most of types part is out generated, so the code could be reused to generate a embedded version for an embedded opc ua crate. But the amount of generated structs which bloats the binary. So for the embedded part only a subset is needed.

The server and client code uses tokio which doesn't work with no_std. So there isn't much code to reuse.

The rest is just the crypto part, which depends on openssl, which isn't available for all embedded targets.