fusesoc / blinky

Example LED blinking project for your FPGA dev board of choice
MIT License
158 stars 70 forks source link

Trouble with "LED to believe" tutorial for Tang Nano target #74

Open timvgso opened 2 years ago

timvgso commented 2 years ago

I tried the LED to believe tutorial in https://github.com/fusesoc/blinky for a Sipeed Tang Nano board with a fresh install of FuseSoc, Yosys, and Apicula with Python 3.9.5 on Linux Mint x86_64.

After running fusesoc core list and finding a core called fusesoc:utils:blinky in the list, I tried to build the project with: fusesoc run --target=tang_nano fusesoc:utils:blinky

This produced an error message that wasn't helpful to me as someone just getting started with FuseSoC: ERROR: No tool was supplied on command line or found in 'fusesoc:utils:blinky' core description

I carefully re-checked my installation and ran fusesoc library update as instructed just in case, even though a brand new installation should have been (and was) up to date, but the error persisted. Finally after looking through the repositories and reading the various files, I eventually discovered that there was a tang_nano target in https://github.com/fusesoc/blinky/blob/master/blinky.core that was not present in https://github.com/fusesoc/fusesoc-cores/blob/master/fusesoc_utils/blinky-1.0.core.

The instructions said to install blinky as a new core library, with the command fusesoc library add blinky https://github.com/fusesoc/blinky, "If it's still not there, or if you want to modify the project, e.g. to add support for an additional board," none of which applied in my case. But after running this command (and addressing a separate issue with Edalize) I was able to build and run blinky.

This could be a lot more pleasant for someone just getting started with FuseSoC. Is there a reason why the two blinky cores are not identical, or in any case don't support the same range of targets? If so, could there be clearer instructions for users with boards that require use of the stand-alone blinky core?

infphyny commented 2 years ago

I am the person who made the pull request to add tang_nano board. On my computer, to be able to generate the bitstream for tang_nano, I need to install latest version of edalize. Maybe you don't need this step because I have installed edalize previously from github.

Then in a directory execute fusesoc library add blinky https://github.com/fusesoc/blinky followed by fusesoc run --target=tang_nano fusesoc:utils:blinky .

Sorry, I saw you need the same step as me.

olofk commented 2 years ago

I'd say there are two problems here, really. The first one is the nonsense error message about not finding a tool. The real problem in this case is that it doesn't find a target called tang_nano and the confusing error message is for complicated legacy reasons that aren't valid anymore so this should just be fixed in FuseSoC to give a better idea of what the actual problem is.

The second one is a bit trickier however. As you have noticed there are two versions of this core and that's true for many other cores as well. The first one you had came from the fusesoc-cores repo. This can be seen as a base library (compare to main in Ubuntu, or let's say what you get from pypi if you're a Python user). The cores in the fusesoc-cores library are always stable versions and are updated quite infrequently because the focus is on stability. The other version is found in this repo. When you run fusesoc library add blinky https://github.com/fusesoc/blinky FuseSoC will add the cores from this repo and override the version found in fusesoc-cores. This can be compared to installing a Ubuntu PPA or using a deveoplment version of a python package. In this case it will still have version 1.0 since there hasn't been any later releases.

For now, I have taken the opportunity to release a version 1.1 and update fusesoc-cores as well with this version because 1.0 was getting really old at this point. There will probably always be several versions, but we should update the instructions in this repo to be less confusing

timvgso commented 2 years ago

On my computer, to be able to generate the bitstream for tang_nano, I need to install latest version of edalize. Maybe you don't need this step because I have installed edalize previously from github.

That's a good point. I didn't have to do that because I was working with a fresh installation of FuseSoC, and I had to figure out why tang_nano was in list of supported targets but wouldn't build. Someone who had used FuseSoC before but was trying to build blinky for a new board from a different logic family (e.g., Gowin Little Bee) might need to know about that.