Open hvegh opened 3 years ago
@hvegh - Take a look at the following;
@mateusz-holenko
https://github.com/timvideos/litex-buildenv/wiki/DeviceTree might be interesting too.
Hi @hvegh,
thanks for your feedback. Automatic DTS generation is indeed an approach that we are already experimenting and using on Linux-On-LiteX-VexRiscv project for example (and we currently extending it to the other Linux projectsintegrating different CPUs with LiteX: Rocket, Mor1kx, etc...). The current approach generates a .json
file describing the LiteX SoC and then translate this .json
file to a .dts
file with litex_json2dts.py
tool. This tool has only been used for now to generate .dts
for Linux, but it would be really interesting to see if we can easily use it/adapt it to also generate .dts
for Zephyr. As pointed by @mithro, this is only one approach and other approaches have also been experimented and directly tested with Zephyr.
If expected .dts
for Linux and Zephyr are very similar, extending litex_json2dts.py
and adding support for Zephyr to it would probably the more interesting approach. With the JSON export, it's also possible for any developer to create a custom tool that will be run after the build to generate specific translation of the .json
SoC description.
@enjoy-digital
If expected
.dts
for Linux and Zephyr are very similar, extendinglitex_json2dts.py
and adding support for Zephyr to it would probably the more interesting approach. With the JSON export, it's also possible for any developer to create a custom tool that will be run after the build to generate specific translation of the.json
SoC description.
As DTS describes hardware, not software policy (except for some parameters in the /chosen node), there should be only a single DTS for the hardware, that can be used by whatever software is running on the hardware.
Thanks @geertu, that's what I was guessing but was not sure there were possible small differences depending the OSes. That will simplify things for if there are no differences. Thanks for providing your/expertise on this.
@geertu While I agree in theory about your DTS comment, in practice things are a bit lot more complicated. See for example the DTS patching things like uboot do and various incompatibilities between Linux versions.
I think there is a potential future around LiteX generating DTS directly rather than via the JSON conversion method.
Having DTS fragment generation "be close" to the hardware description seems like it would mean that the two are better kept in sync (IE when someone changes the hardware, they also update the required DTS fragment).
Sorry for my late reaction, thank you very much for the feedback. Currently I have again some playtime. I will see if I can enhance the workflow a little bit and glue the components together.
I will experiment with the litex_json2dts.py
as @geertu mentioned.
I will keep you posted.
I have created a refactored and standalone version of the DTS overlay converter:
I now understand a little bit better how DTS works :). Using the generated DTS overlays it possible to generate working code examples on verilator and the fpga using platformio quite easy.
So the GOAL is: platformio +
In order to make this available for a wider audience there is still some stuff to work out:
generate-zephyr-dts.py
as part of https://github.com/zephyrproject-rtos/zephyrThank you for the feedback, please free to help me in this journey if you have affinity with litex || platformio || zephyr.
FYI - @mateusz-holenko
Dear LiteX devs.
I enjoy LiteX very much, great work great concept! Hope I can help.
Background:
Yesterday I naively experimented a bit with Litex - platformio - zephyr(rtos). The idea was simple: I would provide platformio with:
and the firmware would be generated automatically. Zephyr would provide the goodness of networking stacks and I would concentrate on glueing the right components together using platformio. While I am now able to compile and run simple "hello world" examples the current approach is not scalable.
Main issue:
Possible solutions:
So for example:
could become:
Questions;
Regards, Henk