Skip to content

Conversation

@rruuaanng
Copy link
Contributor

@rruuaanng rruuaanng commented Jul 31, 2025

#119

Change the Rust DT generation to read the edtlib parsed tree. This involves extending the
generator in the Rust build to not just generate a Python pickle file of this data, but also
output it in a more portable format, such as json, or yaml, that can be read from the Rust code
that generates the Rust devicetree code.

Generate edt.json during build to enable better devicetree parsing support in Rust.

e.g.

...
        {
            "name": "interrupt-controller@e000e100",
            "compats": [
                "arm,v7m-nvic"
            ],
            "path": "/soc/interrupt-controller@e000e100",
            "labels": [
                "nvic"
            ],
            "aliases": [],
            "status": "okay",
            "dep_ordinal": 4,
            "hash": "MNKByYDCdVxyLwiy4A_bv2jZfVhfDT01mZ2_1uEhUYQ",
            "ranges": [],
            "regs": [
                {
                    "name": null,
                    "addr": "0xe000e100",
                    "size": "0xc00"
                }
            ],
            "props": [
                {
                    "reg": {
                        "spec": {
                            "path": "D:/Code/github/zephyr/zephyr-test/zephyr/dts/bindings\\interrupt-controller\\arm,v7m-nvic.yaml",
                            "type": "array",
                            "enum": null,
                            "const": null,
                            "default": null,
                            "required": true
                        },
                        "val": [
                            3758153984,
                            3072
                        ],
                        "type": "array"
                    }
                },
                {
                    "arm,num-irq-priority-bits": {
                        "spec": {
                            "path": "D:/Code/github/zephyr/zephyr-test/zephyr/dts/bindings\\interrupt-controller\\arm,v7m-nvic.yaml",
                            "type": "int",
                            "enum": null,
                            "const": null,
                            "default": null,
                            "required": true
                        },
                        "val": 4,
                        "type": "int"
                    }
                },
...

@rruuaanng rruuaanng changed the title cmake: dts: Generate edtlib json metadata during build cmake: dts: Generate edt.json metadata during build Jul 31, 2025
@rruuaanng rruuaanng force-pushed the add-edt-json branch 2 times, most recently from 3e0b86a to b347e33 Compare July 31, 2025 02:50
@rruuaanng rruuaanng requested a review from d3zd3z July 31, 2025 02:50
@rruuaanng rruuaanng marked this pull request as ready for review July 31, 2025 02:52
@rruuaanng rruuaanng marked this pull request as draft July 31, 2025 03:34
@zephyrproject-rtos zephyrproject-rtos deleted a comment from sonarqubecloud bot Jul 31, 2025
@rruuaanng rruuaanng force-pushed the add-edt-json branch 2 times, most recently from 411c0b6 to 14a307e Compare August 4, 2025 12:28
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 4, 2025

Generate `edt.json` during build to enable better devicetree
parsing support in Rust.

Signed-off-by: James Roy <[email protected]>
@rruuaanng rruuaanng marked this pull request as ready for review August 5, 2025 00:17
Copy link
Member

@decsny decsny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to add testing for this, since it is now more code that is needing to be maintained and people will potentially break it if they dont realize it exists or how its supposed to work when making other changes to this scripting

@mbolivar
Copy link
Contributor

mbolivar commented Oct 7, 2025

Agreed -- testing would also make it clearer what your intentions are for the data format etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants