Closed Manoj1063 closed 2 years ago
@Manoj1063 curious what you are using this parser for.
I'm having a hard time understanding the steps to reproduce. The python-devicetree code can't handle C preprocessor directives like #define
or #include
-- you need to run the C preprocessor first, then parse the devicetree.
@Manoj1063 curious what you are using this parser for.
@galak , We are developing product to simplify the DTS files editing/modifying through an user interface. So trying to parse the list of DTS/DTSI files under the project to get the list of nodes and node attributes details.
I'm having a hard time understanding the steps to reproduce. The python-devicetree code can't handle C preprocessor directives like
#define
or#include
-- you need to run the C preprocessor first, then parse the devicetree.
@mbolivar-nordic , Tried the below command, getting the errors not able to parse successfully and get the data. Can you please provide the steps to run C preprocessor for the DTS files??
cpp -nostdinc -I include -I arch -undef -x assembler-with-cpp <dts_filename>.dts <dts_filename>.dts.preprocessed
dtc -I dts -O dtb -p 0x1000 <dts_filename>.dts.preprocessed -o <dts_filename>.dtb
Can you please provide the steps to run C preprocessor for the DTS files??
Sorry, but this question is not in scope for this library.
Goal :
Parsing the DTS file and get all the node attributes details. Get list of all the nodes name and node details part of DTS and DTSi files.
Issue Description :
Able to parse and get the node details as excepted for
DTS
file which includedDTSi
files and inDTSI
file no files has been included like header files, but case where theDTSi
file included some header files then getting below parse error.Error :
parse error: expected '/' or label reference (&foo)
DTSI File
Header File
My Observation :
DTSI
file which include the header file has not been in standard DTS file format. Hence, getting the above-mentioned parse error. Any ways to neglect parser not included the header file mentioned, goal is to get the node attributes details ofDTS
andDTSi
files only. Please advise me on this.Code Reference - https://github.com/zephyrproject-rtos/python-devicetree/blob/main/src/devicetree/dtlib.py#L255