-- Code still in development / proof of concept --
XDR/RPC protocol for Arduino STM32Core based on the Sun Microsystems XDR/RPC Source Code (Sun RPC).
Tested with the Arduino 1.8.13 IDE, STMCore lib for a STM32F405 MCU as a proof of concept.
I did not find any clear implementation of XDR/RPC with Arduino, etc. (compile with an arm g++ compiler). Mostly used with Ethernet applications in OS (e.g. NFS), I can see XDR of great interest as a data packing layer in order to unify transport communication (pack and stream) between devices but also to unify the storing of data (pack and stream) in small memory devices (e.g. parameters, data log) and keep fast performance (probably one of the fastest data packer).
The source codes are adapted from portablexdr-4.9.1
(https://people.redhat.com/~rjones/portablexdr/files/) and bsd-xdr-master
(https://github.com/woodfishman/bsd-xdr).
A diff
can be used to observe the code differences.
- The library uses the functions
__builtin_bswap16
,__builtin_bswap32
for very fast byteswap operations with Arm MCU.
- Transmit & receive information data such as integers, (size-variable) strings, arrays, floats, structures, enums in a binary format from one device to another device via USB, TCP, etc.
- Store & load information data such as integers, (size-variable) strings, arrays, floats, structures, enums in a binary format into a memory such as Flash, EEprom, etc.
- Protocols such as VXI11 designed for connecting instruments (such as oscilloscopes, multimeters, spectrum analyzers, etc.) to controllers (e.g., PCs) use the underlying XDR/RPC protocol.
- Develop fast a working concept with all features developed by Sun (debug on compilation, not on algorithms).
- More important, it allows to use the xdr/rpc generator
rpcgen
to create c-code files (a contrario of a custom lib) and to implement easily a Remote Procedure Call (RPC) protocol (Note that the code generated byrpcgen
may require some little hand-made rewrites in order to pass a compilation, basically reorder the code). - The licenses seem (?) not very restrictive (even for business uses in a product).
Python has it own implementation (xdrlib
). This can be used to check/debug function outputs.
- Except the
*.ino
files (MIT license), and despite the code modifications, the entire source code is not belong to me. Please refer to the license description for each file. - For any infringments of copyright or misunderstanding of the licenses, please let me know in advance. My goal is to share the modifications of the library for an application with the Arduino software and an Arm MCU in consideration that the basic code, and the ideas are not my property.
- https://en.wikipedia.org/wiki/External_Data_Representation
- https://datatracker.ietf.org/doc/html/rfc1014
- Clean up a bit the source code
- Create test functions
- Create a python code to correct the generated code made by rpcgen in order to pass a compilation.