olofk / fusesoc

Package manager and build abstraction tool for FPGA/ASIC development
BSD 2-Clause "Simplified" License
1.14k stars 235 forks source link

Generator-Cache removal and --no-export #616

Closed Steinegger closed 6 months ago

Steinegger commented 1 year ago

Files generated by a generator are removed after the setup phase. When using the --no-export flag the source files aren't copied to the respective build directory, hence, the project creation fails due to missing source files. I also tried with, the cache_type: input and cache_type: generator setting to keep the fusesoc config in place as mentioned in the docs here, but they would still be deleted.

This seems unintended behaviour, because deleting the files if the--no-export flag is present will almost always brick the build. A not so obvious workaround seems to be to specify a copyto attribute for each file in the generated core, if this is the intended way of handling generators it should be noted in the docs.

Versions: Python 3.10.0 Fusesoc 2.0 edalize 0.4.1

olofk commented 1 year ago

Confirmed. The --no-export case slipped through our net when we were testing. Sorry about that. I have a potential fix here and would love some additional testing to see that I got it right this time.

You can install a local development version of FuseSoC by cloning and checking out the branch with git clone https://github.com/olofk/fusesoc -b no-export-generators-fix, cd into fusesoc and run pip install --user -e .

Steinegger commented 1 year ago

Thanks for the quick fix. I removed my copyto statements and installed the dev-version. The fix creates a generator_cache directory in the build/*/*/ folder and works perfectly with the no-export flag. Without --no-export the files are created int the C:\users\<username>\.cache\fusesoc\generator_cache\ directory and copied over to the build directory afterwards.

Interestingly it also helps with issue #613 (at least for builds with --no-export), because the generated directory is created in the build directory

olofk commented 6 months ago

Looks like we can close this