Hi Rob,
ST Restricted
-----Original Message----- From: Rob Herring robh@kernel.org Sent: Thursday, May 5, 2022 6:17 PM To: Loic PALLARDY loic.pallardy@st.com Cc: Nathalie Chan King Choy nathalie@xilinx.com; Stefano Stabellini stefanos@xilinx.com; Bruce Ashfield brucea@xilinx.com; Bill Mills bill.mills@linaro.org; Arnaud POULIQUEN arnaud.pouliquen@st.com; Bolivar, Marti Marti.Bolivar@nordicsemi.no; system- dt@lists.openampproject.org; Valentin CARON valentin.caron@st.com Subject: Re: [System-dt] Re: Calling for agenda: 2022-05-10 System Device Tree - Lopper
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--+
That's what we prototyped based on lopper and assist capabilities. We would like to get feedbacks to know it is enough generic to be used by any SoC and any RTOS.
Loic
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