Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SVF files to write to external flash (using Master SPI mode). #136

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

garytwong
Copy link
Contributor

Enabled under --svf mode by passing --svf-spiflash. Base address can be given with --svf-spibase.

Signed-off-by: Gary Wong [email protected]

@daveshah1
Copy link
Contributor

Thanks for your work, I'll need a few days to check this and review it properly but its not forgotten :)

In the mean time:

  • can you check the indentation? it looks like some tabs might have got into a file indented with spaces (if it is inconsistent, please convert to spaces-only)
  • just to check, is all the SVF/XSVF code being added either newly written or from a permissively licensed project compatible with ISC?

…I mode).

Enabled under --svf mode by passing --svf-spiflash.  Base address can
be given with --svf-spibase.

Signed-off-by: Gary Wong <[email protected]>
The produced XSVF makes use of the Lattice LCOUNT/LDELAY/LSDR extensions.

There are two main advantages to XSVF over SVF: 1) potentially smaller
output files (when the increased density of binary encoding outweighs
the overhead of mandatory TDOs and masks in XSVF); and 2) the LSDR
instruction allows polling until the TAP is ready to accept the next
command.  This is particularly valuable when writing to SPI flash, since
the required delay can vary widely depending on the flash device, and
without repeated polling we are forced to impose a conservative delay
before one check for completion.

Signed-off-by: Gary Wong <[email protected]>
@garytwong
Copy link
Contributor Author

Sorry about the indentation! I've substituted new commits with spaces-only.

Yes, everything in this branch is newly written, and I'm happy to contribute it under ISC.

@garytwong
Copy link
Contributor Author

Is this branch OK to merge? I'm happy to make any changes required to make reviewing easier. Thanks!

@daveshah1
Copy link
Contributor

Sorry, managed to forget about this. Looks like there are still some indentation issues, otherwise I see no issues.

@racerxdl
Copy link

racerxdl commented Jun 4, 2020

I tested this with a Colorlight 5a-75b 6.1 (which has an ECP5) https://github.com/q3k/chubby75/blob/master/5a-75b/README.md and it didnt work. It didnt gave any errors to me, but the fpga isnt booting to the led blink.

I tested with ujprog:

ujprog -d -j FLASH -s ../../ghdl-yosys-blink/vhdl_blink-flash.svf ../../ghdl-yosys-blink/vhdl_blink.bit

And it did work. Am I missing something?

GitHub
Linsn RV901T HUB75 LED "Receiver Card" Reverse Engineering - q3k/chubby75

@smunaut
Copy link
Contributor

smunaut commented Jun 4, 2020

I don't understand what worked and what didn't ...
You say ujprog worked with the svf ... so what didn't work ?

@racerxdl
Copy link

racerxdl commented Jun 4, 2020

If I generate the svf file using this branch:

ecppack vhdl_blink_out.config --svf-spiflash --svf vhdl_blink.svf vhdl_blink.bit

The openocd says the write was succesfull, but the code does not work on the fpga (it just boots whatever was in the SPI Flash).

But if I generate the svf file with ujprog, it does work and the fpga boots correctly.

PS: I didn't used ujprog to program the FPGA, just to generate the SVF file from the bitstream.

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.

4 participants