ghdl-yosys-plugin
ghdl-yosys-plugin copied to clipboard
update examples build system
This PR aims to improve the makefiles of the example projects. The goal is to make the examples easier to understand, use and maintain.
Changes:
- Created a
tools.mkfile to specify either local or docker tools - Created a
common.mkfile which includes all targets for ICE and ECP5 - Gave all examples makefiles which include the aforementioned files
- Added a
READMEto /examples
Every project has it's own makefile.
There it can define its own properties (which source files, what package, etc.) and it implements its own targets if required.
The common makefile includes all different targets to call yosys, nextpnr and others.
The source of the tools can either be the local tools (default behaviour) or the docker tools by specifying make USE=DOCKER=1.
Adding a new example can usually rely on the common.mk makefile.
All projects successfully generate a bitstream.
Current Issues:
- As I don't have the hardware I couldn't test any generated bitstream
- Docker is untested (Docker image is only available as arm64, i'm on aarch64)
- I don't know where or if
icetimeandiceprogcan be accessed in the docker image. For now I've left their defintion intools.mkblank common.mkmay be overwhelming to new users making the build process seem more complicated. Perhaps splitting these up into a makefile for Ice and one for ecp5?
Ok for me. @umarcor, any comment ?
Overall, the proposal is correct and adequate. Thanks for the PR!
There are at least two similar solutions which I am aware of (because I did implement them either partially or totally):
- https://github.com/im-tomu/fomu-workshop/tree/master/hdl
- https://github.com/stnolting/neorv32-setups/tree/main/osflow
- They bring inspiration from: https://github.com/antonblanchard/ghdl-yosys-blink/blob/master/Makefile
You can see that those solutions "split common.mk into multiple makefiles", as @playduck commented above.
Hence, please let me have the weekend to have a better look at it and hopefully catch some simple envvar renames that can make this more consistent with those implementations.
Eventually, we might download and reuse the makefiles in this repo (e.g. https://github.com/stnolting/neorv32-setups/blob/main/osflow/tools.mk), instead of duplicating them. Nevertheless, I will try to review this PR to have it merged ASAP, we don't want to overcomplicate it now, because it does look good enough already.