On Thu, May 5, 2022 at 8:26 AM Loic PALLARDY via System-dt system-dt@lists.openampproject.org wrote:
Hi Nathalie,
We would like to discuss a generic way to transform dts file in c-struct for baremetal/rtos environment.
My suggestion would be to use the DT schema. The flow would be something like this:
dts---------------->dtb---------+-->C struct declarations | schemas-->C struct definitions--+
The information is all there in the schemas. It's used to decode byte arrays in dtbs into the appropriate types for schema validation. Patterns with '#*-cells' need some code to handle if you want to split the entries (i.e. anything more than an array of u32's). Not really any way around that.
While dts files (may) have some amount of type information in them, having been down the path of using that, I would not recommend any solution doing that. Any type information may not be there to begin with and it's lost in any processing whether that's the dtb file or a dts to dts pass.
Rob