Commit Graph

65 Commits

Author SHA1 Message Date
Sylvain Munaut 98d8bee04f iceprog: Use open-drain output to drive SS and Reset line
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2021-12-17 19:45:34 +01:00
Sylvain Munaut c5a8beffec iceprog: Improve reset to disable both CRM and QPI
It's hard to cover 100% of cases, but this seems to improve
probability that a reset works, at least for me on the icebreaker.

Some other flash have a different QPI disable command though :/

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2021-12-17 19:45:34 +01:00
Sylvain Munaut 502d847b41 iceprog: Add option that set QE=1 bit in SR2
This is useful when testing litex SoC that rely on that bit being set

The setting is non-volatile so it only needs to be done once in case
you happen to have used a flash chip that's not by default QE=1

(This has been designed for winbond flash. Others might use
 different bit ...)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2021-12-17 19:44:24 +01:00
Miodrag Milanović 83b8ef947f
Merge pull request #282 from jkiv/iceprog-ignorig-fix
[iceprog] Fixed typo in error message: "Ignorig"
2021-09-06 11:14:46 +02:00
Jon Kivinen 97b6e276e8
[iceprog] Fixed typo in error message: "Ignorig" 2021-05-03 19:31:39 -04:00
Piotr Esden-Tempski 549fd314a0 iceprog: Add write and read progress indication. 2021-01-16 22:58:29 -08:00
Claire Wolf 56a688fb8f Merge branch 'opt_skip_powerdown' of https://github.com/smunaut/icestorm 2020-04-22 18:06:59 +02:00
Piotr Esden-Tempski 24645e91a6 Added an option to choose the erase block size.
This allows us to flash binaries at offsets that are smaller multiples.
2020-02-02 23:02:53 -08:00
Sylvain Munaut dcda69d9f0 iceprog: Add option to keep flash powered up
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-12-28 16:53:53 +01:00
Clifford Wolf 9594931536
Merge pull request #230 from smunaut/fix_flash_reset
iceprog: Better reset of flash
2019-08-15 13:31:53 +02:00
Sylvain Munaut a7c42cd29b iceprog: Better reset of flash
If the flash was in a 'weird' mode (like CRM, QPI, ...), sending
a continuous stream of 0xff should take it out of it.

It looks like the previous code was trying to do that, but
was only transferring 8 bits and then 2 bits which is way
too short.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-08-05 14:34:49 +02:00
Tim Pambor 26a40d0e11 Fix piping on windows
On windows stdin and stdout have to be set to binary as otherwise windows treats it as text and converts occurences of CRLF to LF
2019-08-05 11:51:03 +02:00
Pablo Cossutta bd88dfe418 Add -X option to iceprog
In my setup, in OSX I have problems reading from libftdi but not writing. In case of a failure iceprog exits and leaves the FPGA in an useless state. I think it would be a good option to have the possibility to skip the verification process.
2019-04-27 19:33:07 -03:00
Piotr Esden-Tempski 8d9fa0fc77 Split the hardware specific gpio functions. 2018-12-24 09:36:37 +01:00
Piotr Esden-Tempski 61bc31bbdc Factored out mpsse functions for easier reusability. 2018-12-24 09:10:59 +01:00
Clifford Wolf 3681ade2c7 Force flash to exist QPI mode in iceprog
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2018-09-02 17:11:52 +02:00
Clifford Wolf 9df21fcb02 iceprog: switch to SPI mode 0, add -s option, add flash_reset
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2018-09-02 16:29:18 +02:00
Clifford Wolf 22e8b744da Minor style changes in iceprog
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2018-08-19 15:21:04 +02:00
Clifford Wolf 65ae583b3e iceprog coding style, don't use "assert" as variable name
Signed-off-by: Clifford Wolf <clifford@clifford.at>
2018-08-19 15:12:51 +02:00
Piotr Esden-Tempski 9a58588772 Slightly more robust flash wait function.
In cases when the FLASH chip is bit flaky and the status register
"bounces" this flash_wait should be able to perform a bit better.

Also added more verbose output around block erase.
2018-08-18 16:13:27 -07:00
Piotr Esden-Tempski 868ac2d93f Add a function to read and decode the status register.
Very useful for debugging purposes. ;)
2018-08-18 15:53:38 -07:00
Piotr Esden-Tempski 20ef4efd8b Added the FTDI cable pinout for reference. 2018-08-18 15:29:11 -07:00
Piotr Esden-Tempski f4ff8f7630 Improved JEDEC ID read function.
The function now checks how long the extended JEDEC ID field is for the
particular FLASH chip and only reads the amount provided by the chip.
2018-08-18 15:26:37 -07:00
Piotr Esden-Tempski 3ba1acf31b Replaced some more magic numbers with FLASH command IDs.
I missed those the first time around.
2018-08-18 14:46:12 -07:00
Piotr Esden-Tempski ee7eae0be8 Added easier to read chip_select/reset functions.
Just calling a gpio function with two numbers was not very self
explanatory. The functions now refer to the actual indended action, chip
(de)select for flash, reset and chip (de)select for sram. Reading the
code and understanding what steps are taken should be easier now.
2018-08-18 14:41:42 -07:00
Piotr Esden-Tempski 96b1a90f28 Added more code comments.
Main point was to group the code into three logical segments:
* MPSSE/FTDI defines and functions
* FLASH defines and functions
* iceprog implementation core

While I was at it I also added a few comments for stuff that was not
immediately obvious what it does.
2018-08-16 14:22:53 -07:00
Clifford Wolf ea9553a215
Merge pull request #144 from daveshah1/unbrick
Add write protection disable to iceprog
2018-05-30 13:01:21 +02:00
Piotr Esden-Tempski a7ab72dd4c Added some flash command definitions to decrease magic number usage. 2018-03-11 19:42:06 -07:00
Piotr Esden-Tempski 43333aa0a9 Added some MPSSE command definitions to decrease magic number usage. 2018-03-11 19:41:55 -07:00
David Shah e5e09ee722 Add write protection disable to iceprog 2018-02-12 18:58:19 +00:00
David Shah 9ac405f98f Add out-of-the-box FT232H support (for Upduino 2, etc) 2018-02-09 12:25:48 +00:00
Clifford Wolf bca8c3c88f Add "iceprog -e" 2018-01-02 17:12:44 +01:00
Larry Doolittle b3d35ccadc Squelch trailing whitespace 2017-08-01 14:43:15 +02:00
Robert Ou 4e653c3b7e iceprog: Make errors print only the program name
Previously, the entire argv[0] would be printed.
2017-07-17 01:43:27 -07:00
Robert Ou 9acaac752a iceprog: Do not use nonstandard err.h
This header does not exist under MinGW. Replace these functions with
standard functions.
2017-07-17 01:28:59 -07:00
Clifford Wolf 3c42bdbf66 Fix coding style in iceprog.c (mostly line breaks and indenting) 2017-07-05 18:34:57 +02:00
Roland Lutz 53a8bcce35 iceprog: Keep name space clean 2017-07-04 18:21:54 +02:00
Roland Lutz 62e7089710 iceprog: Remove trailing newline 2017-07-04 18:21:54 +02:00
Roland Lutz f36652689f iceprog: Break overlong lines 2017-07-04 18:21:54 +02:00
Roland Lutz 64e129bee9 iceprog: Fix coding style inconsistencies 2017-07-04 18:21:54 +02:00
Roland Lutz 0a8d98f36a iceprog: Fix error messages 2017-07-04 18:21:54 +02:00
Roland Lutz eef1731d2b iceprog: Return a meaningful exit status 2017-07-02 14:56:07 +02:00
Roland Lutz 7b97eb4177 iceprog: When reading, don't write more bytes than requested 2017-07-02 14:56:07 +02:00
Roland Lutz 8413b2c689 iceprog: Allow programming from pipe 2017-07-02 14:56:07 +02:00
Roland Lutz 0bd8876d7f iceprog: Allow programming from standard input 2017-07-02 14:49:37 +02:00
Roland Lutz 47c9cd4ac1 iceprog: Open input/output files before talking to hardware 2017-07-02 14:49:37 +02:00
Roland Lutz 6741d93245 iceprog: Overhaul `--help' text 2017-07-02 14:49:37 +02:00
Roland Lutz 703a913bd1 iceprog: Add option `--help' 2017-07-02 14:49:37 +02:00
Roland Lutz 86af65cc32 iceprog: Check for non-applicable options 2017-06-19 20:37:44 +02:00
Roland Lutz 90381332e2 iceprog: Check for invalid offset/size arguments 2017-06-08 21:01:45 +02:00