blob: 54daef109924bec34ccc816e37cb362350026c2f [file] [log] [blame]
Stefan Tauner4c723152016-01-14 22:47:55 +00001.\" Load the www device when using groff; provide a fallback for groff's MTO macro that formats email addresses.
2.ie \n[.g] \
3. mso www.tmac
Stefan Tauner0be072c2016-03-13 15:16:30 +00004.el \{
5. de MTO
6 \\$2 \(la\\$1 \(ra\\$3 \
Stefan Tauner4c723152016-01-14 22:47:55 +00007. .
Stefan Tauner0be072c2016-03-13 15:16:30 +00008.\}
Stefan Tauner4c723152016-01-14 22:47:55 +00009.\" Create wrappers for .MTO and .URL that print only text on systems w/o groff or if not outputting to a HTML
10.\" device. To that end we need to distinguish HTML output on groff from other configurations first.
11.nr groffhtml 0
12.if \n[.g] \
13. if "\*[.T]"html" \
14. nr groffhtml 1
15.\" For code reuse it would be nice to have a single wrapper that gets its target macro as parameter.
16.\" However, this did not work out with NetBSD's and OpenBSD's groff...
17.de URLB
18. ie (\n[groffhtml]==1) \{\
19. URL \\$@
20. \}
21. el \{\
22. ie "\\$2"" \{\
23. BR "\\$1" "\\$3"
24. \}
25. el \{\
26. RB "\\$2 \(la" "\\$1" "\(ra\\$3"
27. \}
28. \}
29..
30.de MTOB
31. ie (\n[groffhtml]==1) \{\
32. MTO \\$@
33. \}
34. el \{\
35. ie "\\$2"" \{\
36. BR "\\$1" "\\$3"
37. \}
38. el \{\
39. RB "\\$2 \(la" "\\$1" "\(ra\\$3"
40. \}
41. \}
42..
Nico Huberc3b02dc2023-08-12 01:13:45 +020043.TH FLASHPROG 8 "@MAN_DATE@" "flashprog-@VERSION@" "@MAN_DATE@"
Stefan Reinauer261144c2006-07-27 23:29:02 +000044.SH NAME
Nico Huberc3b02dc2023-08-12 01:13:45 +020045flashprog \- detect, read, write, verify and erase flash chips
Stefan Reinauer261144c2006-07-27 23:29:02 +000046.SH SYNOPSIS
Nico Hubera7050432023-02-11 18:01:26 +010047Flashprog supports multiple command modes:
48.sp
49.B flashprog \fR([\fBprog\fR])
50.sp
51With
52.B prog
53being the default and described in this manual.
54.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +020055.B flashprog \fR[\fB\-h\fR|\fB\-R\fR|\fB\-L\fR|\fB\-z\fR|
Edward O'Callaghan0cd11d82019-09-23 22:46:12 +100056 \fB\-p\fR <programmername>[:<parameters>] [\fB\-c\fR <chipname>]
Edward O'Callaghan7d6b5262019-09-23 22:53:14 +100057 (\fB\-\-flash\-name\fR|\fB\-\-flash\-size\fR|
Edward O'Callaghan0cd11d82019-09-23 22:46:12 +100058 [\fB\-E\fR|\fB\-r\fR <file>|\fB\-w\fR <file>|\fB\-v\fR <file>]
Anastasia Klimchuka7cb7e92022-11-25 18:10:43 +110059 [(\fB\-l\fR <file>|\fB\-\-ifd\fR|\fB\-\-fmap\fR|\fB\-\-fmap-file\fR <file>)
60 [\fB\-i\fR <include>]...]
Edward O'Callaghan0cd11d82019-09-23 22:46:12 +100061 [\fB\-n\fR] [\fB\-N\fR] [\fB\-f\fR])]
Richard Hughes842d6782021-01-15 09:48:12 +000062 [\fB\-V\fR[\fBV\fR[\fBV\fR]]] [\fB-o\fR <logfile>] [\fB\-\-progress\fR]
63
Stefan Reinauer261144c2006-07-27 23:29:02 +000064.SH DESCRIPTION
Nico Huberc3b02dc2023-08-12 01:13:45 +020065.B flashprog
Uwe Hermanne8ba5382009-05-22 11:37:27 +000066is a utility for detecting, reading, writing, verifying and erasing flash
Uwe Hermann530cb2d2009-05-14 22:58:21 +000067chips. It's often used to flash BIOS/EFI/coreboot/firmware images in-system
Uwe Hermann941a2732011-07-25 21:12:57 +000068using a supported mainboard. However, it also supports various external
69PCI/USB/parallel-port/serial-port based devices which can program flash chips,
70including some network cards (NICs), SATA/IDE controller cards, graphics cards,
Ilya A. Volynets-Evenbakh2c714ab2012-09-26 00:47:09 +000071the Bus Pirate device, various FTDI FT2232/FT4232H/FT232H based USB devices, and more.
Uwe Hermanne74b9f82009-04-10 14:41:29 +000072.PP
Uwe Hermann9ff514d2010-06-07 19:41:25 +000073It supports a wide range of DIP32, PLCC32, DIP8, SO8/SOIC8, TSOP32, TSOP40,
Uwe Hermann941a2732011-07-25 21:12:57 +000074TSOP48, and BGA chips, which use various protocols such as LPC, FWH,
75parallel flash, or SPI.
Stefan Reinauer261144c2006-07-27 23:29:02 +000076.SH OPTIONS
Uwe Hermann9ff514d2010-06-07 19:41:25 +000077You can specify one of
78.BR \-h ", " \-R ", " \-L ", " \-z ", " \-E ", " \-r ", " \-w ", " \-v
79or no operation.
Nico Huberc3b02dc2023-08-12 01:13:45 +020080If no operation is specified, flashprog will only probe for flash chips. It is
81recommended that if you try flashprog the first time on a system, you run it
Uwe Hermann941a2732011-07-25 21:12:57 +000082in probe-only mode and check the output. Also you are advised to make a
Uwe Hermann9ff514d2010-06-07 19:41:25 +000083backup of your current ROM contents with
84.B \-r
Stefan Taunere34e3e82013-01-01 00:06:51 +000085before you try to write a new image. All operations involving any chip access (probe/read/write/...) require the
86.B -p/--programmer
87option to be used (please see below).
Stefan Reinauerde063bf2006-09-21 13:09:22 +000088.TP
Uwe Hermanne74b9f82009-04-10 14:41:29 +000089.B "\-r, \-\-read <file>"
90Read flash ROM contents and save them into the given
91.BR <file> .
Uwe Hermann941a2732011-07-25 21:12:57 +000092If the file already exists, it will be overwritten.
Stefan Reinauerde063bf2006-09-21 13:09:22 +000093.TP
Daniel Campellod12b6bc2022-03-14 11:43:16 -060094.B "\-w, \-\-write (<file>|-)"
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +000095Write
96.B <file>
Daniel Campellod12b6bc2022-03-14 11:43:16 -060097into flash ROM. If
98.B -
99is provided instead, contents will be read from stdin. This will first automatically
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000100.B erase
101the chip, then write to it.
Stefan Taunerac54fbe2011-07-21 19:52:00 +0000102.sp
103In the process the chip is also read several times. First an in-memory backup
104is made for disaster recovery and to be able to skip regions that are
105already equal to the image file. This copy is updated along with the write
106operation. In case of erase errors it is even re-read completely. After
107writing has finished and if verification is enabled, the whole flash chip is
108read out and compared with the input image.
Stefan Reinauerde063bf2006-09-21 13:09:22 +0000109.TP
Uwe Hermannea07f622009-06-24 17:31:08 +0000110.B "\-n, \-\-noverify"
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000111Skip the automatic verification of flash ROM contents after writing. Using this
Uwe Hermannea07f622009-06-24 17:31:08 +0000112option is
113.B not
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000114recommended, you should only use it if you know what you are doing and if you
Uwe Hermannea07f622009-06-24 17:31:08 +0000115feel that the time for verification takes too long.
116.sp
117Typical usage is:
Nico Huberc3b02dc2023-08-12 01:13:45 +0200118.B "flashprog \-p prog \-n \-w <file>"
Uwe Hermannea07f622009-06-24 17:31:08 +0000119.sp
120This option is only useful in combination with
121.BR \-\-write .
122.TP
Nico Huber99d15952016-05-02 16:54:24 +0200123.B "\-N, \-\-noverify-all"
124Skip not included regions during automatic verification after writing (cf.
125.BR "\-l " "and " "\-i" ).
126You should only use this option if you are sure that communication with
127the flash chip is reliable (e.g. when using the
128.BR internal
Nico Huberc3b02dc2023-08-12 01:13:45 +0200129programmer). Even if flashprog is instructed not to touch parts of the
Nico Huber99d15952016-05-02 16:54:24 +0200130flash chip, their contents could be damaged (e.g. due to misunderstood
131erase commands).
132.sp
133This option is required to flash an Intel system with locked ME flash
134region using the
135.BR internal
136programmer. It may be enabled by default in this case in the future.
137.TP
Daniel Campellod12b6bc2022-03-14 11:43:16 -0600138.B "\-v, \-\-verify (<file>|-)"
Uwe Hermanne74b9f82009-04-10 14:41:29 +0000139Verify the flash ROM contents against the given
140.BR <file> .
Daniel Campellod12b6bc2022-03-14 11:43:16 -0600141If
142.BR -
143is provided instead, contents will be read from stdin.
Stefan Reinauerde063bf2006-09-21 13:09:22 +0000144.TP
Stefan Reinauer261144c2006-07-27 23:29:02 +0000145.B "\-E, \-\-erase"
Uwe Hermanne74b9f82009-04-10 14:41:29 +0000146Erase the flash ROM chip.
Stefan Reinauerde063bf2006-09-21 13:09:22 +0000147.TP
Stefan Reinauer261144c2006-07-27 23:29:02 +0000148.B "\-V, \-\-verbose"
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000149More verbose output. This option can be supplied multiple times
Stefan Taunereebeb532011-08-04 17:40:25 +0000150(max. 3 times, i.e.
151.BR \-VVV )
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000152for even more debug output.
Stefan Reinauerde063bf2006-09-21 13:09:22 +0000153.TP
Stefan Reinauer261144c2006-07-27 23:29:02 +0000154.B "\-c, \-\-chip" <chipname>
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000155Probe only for the specified flash ROM chip. This option takes the chip name as
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000156printed by
Nico Huberc3b02dc2023-08-12 01:13:45 +0200157.B "flashprog \-L"
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000158without the vendor name as parameter. Please note that the chip name is
159case sensitive.
Joerg Mayer645c6df2010-03-13 14:47:48 +0000160.TP
Joerg Mayer645c6df2010-03-13 14:47:48 +0000161.B "\-f, \-\-force"
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000162Force one or more of the following actions:
Joerg Mayer645c6df2010-03-13 14:47:48 +0000163.sp
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000164* Force chip read and pretend the chip is there.
165.sp
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +0000166* Force chip access even if the chip is bigger than the maximum supported \
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000167size for the flash bus.
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000168.sp
169* Force erase even if erase is known bad.
170.sp
171* Force write even if write is known bad.
Joerg Mayer645c6df2010-03-13 14:47:48 +0000172.TP
173.B "\-l, \-\-layout <file>"
174Read ROM layout from
175.BR <file> .
Uwe Hermann87c07932009-05-05 16:15:46 +0000176.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200177flashprog supports ROM layouts. This allows you to flash certain parts of
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000178the flash chip only. A ROM layout file contains multiple lines with the
179following syntax:
180.sp
181.B " startaddr:endaddr imagename"
182.sp
183.BR "startaddr " "and " "endaddr "
184are hexadecimal addresses within the ROM file and do not refer to any
185physical address. Please note that using a 0x prefix for those hexadecimal
186numbers is not necessary, but you can't specify decimal/octal numbers.
187.BR "imagename " "is an arbitrary name for the region/image from"
188.BR " startaddr " "to " "endaddr " "(both addresses included)."
189.sp
190Example:
Uwe Hermann87c07932009-05-05 16:15:46 +0000191.sp
192 00000000:00008fff gfxrom
193 00009000:0003ffff normal
194 00040000:0007ffff fallback
195.sp
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000196If you only want to update the image named
197.BR "normal " "in a ROM based on the layout above, run"
Uwe Hermann87c07932009-05-05 16:15:46 +0000198.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200199.B " flashprog \-p prog \-\-layout rom.layout \-\-image normal \-w some.rom"
Uwe Hermann87c07932009-05-05 16:15:46 +0000200.sp
Stefan Taunere34e3e82013-01-01 00:06:51 +0000201To update only the images named
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000202.BR "normal " "and " "fallback" ", run:"
Uwe Hermann87c07932009-05-05 16:15:46 +0000203.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200204.B " flashprog \-p prog \-l rom.layout \-i normal -i fallback \-w some.rom"
Uwe Hermann87c07932009-05-05 16:15:46 +0000205.sp
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000206Overlapping sections are not supported.
Stefan Reinauerde063bf2006-09-21 13:09:22 +0000207.TP
Arthur Heymansc82900b2018-01-10 12:48:16 +0100208.B "\-\-fmap"
209Read layout from fmap in flash chip.
210.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200211flashprog supports the fmap binary format which is commonly used by coreboot
Arthur Heymansc82900b2018-01-10 12:48:16 +0100212for partitioning a flash chip. The on-chip fmap will be read and used to generate
213the layout.
214.sp
215If you only want to update the
216.BR "COREBOOT"
217region defined in the fmap, run
218.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200219.B " flashprog -p prog \-\-fmap \-\-image COREBOOT \-w some.rom"
Arthur Heymansc82900b2018-01-10 12:48:16 +0100220.TP
221.B "\-\-fmap-file <file>"
222Read layout from a
223.BR <file>
224containing binary fmap (e.g. coreboot roms).
225.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200226flashprog supports the fmap binary format which is commonly used by coreboot
Arthur Heymansc82900b2018-01-10 12:48:16 +0100227for partitioning a flash chip. The fmap in the specified file will be read and
228used to generate the layout.
229.sp
230If you only want to update the
231.BR "COREBOOT"
232region defined in the binary fmap file, run
233.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200234.B " flashprog \-p prog \-\-fmap-file some.rom \-\-image COREBOOT \-w some.rom"
Arthur Heymansc82900b2018-01-10 12:48:16 +0100235.TP
Nico Huber305f4172013-06-14 11:55:26 +0200236.B "\-\-ifd"
237Read ROM layout from Intel Firmware Descriptor.
238.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200239flashprog supports ROM layouts given by an Intel Firmware Descriptor
Nico Huber305f4172013-06-14 11:55:26 +0200240(IFD). The on-chip descriptor will be read and used to generate the
241layout. If you need to change the layout, you have to update the IFD
242only first.
243.sp
244The following ROM images may be present in an IFD:
245.sp
246 fd the IFD itself
247 bios the host firmware aka. BIOS
248 me Intel Management Engine firmware
249 gbe gigabit ethernet firmware
250 pd platform specific data
251.TP
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000252.B "\-i, \-\-image <imagename>"
253Only flash region/image
254.B <imagename>
Uwe Hermann67808fe2007-10-18 00:29:05 +0000255from flash layout.
Stefan Reinauerde063bf2006-09-21 13:09:22 +0000256.TP
Edward O'Callaghan0cd11d82019-09-23 22:46:12 +1000257.B "\-\-flash\-name"
258Prints out the detected flash chips name.
259.TP
Edward O'Callaghan7d6b5262019-09-23 22:53:14 +1000260.B "\-\-flash\-size"
261Prints out the detected flash chips size.
262.TP
Michael Niewöhner96cc5d32021-09-21 17:37:32 +0200263.B "\-\-flash\-contents <ref\-file>"
264The file contents of
265.BR <ref\-file>
266will be used to decide which parts of the flash need to be written. Providing
267this saves an initial read of the full flash chip. Be careful, if the provided
268data doesn't actually match the flash contents, results are undefined.
269.TP
Uwe Hermanne5ac1642008-03-12 11:54:51 +0000270.B "\-L, \-\-list\-supported"
Uwe Hermann941a2732011-07-25 21:12:57 +0000271List the flash chips, chipsets, mainboards, and external programmers
272(including PCI, USB, parallel port, and serial port based devices)
Nico Huberc3b02dc2023-08-12 01:13:45 +0200273supported by flashprog.
Uwe Hermanne5ac1642008-03-12 11:54:51 +0000274.sp
Uwe Hermanne8ba5382009-05-22 11:37:27 +0000275There are many unlisted boards which will work out of the box, without
Nico Huberc3b02dc2023-08-12 01:13:45 +0200276special support in flashprog. Please let us know if you can verify that
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000277other boards work or do not work out of the box.
278.sp
279.B IMPORTANT:
280For verification you have
Uwe Hermanne8ba5382009-05-22 11:37:27 +0000281to test an ERASE and/or WRITE operation, so make sure you only do that
282if you have proper means to recover from failure!
Uwe Hermanne5ac1642008-03-12 11:54:51 +0000283.TP
Uwe Hermann20a293f2009-06-19 10:42:43 +0000284.B "\-z, \-\-list\-supported-wiki"
285Same as
286.BR \-\-list\-supported ,
287but outputs the supported hardware in MediaWiki syntax, so that it can be
Stefan Tauner4c723152016-01-14 22:47:55 +0000288easily pasted into the
Nico Huberc3b02dc2023-08-12 01:13:45 +0200289.URLB https://flashprog.org/Supported_hardware "supported hardware wiki page" .
Uwe Hermann941a2732011-07-25 21:12:57 +0000290Please note that MediaWiki output is not compiled in by default.
Uwe Hermann20a293f2009-06-19 10:42:43 +0000291.TP
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000292.B "\-p, \-\-programmer <name>[:parameter[,parameter[,parameter]]]"
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000293Specify the programmer device. This is mandatory for all operations
294involving any chip access (probe/read/write/...). Currently supported are:
Carl-Daniel Hailfingerce986772009-05-09 00:27:07 +0000295.sp
Stefan Tauner0be072c2016-03-13 15:16:30 +0000296.BR "* internal" " (for in-system flashing in the mainboard)"
Uwe Hermann530cb2d2009-05-14 22:58:21 +0000297.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200298.BR "* dummy" " (virtual programmer for testing flashprog)"
Uwe Hermannc7e8a0c2009-05-19 14:14:21 +0000299.sp
Uwe Hermann530cb2d2009-05-14 22:58:21 +0000300.BR "* nic3com" " (for flash ROMs on 3COM network cards)"
301.sp
Sergey Lichack98f47102012-08-27 01:24:15 +0000302.BR "* nicrealtek" " (for flash ROMs on Realtek and SMC 1211 network cards)"
Uwe Hermann829ed842010-05-24 17:39:14 +0000303.sp
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +0000304.BR "* nicnatsemi" " (for flash ROMs on National Semiconductor DP838* network \
305cards)"
306.sp
Uwe Hermann314cfba2011-07-28 19:23:09 +0000307.BR "* nicintel" " (for parallel flash ROMs on Intel 10/100Mbit network cards)
Uwe Hermann68b9cca2011-06-15 23:44:52 +0000308.sp
Uwe Hermann2bc98f62009-09-30 18:29:55 +0000309.BR "* gfxnvidia" " (for flash ROMs on NVIDIA graphics cards)"
310.sp
TURBO Jb0912c02009-09-02 23:00:46 +0000311.BR "* drkaiser" " (for flash ROMs on Dr. Kaiser PC-Waechter PCI cards)"
312.sp
Uwe Hermannc7e8a0c2009-05-19 14:14:21 +0000313.BR "* satasii" " (for flash ROMs on Silicon Image SATA/IDE controllers)"
314.sp
Uwe Hermann68b9cca2011-06-15 23:44:52 +0000315.BR "* satamv" " (for flash ROMs on Marvell SATA controllers)"
316.sp
Uwe Hermannddd5c9e2010-02-21 21:17:00 +0000317.BR "* atahpt" " (for flash ROMs on Highpoint ATA/RAID controllers)"
318.sp
Stefan Tauner4f094752014-06-01 22:36:30 +0000319.BR "* atavia" " (for flash ROMs on VIA VT6421A SATA controllers)"
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000320.sp
Joseph C. Lehnerc2644a32016-01-16 23:45:25 +0000321.BR "* atapromise" " (for flash ROMs on Promise PDC2026x ATA/RAID controllers)"
322.sp
Kyösti Mälkki72d42f82014-06-01 23:48:31 +0000323.BR "* it8212" " (for flash ROMs on ITE IT8212F ATA/RAID controller)"
324.sp
Stefan Tauner0be072c2016-03-13 15:16:30 +0000325.BR "* ft2232_spi" " (for SPI flash ROMs attached to an FT2232/FT4232H/FT232H family based USB SPI programmer).
Paul Fox05dfbe62009-06-16 21:08:06 +0000326.sp
Nico Huber044c9dc2023-12-29 23:26:57 +0100327.BR "* ft4222_spi" " (for SPI and QPI flash ROMs attached to an FT4222H based USB programmer).
328.sp
Stefan Tauner72587f82016-01-04 03:05:15 +0000329.BR "* serprog" " (for flash ROMs attached to a programmer speaking serprog, \
Stefan Tauner0be072c2016-03-13 15:16:30 +0000330including some Arduino-based devices)."
Carl-Daniel Hailfingerdfade102009-08-18 23:51:22 +0000331.sp
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000332.BR "* buspirate_spi" " (for SPI flash ROMs attached to a Bus Pirate)"
Carl-Daniel Hailfingerd5b28fa2009-11-24 18:27:10 +0000333.sp
Nico Hubera1b7f352024-03-25 18:32:11 +0100334.BR "* dediprog" " (for SPI flash ROMs attached to a Dediprog SF100/SF200/SF600/SF700)"
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +0000335.sp
Kyösti Mälkki8b1bdf12013-10-02 01:21:45 +0000336.BR "* rayer_spi" " (for SPI flash ROMs attached to a parallel port by one of various cable types)"
Carl-Daniel Hailfingere7fdd6e2010-07-21 10:26:01 +0000337.sp
Michael Karchere5449392012-05-05 20:53:59 +0000338.BR "* pony_spi" " (for SPI flash ROMs attached to a SI-Prog serial port "
339bitbanging adapter)
340.sp
Uwe Hermann314cfba2011-07-28 19:23:09 +0000341.BR "* nicintel_spi" " (for SPI flash ROMs on Intel Gigabit network cards)"
Idwer Vollering004f4b72010-09-03 18:21:21 +0000342.sp
Uwe Hermann314cfba2011-07-28 19:23:09 +0000343.BR "* ogp_spi" " (for SPI flash ROMs on Open Graphics Project graphics card)"
Mark Marshall90021f22010-12-03 14:48:11 +0000344.sp
Steve Markgraf61899472023-01-09 23:06:52 +0100345.BR "* linux_gpio_spi" " (for SPI flash ROMs attached to a GPIO chip device accessible via /dev/gpiochipX on Linux)"
346.sp
David Hendricksf9a30552015-05-23 20:30:30 -0700347.BR "* linux_mtd" " (for SPI flash ROMs accessible via /dev/mtdX on Linux)"
348.sp
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +0000349.BR "* linux_spi" " (for SPI flash ROMs accessible via /dev/spidevX.Y on Linux)"
350.sp
James Lairdc60de0e2013-03-27 13:00:23 +0000351.BR "* usbblaster_spi" " (for SPI flash ROMs attached to an Altera USB-Blaster compatible cable)"
352.sp
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000353.BR "* nicintel_eeprom" " (for SPI EEPROMs on Intel Gigabit network cards)"
354.sp
Alexandre Boeglin80e64712014-12-20 20:25:19 +0000355.BR "* mstarddc_spi" " (for SPI flash ROMs accessible through DDC in MSTAR-equipped displays)"
356.sp
Justin Chevrier66e554b2015-02-08 21:58:10 +0000357.BR "* pickit2_spi" " (for SPI flash ROMs accessible via Microchip PICkit2)"
358.sp
Urja Rannikko0870b022016-01-31 22:10:29 +0000359.BR "* ch341a_spi" " (for SPI flash ROMs attached to WCH CH341A)"
360.sp
Nicholas Chin197b7c72022-10-23 13:10:31 -0600361.BR "* ch347_spi" " (for SPI flash ROMs attached to WCH CH347)"
362.sp
Lubomir Rintelb2154e82018-01-14 17:35:33 +0100363.BR "* digilent_spi" " (for SPI flash ROMs attached to iCEblink40 development boards)"
364.sp
Marc Schink3578ec62016-03-17 16:23:03 +0100365.BR "* jlink_spi" " (for SPI flash ROMs attached to SEGGER J-Link and compatible devices)"
366.sp
Miklós Márton2d20d6d2018-01-30 20:20:15 +0100367.BR "* ni845x_spi" " (for SPI flash ROMs attached to National Instruments USB-8451 or USB-8452)"
368.sp
Miklós Márton324929c2019-08-01 19:14:10 +0200369.BR "* stlinkv3_spi" " (for SPI flash ROMs attached to STMicroelectronics STLINK V3 devices)"
370.sp
Jean THOMASe28d8e42022-10-11 17:54:30 +0200371.BR "* dirtyjtag_spi" " (for SPI flash ROMs attached to DirtyJTAG-compatible devices)"
372.sp
Michael Karchere5eafb22010-03-07 12:11:08 +0000373Some programmers have optional or mandatory parameters which are described
374in detail in the
Stefan Tauner6697f712014-08-06 15:09:15 +0000375.B PROGRAMMER-SPECIFIC INFORMATION
Michael Karchere5eafb22010-03-07 12:11:08 +0000376section. Support for some programmers can be disabled at compile time.
Nico Huberc3b02dc2023-08-12 01:13:45 +0200377.B "flashprog \-h"
Michael Karchere5eafb22010-03-07 12:11:08 +0000378lists all supported programmers.
379.TP
380.B "\-h, \-\-help"
381Show a help text and exit.
382.TP
Carl-Daniel Hailfinger0b9af362012-07-21 16:56:04 +0000383.B "\-o, \-\-output <logfile>"
384Save the full debug log to
385.BR <logfile> .
386If the file already exists, it will be overwritten. This is the recommended
Nico Huberc3b02dc2023-08-12 01:13:45 +0200387way to gather logs from flashprog because they will be verbose even if the
Stefan Tauner6697f712014-08-06 15:09:15 +0000388on-screen messages are not verbose and don't require output redirection.
Carl-Daniel Hailfinger0b9af362012-07-21 16:56:04 +0000389.TP
Richard Hughes842d6782021-01-15 09:48:12 +0000390.B "\-\-progress"
391Show progress percentage of operations on the standard output.
392.TP
Michael Karchere5eafb22010-03-07 12:11:08 +0000393.B "\-R, \-\-version"
394Show version information and exit.
Stefan Tauner6697f712014-08-06 15:09:15 +0000395.SH PROGRAMMER-SPECIFIC INFORMATION
Michael Karchere5eafb22010-03-07 12:11:08 +0000396Some programmer drivers accept further parameters to set programmer-specific
Uwe Hermann4e3d0b32010-03-25 23:18:41 +0000397parameters. These parameters are separated from the programmer name by a
Michael Karchere5eafb22010-03-07 12:11:08 +0000398colon. While some programmers take arguments at fixed positions, other
399programmers use a key/value interface in which the key and value is separated
400by an equal sign and different pairs are separated by a comma or a colon.
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000401.SS
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000402.BR "internal " programmer
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000403.TP
404.B Board Enables
405.sp
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000406Some mainboards require to run mainboard specific code to enable flash erase
407and write support (and probe support on old systems with parallel flash).
408The mainboard brand and model (if it requires specific code) is usually
409autodetected using one of the following mechanisms: If your system is
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000410running coreboot, the mainboard type is determined from the coreboot table.
411Otherwise, the mainboard is detected by examining the onboard PCI devices
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000412and possibly DMI info. If PCI and DMI do not contain information to uniquely
Carl-Daniel Hailfinger2d927fb2012-01-04 00:48:27 +0000413identify the mainboard (which is the exception), or if you want to override
414the detected mainboard model, you can specify the mainboard using the
415.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200416.B " flashprog \-p internal:mainboard=<vendor>:<board>"
Carl-Daniel Hailfinger2d927fb2012-01-04 00:48:27 +0000417syntax.
418.sp
419See the 'Known boards' or 'Known laptops' section in the output
Nico Huberc3b02dc2023-08-12 01:13:45 +0200420of 'flashprog \-L' for a list of boards which require the specification of
Carl-Daniel Hailfinger2d927fb2012-01-04 00:48:27 +0000421the board name, if no coreboot table is found.
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000422.sp
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000423Some of these board-specific flash enabling functions (called
424.BR "board enables" )
Nico Huberc3b02dc2023-08-12 01:13:45 +0200425in flashprog have not yet been tested. If your mainboard is detected needing
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000426an untested board enable function, a warning message is printed and the
427board enable is not executed, because a wrong board enable function might
428cause the system to behave erratically, as board enable functions touch the
429low-level internals of a mainboard. Not executing a board enable function
430(if one is needed) might cause detection or erasing failure. If your board
431protects only part of the flash (commonly the top end, called boot block),
Nico Huberc3b02dc2023-08-12 01:13:45 +0200432flashprog might encounter an error only after erasing the unprotected part,
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000433so running without the board-enable function might be dangerous for erase
434and write (which includes erase).
435.sp
436The suggested procedure for a mainboard with untested board specific code is
Nico Huberc3b02dc2023-08-12 01:13:45 +0200437to first try to probe the ROM (just invoke flashprog and check that it
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000438detects your flash chip type) without running the board enable code (i.e.
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000439without any parameters). If it finds your chip, fine. Otherwise, retry
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000440probing your chip with the board-enable code running, using
441.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200442.B " flashprog \-p internal:boardenable=force"
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000443.sp
444If your chip is still not detected, the board enable code seems to be broken
445or the flash chip unsupported. Otherwise, make a backup of your current ROM
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000446contents (using
447.BR \-r )
448and store it to a medium outside of your computer, like
449a USB drive or a network share. If you needed to run the board enable code
Stefan Taunereb582572012-09-21 12:52:50 +0000450already for probing, use it for reading too.
Martin Rothf6c1cb12022-03-15 10:55:25 -0600451If reading succeeds and the contents of the read file look legit you can try to write the new image.
Stefan Taunereb582572012-09-21 12:52:50 +0000452You should enable the board enable code in any case now, as it
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000453has been written because it is known that writing/erasing without the board
454enable is going to fail. In any case (success or failure), please report to
Nico Huberc3b02dc2023-08-12 01:13:45 +0200455the flashprog mailing list, see below.
Michael Karcher7f0c3ec2010-03-07 22:29:28 +0000456.sp
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000457.TP
458.B Coreboot
459.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200460On systems running coreboot, flashprog checks whether the desired image matches
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000461your mainboard. This needs some special board ID to be present in the image.
Nico Huberc3b02dc2023-08-12 01:13:45 +0200462If flashprog detects that the image you want to write and the current board
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000463do not match, it will refuse to write the image unless you specify
464.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200465.B " flashprog \-p internal:boardmismatch=force"
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000466.TP
467.B ITE IT87 Super I/O
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000468.sp
Vadim Girlin4dd0f902013-08-24 12:18:17 +0000469If your mainboard is manufactured by GIGABYTE and supports DualBIOS it is very likely that it uses an
470ITE IT87 series Super I/O to switch between the two flash chips. Only one of them can be accessed at a time
471and you can manually select which one to use with the
472.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200473.B " flashprog \-p internal:dualbiosindex=chip"
Vadim Girlin4dd0f902013-08-24 12:18:17 +0000474.sp
475syntax where
476.B chip
477is the index of the chip to use (0 = main, 1 = backup). You can check which one is currently selected by
478leaving out the
479.B chip
480parameter.
481.sp
Carl-Daniel Hailfinger01f3ef42010-03-25 02:50:40 +0000482If your mainboard uses an ITE IT87 series Super I/O for LPC<->SPI flash bus
Nico Huberc3b02dc2023-08-12 01:13:45 +0200483translation, flashprog should autodetect that configuration. If you want to
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000484set the I/O base port of the IT87 series SPI controller manually instead of
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000485using the value provided by the BIOS, use the
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +0000486.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200487.B " flashprog \-p internal:it87spiport=portnum"
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000488.sp
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000489syntax where
490.B portnum
491is the I/O port number (must be a multiple of 8). In the unlikely case
Nico Huberc3b02dc2023-08-12 01:13:45 +0200492flashprog doesn't detect an active IT87 LPC<->SPI bridge, please send a bug
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000493report so we can diagnose the problem.
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000494.sp
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000495.TP
Rudolf Marek70e14592013-07-25 22:58:56 +0000496.B AMD chipsets
497.sp
498Beginning with the SB700 chipset there is an integrated microcontroller (IMC) based on the 8051 embedded in
499every AMD southbridge. Its firmware resides in the same flash chip as the host's which makes writing to the
Nico Huberc3b02dc2023-08-12 01:13:45 +0200500flash risky if the IMC is active. Flashprog tries to temporarily disable the IMC but even then changing the
Rudolf Marek70e14592013-07-25 22:58:56 +0000501contents of the flash can have unwanted effects: when the IMC continues (at the latest after a reboot) it will
502continue executing code from the flash. If the code was removed or changed in an unfortunate way it is
Nico Huberc3b02dc2023-08-12 01:13:45 +0200503unpredictable what the IMC will do. Therefore, if flashprog detects an active IMC it will disable write support
Rudolf Marek70e14592013-07-25 22:58:56 +0000504unless the user forces it with the
505.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200506.B " flashprog \-p internal:amd_imc_force=yes"
Rudolf Marek70e14592013-07-25 22:58:56 +0000507.sp
508syntax. The user is responsible for supplying a suitable image or leaving out the IMC region with the help of
509a layout file. This limitation might be removed in the future when we understand the details better and have
510received enough feedback from users. Please report the outcome if you had to use this option to write a chip.
511.sp
Stefan Tauner21071b02014-05-16 21:39:48 +0000512An optional
513.B spispeed
514parameter specifies the frequency of the SPI bus where applicable (i.e.\& SB600 or later with an SPI flash chip
515directly attached to the chipset).
516Syntax is
517.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200518.B " flashprog \-p internal:spispeed=frequency"
Stefan Tauner21071b02014-05-16 21:39:48 +0000519.sp
520where
521.B frequency
522can be
523.BR "'16.5\ MHz'" ", " "'22\ MHz'" ", " "'33\ MHz'" ", " "'66\ MHz'" ", " "'100\ MHZ'" ", or " "'800\ kHz'" "."
524Support of individual frequencies depends on the generation of the chipset:
525.sp
526* SB6xx, SB7xx, SP5xxx: from 16.5 MHz up to and including 33 MHz
527.sp
528* SB8xx, SB9xx, Hudson: from 16.5 MHz up to and including 66 MHz
529.sp
530* Yangtze (with SPI 100 engine as found in Kabini and Tamesh): all of them
531.sp
532The default is to use 16.5 MHz and disable Fast Reads.
Rudolf Marek70e14592013-07-25 22:58:56 +0000533.TP
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000534.B Intel chipsets
535.sp
Stefan Tauner50e7c602011-11-08 10:55:54 +0000536If you have an Intel chipset with an ICH8 or later southbridge with SPI flash
Stefan Taunereb582572012-09-21 12:52:50 +0000537attached, and if a valid descriptor was written to it (e.g.\& by the vendor), the
Stefan Tauner50e7c602011-11-08 10:55:54 +0000538chipset provides an alternative way to access the flash chip(s) named
539.BR "Hardware Sequencing" .
540It is much simpler than the normal access method (called
541.BR "Software Sequencing" "),"
542but does not allow the software to choose the SPI commands to be sent.
543You can use the
544.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200545.B " flashprog \-p internal:ich_spi_mode=value"
Stefan Tauner50e7c602011-11-08 10:55:54 +0000546.sp
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000547syntax where
548.BR "value " "can be"
Stefan Tauner50e7c602011-11-08 10:55:54 +0000549.BR auto ", " swseq " or " hwseq .
550By default
551.RB "(or when setting " ich_spi_mode=auto )
Stefan Taunereb582572012-09-21 12:52:50 +0000552the module tries to use swseq and only activates hwseq if need be (e.g.\& if
Stefan Tauner50e7c602011-11-08 10:55:54 +0000553important opcodes are inaccessible due to lockdown; or if more than one flash
554chip is attached). The other options (swseq, hwseq) select the respective mode
555(if possible).
556.sp
Stefan Tauner5210e722012-02-16 01:13:00 +0000557ICH8 and later southbridges may also have locked address ranges of different
558kinds if a valid descriptor was written to it. The flash address space is then
559partitioned in multiple so called "Flash Regions" containing the host firmware,
560the ME firmware and so on respectively. The flash descriptor can also specify up
561to 5 so called "Protected Regions", which are freely chosen address ranges
562independent from the aforementioned "Flash Regions". All of them can be write
Nico Huber7590d1a2016-05-03 13:38:28 +0200563and/or read protected individually.
Stefan Tauner5210e722012-02-16 01:13:00 +0000564.sp
Kyösti Mälkki88ee0402013-09-14 23:37:01 +0000565If you have an Intel chipset with an ICH2 or later southbridge and if you want
Carl-Daniel Hailfinger46fa0682011-07-25 22:44:09 +0000566to set specific IDSEL values for a non-default flash chip or an embedded
567controller (EC), you can use the
568.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200569.B " flashprog \-p internal:fwh_idsel=value"
Carl-Daniel Hailfinger46fa0682011-07-25 22:44:09 +0000570.sp
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000571syntax where
572.B value
573is the 48-bit hexadecimal raw value to be written in the
Carl-Daniel Hailfinger46fa0682011-07-25 22:44:09 +0000574IDSEL registers of the Intel southbridge. The upper 32 bits use one hex digit
575each per 512 kB range between 0xffc00000 and 0xffffffff, and the lower 16 bits
576use one hex digit each per 1024 kB range between 0xff400000 and 0xff7fffff.
577The rightmost hex digit corresponds with the lowest address range. All address
578ranges have a corresponding sister range 4 MB below with identical IDSEL
579settings. The default value for ICH7 is given in the example below.
580.sp
581Example:
Nico Huberc3b02dc2023-08-12 01:13:45 +0200582.B "flashprog \-p internal:fwh_idsel=0x001122334567"
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000583.TP
584.B Laptops
Carl-Daniel Hailfinger46fa0682011-07-25 22:44:09 +0000585.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200586Using flashprog on older laptops that don't boot from the SPI bus is
Nico Huber2e50cdc2018-09-23 20:20:26 +0200587dangerous and may easily make your hardware unusable (see also the
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000588.B BUGS
Nico Huber2e50cdc2018-09-23 20:20:26 +0200589section). The embedded controller (EC) in some
590machines may interact badly with flashing.
Stefan Tauner4c723152016-01-14 22:47:55 +0000591More information is
Nico Huberc3b02dc2023-08-12 01:13:45 +0200592.URLB https://flashprog.org/Laptops "in the wiki" .
Nico Huber2e50cdc2018-09-23 20:20:26 +0200593Problems occur when the flash chip is shared between BIOS
Nico Huberc3b02dc2023-08-12 01:13:45 +0200594and EC firmware, and the latter does not expect flashprog
595to access the chip. While flashprog tries to change the contents of
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000596that memory the EC might need to fetch new instructions or data from it and
597could stop working correctly. Probing for and reading from the chip may also
598irritate your EC and cause fan failure, backlight failure, sudden poweroff, and
Nico Huberc3b02dc2023-08-12 01:13:45 +0200599other nasty effects. flashprog will attempt to detect if it is running on such a
Nico Huber2e50cdc2018-09-23 20:20:26 +0200600laptop and limit probing to SPI buses. If you want to probe the LPC bus
601anyway at your own risk, use
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000602.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200603.B " flashprog \-p internal:laptop=force_I_want_a_brick"
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000604.sp
Carl-Daniel Hailfinger27023762010-04-28 15:22:14 +0000605We will not help you if you force flashing on a laptop because this is a really
606dumb idea.
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000607.sp
608You have been warned.
609.sp
610Currently we rely on the chassis type encoded in the DMI/SMBIOS data to detect
611laptops. Some vendors did not implement those bits correctly or set them to
Nico Huberc3b02dc2023-08-12 01:13:45 +0200612generic and/or dummy values. flashprog will then issue a warning and restrict
Nico Huber2e50cdc2018-09-23 20:20:26 +0200613buses like above. In this case you can use
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000614.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200615.B " flashprog \-p internal:laptop=this_is_not_a_laptop"
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000616.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200617to tell flashprog (at your own risk) that it is not running on a laptop.
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000618.SS
Michael Karchere5eafb22010-03-07 12:11:08 +0000619.BR "dummy " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +0000620.IP
621The dummy programmer operates on a buffer in memory only. It provides a safe and fast way to test various
Nico Huberc3b02dc2023-08-12 01:13:45 +0200622aspects of flashprog and is mainly used in development and while debugging.
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000623It is able to emulate some chips to a certain degree (basic
624identify/read/erase/write operations work).
625.sp
Michael Karchere5eafb22010-03-07 12:11:08 +0000626An optional parameter specifies the bus types it
Carl-Daniel Hailfinger3504b532009-06-01 00:02:11 +0000627should support. For that you have to use the
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000628.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200629.B " flashprog \-p dummy:bus=[type[+type[+type]]]"
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000630.sp
Carl-Daniel Hailfinger3504b532009-06-01 00:02:11 +0000631syntax where
632.B type
Uwe Hermann68b9cca2011-06-15 23:44:52 +0000633can be
Carl-Daniel Hailfinger744132a2010-07-06 09:55:48 +0000634.BR parallel ", " lpc ", " fwh ", " spi
635in any order. If you specify bus without type, all buses will be disabled.
636If you do not specify bus, all buses will be enabled.
Carl-Daniel Hailfinger3504b532009-06-01 00:02:11 +0000637.sp
638Example:
Nico Huberc3b02dc2023-08-12 01:13:45 +0200639.B "flashprog \-p dummy:bus=lpc+fwh"
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000640.sp
641The dummy programmer supports flash chip emulation for automated self-tests
642without hardware access. If you want to emulate a flash chip, use the
643.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200644.B " flashprog \-p dummy:emulate=chip"
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000645.sp
646syntax where
647.B chip
648is one of the following chips (please specify only the chip name, not the
649vendor):
650.sp
Stefan Tauner23e10b82016-01-23 16:16:49 +0000651.RB "* ST " M25P10.RES " SPI flash chip (128 kB, RES, page write)"
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000652.sp
Stefan Tauner23e10b82016-01-23 16:16:49 +0000653.RB "* SST " SST25VF040.REMS " SPI flash chip (512 kB, REMS, byte write)"
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000654.sp
Stefan Tauner23e10b82016-01-23 16:16:49 +0000655.RB "* SST " SST25VF032B " SPI flash chip (4096 kB, RDID, AAI write)"
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000656.sp
Stefan Tauner23e10b82016-01-23 16:16:49 +0000657.RB "* Macronix " MX25L6436 " SPI flash chip (8192 kB, RDID, SFDP)"
Stefan Tauner0b9df972012-05-07 22:12:16 +0000658.sp
Sergii Dmytrukd6448932021-12-01 19:21:59 +0200659.RB "* Winbond " W25Q128FV " SPI flash chip (16384 kB, RDID)"
660.sp
Nico Huber4203a472022-05-28 17:28:05 +0200661.RB "* Spansion " S25FL128L " SPI flash chip (16384 kB, RDID)"
662.sp
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000663Example:
Nico Huberc3b02dc2023-08-12 01:13:45 +0200664.B "flashprog -p dummy:emulate=SST25VF040.REMS"
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000665.TP
666.B Persistent images
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000667.sp
668If you use flash chip emulation, flash image persistence is available as well
669by using the
670.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200671.B " flashprog \-p dummy:emulate=chip,image=image.rom"
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000672.sp
673syntax where
674.B image.rom
Nico Huberc3b02dc2023-08-12 01:13:45 +0200675is the file where the simulated chip contents are read on flashprog startup and
676where the chip contents on flashprog shutdown are written to.
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000677.sp
678Example:
Nico Huberc3b02dc2023-08-12 01:13:45 +0200679.B "flashprog -p dummy:emulate=M25P10.RES,image=dummy.bin"
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000680.TP
681.B SPI write chunk size
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000682.sp
683If you use SPI flash chip emulation for a chip which supports SPI page write
684with the default opcode, you can set the maximum allowed write chunk size with
685the
686.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200687.B " flashprog \-p dummy:emulate=chip,spi_write_256_chunksize=size"
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000688.sp
689syntax where
690.B size
Stefan Taunereb582572012-09-21 12:52:50 +0000691is the number of bytes (min.\& 1, max.\& 256).
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000692.sp
693Example:
694.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200695.B " flashprog -p dummy:emulate=M25P10.RES,spi_write_256_chunksize=5"
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000696.TP
697.B SPI blacklist
Carl-Daniel Hailfinger1b83be52012-02-08 23:28:54 +0000698.sp
699To simulate a programmer which refuses to send certain SPI commands to the
700flash chip, you can specify a blacklist of SPI commands with the
701.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200702.B " flashprog -p dummy:spi_blacklist=commandlist"
Carl-Daniel Hailfinger1b83be52012-02-08 23:28:54 +0000703.sp
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000704syntax where
705.B commandlist
706is a list of two-digit hexadecimal representations of
Nico Huberc3b02dc2023-08-12 01:13:45 +0200707SPI commands. If commandlist is e.g.\& 0302, flashprog will behave as if the SPI
Carl-Daniel Hailfinger1b83be52012-02-08 23:28:54 +0000708controller refuses to run command 0x03 (READ) and command 0x02 (WRITE).
709commandlist may be up to 512 characters (256 commands) long.
Nico Huberc3b02dc2023-08-12 01:13:45 +0200710Implementation note: flashprog will detect an error during command execution.
Carl-Daniel Hailfinger1b83be52012-02-08 23:28:54 +0000711.sp
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000712.TP
713.B SPI ignorelist
714.sp
Carl-Daniel Hailfinger1b83be52012-02-08 23:28:54 +0000715To simulate a flash chip which ignores (doesn't support) certain SPI commands,
716you can specify an ignorelist of SPI commands with the
717.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200718.B " flashprog -p dummy:spi_ignorelist=commandlist"
Carl-Daniel Hailfinger1b83be52012-02-08 23:28:54 +0000719.sp
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000720syntax where
721.B commandlist
722is a list of two-digit hexadecimal representations of
Stefan Taunereb582572012-09-21 12:52:50 +0000723SPI commands. If commandlist is e.g.\& 0302, the emulated flash chip will ignore
Carl-Daniel Hailfinger1b83be52012-02-08 23:28:54 +0000724command 0x03 (READ) and command 0x02 (WRITE). commandlist may be up to 512
725characters (256 commands) long.
Nico Huberc3b02dc2023-08-12 01:13:45 +0200726Implementation note: flashprog won't detect an error during command execution.
Stefan Tauner5e695ab2012-05-06 17:03:40 +0000727.sp
728.TP
729.B SPI status register
730.sp
731You can specify the initial content of the chip's status register with the
732.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200733.B " flashprog -p dummy:spi_status=content"
Stefan Tauner5e695ab2012-05-06 17:03:40 +0000734.sp
Carl-Daniel Hailfinger4e3391f2012-07-22 12:01:43 +0000735syntax where
736.B content
Sergii Dmytruk59151a42021-11-08 00:05:12 +0200737is a hexadecimal value of up to 24 bits. For example, 0x332211 assigns 0x11 to
738SR1, 0x22 to SR2 and 0x33 to SR3. Shorter value is padded to 24 bits with
739zeroes on the left. See datasheet for chosen chip for details about the
740registers content.
Sergii Dmytruk2fc70dc2021-11-08 01:38:52 +0200741.sp
742.TP
743.B Write protection
744.sp
Nico Huber4203a472022-05-28 17:28:05 +0200745Chips with emulated WP: W25Q128FV, S25FL128L.
Sergii Dmytruk2fc70dc2021-11-08 01:38:52 +0200746.sp
747You can simulate state of hardware protection pin (WP) with the
748.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200749.B " flashprog -p dummy:hwwp=state"
Sergii Dmytruk2fc70dc2021-11-08 01:38:52 +0200750.sp
751syntax where
752.B state
753is "yes" or "no" (default value). "yes" means active state of the pin implies
754that chip is write-protected (on real hardware the pin is usually negated, but
755not here).
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000756.SS
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000757.BR "nic3com" , " nicrealtek" , " nicnatsemi" , " nicintel", " nicintel_eeprom"\
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000758, " nicintel_spi" , " gfxnvidia" , " ogp_spi" , " drkaiser" , " satasii"\
Joseph C. Lehnerc2644a32016-01-16 23:45:25 +0000759, " satamv" , " atahpt", " atavia ", " atapromise " and " it8212 " programmers
Stefan Tauner4c723152016-01-14 22:47:55 +0000760.IP
Michael Karchere5eafb22010-03-07 12:11:08 +0000761These programmers have an option to specify the PCI address of the card
762your want to use, which must be specified if more than one card supported
763by the selected programmer is installed in your system. The syntax is
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000764.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200765.BR " flashprog \-p xxxx:pci=bb:dd.f" ,
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +0000766.sp
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000767where
Uwe Hermannc7e8a0c2009-05-19 14:14:21 +0000768.B xxxx
Stefan Taunerc2eec2c2014-05-03 21:33:01 +0000769is the name of the programmer,
Uwe Hermann530cb2d2009-05-14 22:58:21 +0000770.B bb
771is the PCI bus number,
772.B dd
773is the PCI device number, and
774.B f
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000775is the PCI function number of the desired device.
Uwe Hermann530cb2d2009-05-14 22:58:21 +0000776.sp
777Example:
Nico Huberc3b02dc2023-08-12 01:13:45 +0200778.B "flashprog \-p nic3com:pci=05:04.0"
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000779.SS
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000780.BR "atavia " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +0000781.IP
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000782Due to the mysterious address handling of the VIA VT6421A controller the user can specify an offset with the
783.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200784.B " flashprog \-p atavia:offset=addr"
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000785.sp
786syntax where
787.B addr
788will be interpreted as usual (leading 0x (0) for hexadecimal (octal) values, or else decimal).
789For more information please see
Nico Huberc3b02dc2023-08-12 01:13:45 +0200790.URLB https://flashprog.org/VT6421A "its wiki page" .
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +0000791.SS
Joseph C. Lehnerc2644a32016-01-16 23:45:25 +0000792.BR "atapromise " programmer
793.IP
794This programmer is currently limited to 32 kB, regardless of the actual size of the flash chip. This stems
795from the fact that, on the tested device (a Promise Ultra100), not all of the chip's address lines were
796actually connected. You may use this programmer to flash firmware updates, since these are only 16 kB in
797size (padding to 32 kB is required).
798.SS
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000799.BR "nicintel_eeprom " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +0000800.IP
Nico Huberc3b02dc2023-08-12 01:13:45 +0200801This is the first programmer module in flashprog that does not provide access to NOR flash chips but EEPROMs
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000802mounted on gigabit Ethernet cards based on Intel's 82580 NIC. Because EEPROMs normally do not announce their
Stefan Tauner0be072c2016-03-13 15:16:30 +0000803size nor allow themselves to be identified, the controller relies on correct size values written to predefined
Nico Huberc3b02dc2023-08-12 01:13:45 +0200804addresses within the chip. Flashprog follows this scheme but assumes the minimum size of 16 kB (128 kb) if an
Stefan Tauner0be072c2016-03-13 15:16:30 +0000805unprogrammed EEPROM/card is detected. Intel specifies following EEPROMs to be compatible:
806Atmel AT25128, AT25256, Micron (ST) M95128, M95256 and OnSemi (Catalyst) CAT25CS128.
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +0000807.SS
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000808.BR "ft2232_spi " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +0000809.IP
Alexander Goncharov11d85772023-02-25 17:32:21 +0400810This module supports various programmers based on FTDI FT2232/FT4232H/FT4233H/FT232H chips including the DLP Design
Stefan Tauner0be072c2016-03-13 15:16:30 +0000811DLP-USB1232H, openbiosprog-spi, Amontec JTAGkey/JTAGkey-tiny/JTAGkey-2, Dangerous Prototypes Bus Blaster,
812Olimex ARM-USB-TINY/-H, Olimex ARM-USB-OCD/-H, OpenMoko Neo1973 Debug board (V2+), TIAO/DIYGADGET USB
Jacek Naglak24e1bbb2022-05-18 02:25:13 +0200813Multi-Protocol Adapter (TUMPA), TUMPA Lite, GOEPEL PicoTAP, Google Servo v1/v2, Tin Can Tools
814Flyswatter/Flyswatter 2 and Kristech KT-LINK.
Stefan Tauner0be072c2016-03-13 15:16:30 +0000815.sp
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000816An optional parameter specifies the controller
Michael Niewöhner1da06352021-09-23 21:25:03 +0200817type, channel/interface/port it should support. For that you have to use the
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000818.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200819.B " flashprog \-p ft2232_spi:type=model,port=interface"
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000820.sp
Carl-Daniel Hailfingerfeea2722009-07-01 00:02:23 +0000821syntax where
822.B model
Uwe Hermann68b9cca2011-06-15 23:44:52 +0000823can be
Ilya A. Volynets-Evenbakh2c714ab2012-09-26 00:47:09 +0000824.BR 2232H ", " 4232H ", " 232H ", " jtagkey ", " busblaster ", " openmoko ", " \
Uwe Hermann836b26a2011-10-14 20:33:14 +0000825arm-usb-tiny ", " arm-usb-tiny-h ", " arm-usb-ocd ", " arm-usb-ocd-h \
Todd Broch6800c952016-02-14 15:46:00 +0000826", " tumpa ", " tumpalite ", " picotap ", " google-servo ", " google-servo-v2 \
Jacek Naglak24e1bbb2022-05-18 02:25:13 +0200827", " google-servo-v2-legacy " or " kt-link
Carl-Daniel Hailfingerfeea2722009-07-01 00:02:23 +0000828.B interface
Uwe Hermann68b9cca2011-06-15 23:44:52 +0000829can be
Michael Niewöhner1da06352021-09-23 21:25:03 +0200830.BR A ", " B ", " C ", or " D .
Carl-Daniel Hailfingerfeea2722009-07-01 00:02:23 +0000831The default model is
832.B 4232H
Sergey Alirzaev4acc3f32018-08-01 16:39:17 +0300833the default interface is
834.BR A
835and GPIO is not used by default.
Samir Ibradžićb482c6d2012-05-15 22:58:19 +0000836.sp
Shik Chen14fbc4b2012-09-17 00:40:54 +0000837If there is more than one ft2232_spi-compatible device connected, you can select which one should be used by
838specifying its serial number with the
839.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200840.B " flashprog \-p ft2232_spi:serial=number"
Shik Chen14fbc4b2012-09-17 00:40:54 +0000841.sp
842syntax where
843.B number
844is the serial number of the device (which can be found for example in the output of lsusb -v).
845.sp
Samir Ibradžićb482c6d2012-05-15 22:58:19 +0000846All models supported by the ft2232_spi driver can configure the SPI clock rate by setting a divisor. The
Stefan Tauner0554ca52013-07-25 22:54:25 +0000847expressible divisors are all
848.B even
849numbers between 2 and 2^17 (=131072) resulting in SPI clock frequencies of
Nicholas Chin32392b52022-12-01 11:51:04 -07008506 MHz down to about 92 Hz for 12 MHz inputs (non-H chips) and 30 MHz down to about 458 Hz for 60 MHz inputs ('H' chips). The default
851divisor is set to 2, but you can use another one by specifying the optional
Samir Ibradžićb482c6d2012-05-15 22:58:19 +0000852.B divisor
853parameter with the
854.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200855.B " flashprog \-p ft2232_spi:divisor=div"
Samir Ibradžićb482c6d2012-05-15 22:58:19 +0000856.sp
857syntax.
Michael Niewöhner1da06352021-09-23 21:25:03 +0200858.sp
859Using the parameter
Michael Niewöhnerece63c82021-09-21 20:15:32 +0200860.B csgpiol (DEPRECATED - use gpiol instead)
Michael Niewöhner1da06352021-09-23 21:25:03 +0200861an additional CS# pin can be chosen, where the value can be a number between 0 and 3, denoting GPIOL0-GPIOL3
862correspondingly. Example:
863.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200864.B " flashprog \-p ft2232_spi:csgpiol=3"
Michael Niewöhner1da06352021-09-23 21:25:03 +0200865.sp
Michael Niewöhnerece63c82021-09-21 20:15:32 +0200866The parameter
867.B gpiolX=[HLC]
Martin Rothf6c1cb12022-03-15 10:55:25 -0600868allows use of the GPIOL pins either as generic gpios with a fixed value during flashing or as additional CS#
Michael Niewöhnerece63c82021-09-21 20:15:32 +0200869signal, where
870.B X
871can be a number between 0 and 3, denoting GPIOL0-GPIOL3 correspondingly. The parameter may be specified
872multiple times, one time per GPIOL pin.
873Valid values are
874.B H
875,
876.B L
877and
878.B C
879:
880.br
881.B " H "
882- Set GPIOL output high
883.br
884.B " L "
885- Set GPIOL output low
886.br
887.B " C "
888- Use GPIOL as additional CS# output
889.sp
890.B Example:
891.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200892.B " flashprog \-p ft2232_spi:gpiol0=H"
Michael Niewöhnerece63c82021-09-21 20:15:32 +0200893.sp
894.B Note
895that not all GPIOL pins are freely usable with all programmers as some have special functionality.
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000896.SS
Nico Huber044c9dc2023-12-29 23:26:57 +0100897.BR "ft4222_spi " programmer
898.IP
899This driver supports programmers based on the FTDI FT4222H chip.
900.sp
901An optional
902.B cs
903parameter can be used to select the USB interface and respective CS#
904output
905.BR 0 .. 3 ", e.g."
906.sp
907.B " flashprog \-p ft4222_spi:cs=3"
908.sp
909The ft4222_spi driver supports setting the SPI clock rate in kHz with
910the
911.B spispeed
912parameter. The actual clock rate will be rounded down to a supported
913value (power-of-2 fractions of 80MHz, 60MHz and 48MHz base clocks).
914Hence the highest supported SPI clock rates are 40MHz, 30MHz, 24Mhz,
91520MHz, 15MHz, 12MHz, and so forth. As this also affects the base clock
916of the controller and thereby the overall bandwidth, there is a wrinkle:
917Quad-i/o reads can actually be faster at 20MHz (80MHz base clock) than
918they are at 30MHz or 24MHz with a lower base clock.
919.sp
920.B " flashprog \-p ft4222_spi:spispeed=20000"
921.sp
922The default is 10MHz.
923.sp
924As the FT4222H supports dual and quad i/o, there is an additional
925.B iomode
926parameter to specify how many lines can be used for bidirectional i/o.
927Valid values are
928.BR single ", " dual ", or " quad .
929The default is
930.B dual
931as at least two lines are always connected (MOSI and MISO). Quad i/o
932is most useful to get high transfer rates when the hardware setup is
933not reliable enough for high clock rates, e.g.
934.sp
935.B " flashprog \-p ft4222_spi:spispeed=15000,iomode=quad"
936.sp
937Note that the overall bandwidth of the FT4222H is limited to
93852.8Mb/s (with the 80MHz base clock). This is almost saturated
939at 20MHz x4.
940.SS
Michael Karchere5eafb22010-03-07 12:11:08 +0000941.BR "serprog " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +0000942.IP
Stefan Tauner0be072c2016-03-13 15:16:30 +0000943This module supports all programmers speaking the serprog protocol. This includes some Arduino-based devices
944as well as various programmers by Urja Rannikko, Juhana Helovuo, Stefan Tauner, Chi Zhang and many others.
945.sp
Stefan Tauner72587f82016-01-04 03:05:15 +0000946A mandatory parameter specifies either a serial device (and baud rate) or an IP/port combination for
947communicating with the programmer.
948The device/baud combination has to start with
949.B dev=
950and separate the optional baud rate with a colon.
951For example
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000952.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200953.B " flashprog \-p serprog:dev=/dev/ttyS0:115200"
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000954.sp
Stefan Tauner72587f82016-01-04 03:05:15 +0000955If no baud rate is given the default values by the operating system/hardware will be used.
956For IP connections you have to use the
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000957.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200958.B " flashprog \-p serprog:ip=ipaddr:port"
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000959.sp
Stefan Tauner72587f82016-01-04 03:05:15 +0000960syntax.
961In case the device supports it, you can set the SPI clock frequency with the optional
Stefan Taunerb98f6eb2012-08-13 16:33:04 +0000962.B spispeed
Stefan Tauner0554ca52013-07-25 22:54:25 +0000963parameter. The frequency is parsed as hertz, unless an
Stefan Taunerb98f6eb2012-08-13 16:33:04 +0000964.BR M ", or " k
965suffix is given, then megahertz or kilohertz are used respectively.
966Example that sets the frequency to 2 MHz:
967.sp
Nico Huber8d36db62024-02-24 20:50:42 +0100968.B " flashprog \-p serprog:dev=/dev/ttyACM0,spispeed=2M"
Stefan Taunerb98f6eb2012-08-13 16:33:04 +0000969.sp
Riku Viitanend2ac3032024-02-24 21:23:19 +0200970In case the device supports it, you can set which SPI Chip Select to use with the optional
971.B cs
972parameter. Example that tells the programmer to use chip select number 0:
973.sp
974.B " flashprog \-p serprog:dev=/dev/ttyACM0:cs=0"
975.sp
Stefan Taunerb98f6eb2012-08-13 16:33:04 +0000976More information about serprog is available in
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000977.B serprog-protocol.txt
978in the source distribution.
Stefan Tauner9e9f6842012-02-16 20:55:27 +0000979.SS
Carl-Daniel Hailfinger71127722010-05-31 15:27:27 +0000980.BR "buspirate_spi " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +0000981.IP
Uwe Hermann9ff514d2010-06-07 19:41:25 +0000982A required
983.B dev
984parameter specifies the Bus Pirate device node and an optional
985.B spispeed
986parameter specifies the frequency of the SPI bus. The parameter
Michael Karchere5eafb22010-03-07 12:11:08 +0000987delimiter is a comma. Syntax is
Carl-Daniel Hailfingerdfade102009-08-18 23:51:22 +0000988.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +0200989.B " flashprog \-p buspirate_spi:dev=/dev/device,spispeed=frequency"
Michael Karchere5eafb22010-03-07 12:11:08 +0000990.sp
Carl-Daniel Hailfingerd5b28fa2009-11-24 18:27:10 +0000991where
992.B frequency
Uwe Hermann68b9cca2011-06-15 23:44:52 +0000993can be
994.BR 30k ", " 125k ", " 250k ", " 1M ", " 2M ", " 2.6M ", " 4M " or " 8M
Michael Karchere5eafb22010-03-07 12:11:08 +0000995(in Hz). The default is the maximum frequency of 8 MHz.
Brian Salcedo30dfdba2013-01-03 20:44:30 +0000996.sp
Shawn Anastasio2b5adfb2017-12-31 00:17:15 -0600997The baud rate for communication between the host and the Bus Pirate can be specified with the optional
998.B serialspeed
999parameter. Syntax is
1000.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001001.B " flashprog -p buspirate_spi:serialspeed=baud
Shawn Anastasio2b5adfb2017-12-31 00:17:15 -06001002.sp
1003where
1004.B baud
1005can be
1006.BR 115200 ", " 230400 ", " 250000 " or " 2000000 " (" 2M ")."
1007The default is 2M baud for Bus Pirate hardware version 3.0 and greater, and 115200 otherwise.
1008.sp
Brian Salcedo30dfdba2013-01-03 20:44:30 +00001009An optional pullups parameter specifies the use of the Bus Pirate internal pull-up resistors. This may be
1010needed if you are working with a flash ROM chip that you have physically removed from the board. Syntax is
1011.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001012.B " flashprog -p buspirate_spi:pullups=state"
Brian Salcedo30dfdba2013-01-03 20:44:30 +00001013.sp
1014where
1015.B state
1016can be
1017.BR on " or " off .
Stefan Tauner4c723152016-01-14 22:47:55 +00001018More information about the Bus Pirate pull-up resistors and their purpose is available
1019.URLB "http://dangerousprototypes.com/docs/Practical_guide_to_Bus_Pirate_pull-up_resistors" \
1020"in a guide by dangerousprototypes" .
Jeremy Kerr98bdcb42021-05-23 17:58:06 +08001021.sp
1022The state of the Bus Pirate power supply pins is controllable through an optional
1023.B psus
1024parameter. Syntax is
1025.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001026.B " flashprog -p buspirate_spi:psus=state"
Jeremy Kerr98bdcb42021-05-23 17:58:06 +08001027.sp
1028where
1029.B state
1030can be
1031.BR on " or " off .
1032This allows the bus pirate to power the ROM chip directly. This may also be used to provide the
1033required pullup voltage (when using the
1034.B pullups
1035option), by connecting the Bus Pirate's Vpu input to the appropriate Vcc pin.
Stefan Tauner9e9f6842012-02-16 20:55:27 +00001036.SS
Justin Chevrier66e554b2015-02-08 21:58:10 +00001037.BR "pickit2_spi " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +00001038.IP
Justin Chevrier66e554b2015-02-08 21:58:10 +00001039An optional
1040.B voltage
1041parameter specifies the voltage the PICkit2 should use. The default unit is Volt if no unit is specified.
1042You can use
1043.BR mV ", " millivolt ", " V " or " Volt
1044as unit specifier. Syntax is
1045.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001046.B " flashprog \-p pickit2_spi:voltage=value"
Justin Chevrier66e554b2015-02-08 21:58:10 +00001047.sp
1048where
1049.B value
1050can be
1051.BR 0V ", " 1.8V ", " 2.5V ", " 3.5V
1052or the equivalent in mV.
1053.sp
1054An optional
1055.B spispeed
1056parameter specifies the frequency of the SPI bus. Syntax is
1057.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001058.B " flashprog \-p pickit2_spi:spispeed=frequency"
Justin Chevrier66e554b2015-02-08 21:58:10 +00001059.sp
1060where
1061.B frequency
1062can be
1063.BR 250k ", " 333k ", " 500k " or " 1M "
1064(in Hz). The default is a frequency of 1 MHz.
1065.SS
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001066.BR "dediprog " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +00001067.IP
Carl-Daniel Hailfingerc2441382010-11-09 22:00:31 +00001068An optional
1069.B voltage
1070parameter specifies the voltage the Dediprog should use. The default unit is
1071Volt if no unit is specified. You can use
1072.BR mV ", " milliVolt ", " V " or " Volt
1073as unit specifier. Syntax is
1074.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001075.B " flashprog \-p dediprog:voltage=value"
Carl-Daniel Hailfingerc2441382010-11-09 22:00:31 +00001076.sp
1077where
1078.B value
Uwe Hermann68b9cca2011-06-15 23:44:52 +00001079can be
Carl-Daniel Hailfingerc2441382010-11-09 22:00:31 +00001080.BR 0V ", " 1.8V ", " 2.5V ", " 3.5V
1081or the equivalent in mV.
Nathan Laredo21541a62012-12-24 22:07:36 +00001082.sp
1083An optional
1084.B device
1085parameter specifies which of multiple connected Dediprog devices should be used.
1086Please be aware that the order depends on libusb's usb_get_busses() function and that the numbering starts
1087at 0.
1088Usage example to select the second device:
1089.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001090.B " flashprog \-p dediprog:device=1"
Nico Huber77fa67d2013-02-20 18:03:36 +00001091.sp
1092An optional
1093.B spispeed
Patrick Georgiefe2d432013-05-23 21:47:46 +00001094parameter specifies the frequency of the SPI bus. The firmware on the device needs to be 5.0.0 or newer.
1095Syntax is
Nico Huber77fa67d2013-02-20 18:03:36 +00001096.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001097.B " flashprog \-p dediprog:spispeed=frequency"
Nico Huber77fa67d2013-02-20 18:03:36 +00001098.sp
1099where
1100.B frequency
1101can be
1102.BR 375k ", " 750k ", " 1.5M ", " 2.18M ", " 3M ", " 8M ", " 12M " or " 24M
1103(in Hz). The default is a frequency of 12 MHz.
Stefan Taunere659d2d2013-05-03 21:58:28 +00001104.sp
1105An optional
1106.B target
1107parameter specifies which target chip should be used. Syntax is
1108.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001109.B " flashprog \-p dediprog:target=value"
Stefan Taunere659d2d2013-05-03 21:58:28 +00001110.sp
1111where
1112.B value
1113can be
1114.BR 1 " or " 2
Stefan Tauner6697f712014-08-06 15:09:15 +00001115to select target chip 1 or 2 respectively. The default is target chip 1.
Nico Hubera1b7f352024-03-25 18:32:11 +01001116.sp
1117Dediprog SF600 and SF700 programmer models support dual and quad i/o.
1118The default is dual i/o on newer models with protocol v3 and single i/o
1119otherwise. The mode can be set with the
1120.B iomode
1121parameter. Valid values are
1122.BR single ", " dual ", or " quad .
1123For instance, to enable quad i/o
1124.sp
1125.B " flashprog \-p dediprog:iomode=quad"
Stefan Tauner9e9f6842012-02-16 20:55:27 +00001126.SS
Carl-Daniel Hailfingere7fdd6e2010-07-21 10:26:01 +00001127.BR "rayer_spi " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +00001128.IP
Carl-Daniel Hailfinger37c42522010-10-05 19:19:48 +00001129The default I/O base address used for the parallel port is 0x378 and you can use
1130the optional
1131.B iobase
1132parameter to specify an alternate base I/O address with the
1133.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001134.B " flashprog \-p rayer_spi:iobase=baseaddr"
Carl-Daniel Hailfinger37c42522010-10-05 19:19:48 +00001135.sp
1136syntax where
1137.B baseaddr
1138is base I/O port address of the parallel port, which must be a multiple of
1139four. Make sure to not forget the "0x" prefix for hexadecimal port addresses.
1140.sp
Carl-Daniel Hailfingerae418d82011-09-12 06:17:06 +00001141The default cable type is the RayeR cable. You can use the optional
1142.B type
1143parameter to specify the cable type with the
1144.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001145.B " flashprog \-p rayer_spi:type=model"
Carl-Daniel Hailfingerae418d82011-09-12 06:17:06 +00001146.sp
1147syntax where
1148.B model
1149can be
Maksim Kuleshov4dab5c12013-10-02 01:22:02 +00001150.BR rayer " for the RayeR cable, " byteblastermv " for the Altera ByteBlasterMV, " stk200 " for the Atmel \
Stefan Taunerfdb16592016-02-28 17:04:38 +00001151STK200/300, " wiggler " for the Macraigor Wiggler, " xilinx " for the Xilinx Parallel Cable III (DLC 5), or" \
1152" spi_tt" " for SPI Tiny Tools-compatible hardware.
Carl-Daniel Hailfingerae418d82011-09-12 06:17:06 +00001153.sp
1154More information about the RayeR hardware is available at
Stefan Tauner23e10b82016-01-23 16:16:49 +00001155.nh
Stefan Tauner4c723152016-01-14 22:47:55 +00001156.URLB "http://rayer.g6.cz/elektro/spipgm.htm" "RayeR's website" .
Maksim Kuleshov3647b2d2013-10-02 01:21:57 +00001157The Altera ByteBlasterMV datasheet can be obtained from
Stefan Tauner4c723152016-01-14 22:47:55 +00001158.URLB "http://www.altera.co.jp/literature/ds/dsbytemv.pdf" Altera .
Maksim Kuleshovacba2ac2013-10-02 01:22:11 +00001159For more information about the Macraigor Wiggler see
Stefan Tauner4c723152016-01-14 22:47:55 +00001160.URLB "http://www.macraigor.com/wiggler.htm" "their company homepage" .
Kyösti Mälkki8b1bdf12013-10-02 01:21:45 +00001161The schematic of the Xilinx DLC 5 was published in
Stefan Tauner4c723152016-01-14 22:47:55 +00001162.URLB "http://www.xilinx.com/support/documentation/user_guides/xtp029.pdf" "a Xilinx user guide" .
Stefan Tauner9e9f6842012-02-16 20:55:27 +00001163.SS
Michael Karchere5449392012-05-05 20:53:59 +00001164.BR "pony_spi " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +00001165.IP
Michael Karchere5449392012-05-05 20:53:59 +00001166The serial port (like /dev/ttyS0, /dev/ttyUSB0 on Linux or COM3 on windows) is
1167specified using the mandatory
Stefan Taunere34e3e82013-01-01 00:06:51 +00001168.B dev
Michael Karchere5449392012-05-05 20:53:59 +00001169parameter. The adapter type is selectable between SI-Prog (used for
1170SPI devices with PonyProg 2000) or a custom made serial bitbanging programmer
1171named "serbang". The optional
Stefan Taunere34e3e82013-01-01 00:06:51 +00001172.B type
Michael Karchere5449392012-05-05 20:53:59 +00001173parameter accepts the values "si_prog" (default) or "serbang".
1174.sp
1175Information about the SI-Prog adapter can be found at
Stefan Tauner4c723152016-01-14 22:47:55 +00001176.URLB "http://www.lancos.com/siprogsch.html" "its website" .
Michael Karchere5449392012-05-05 20:53:59 +00001177.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001178An example call to flashprog is
Michael Karchere5449392012-05-05 20:53:59 +00001179.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001180.B " flashprog \-p pony_spi:dev=/dev/ttyS0,type=serbang"
Michael Karchere5449392012-05-05 20:53:59 +00001181.sp
1182Please note that while USB-to-serial adapters work under certain circumstances,
1183this slows down operation considerably.
1184.SS
Mark Marshall90021f22010-12-03 14:48:11 +00001185.BR "ogp_spi " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +00001186.IP
Stefan Tauner9e9f6842012-02-16 20:55:27 +00001187The flash ROM chip to access must be specified with the
Mark Marshall90021f22010-12-03 14:48:11 +00001188.B rom
1189parameter.
1190.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001191.B " flashprog \-p ogp_spi:rom=name"
Mark Marshall90021f22010-12-03 14:48:11 +00001192.sp
1193Where
1194.B name
1195is either
1196.B cprom
1197or
1198.B s3
Stefan Taunere34e3e82013-01-01 00:06:51 +00001199for the configuration ROM and
Mark Marshall90021f22010-12-03 14:48:11 +00001200.B bprom
1201or
1202.B bios
Uwe Hermann68b9cca2011-06-15 23:44:52 +00001203for the BIOS ROM. If more than one card supported by the ogp_spi programmer
Mark Marshall90021f22010-12-03 14:48:11 +00001204is installed in your system, you have to specify the PCI address of the card
1205you want to use with the
1206.B pci=
1207parameter as explained in the
Stefan Taunere34e3e82013-01-01 00:06:51 +00001208.B nic3com et al.\&
Mark Marshall90021f22010-12-03 14:48:11 +00001209section above.
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +00001210.SS
Steve Markgraf61899472023-01-09 23:06:52 +01001211.BR "linux_gpio_spi " programmer
1212.IP
1213Either the GPIO device node or the chip number as well as the GPIO numbers
1214of the SPI lines must be specified like in the following examples:
1215.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001216.B " flashprog \-p linux_gpio_spi:dev=/dev/gpiochip0,cs=8,sck=11,mosi=10,miso=9"
Steve Markgraf61899472023-01-09 23:06:52 +01001217.sp
1218or
1219.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001220.B " flashprog \-p linux_gpio_spi:gpiochip=0,cs=8,sck=11,mosi=10,miso=9"
Steve Markgraf61899472023-01-09 23:06:52 +01001221.sp
1222Here,
1223.B gpiochip=0
1224selects the GPIO chip 0, accessible through Linux device node /dev/gpiochip0, and the
1225.B cs, sck, mosi, miso
Nico Huberfc7c13c2024-01-14 23:39:40 +01001226arguments select the GPIO numbers used as SPI lines connected to the flash ROM chip.
1227If libgpiod 2.0 or later is available, dual-i/o is enabled by default with bidirectional
1228MOSI and MISO lines, and if a quad-i/o capable chip is connect with four lines, the
1229additional GPIOs can be specified via
1230.BR io2 " and " io3
1231parameters.
1232
1233In the example above, the GPIO numbers of the hardware SPI lines of a Raspberry Pi
1234single board computer are specified. The first four GPIO parameters are mandatory.
1235Note that this is a bitbanged driver, and if your device has a hardware SPI
1236controller, use the
Steve Markgraf61899472023-01-09 23:06:52 +01001237.B linux_spi
1238programmer driver instead for better performance.
1239.sp
1240Refer to the output of the
1241.B gpioinfo
1242utility to make sure the GPIO numbers are correct and unused.
1243.sp
1244Please note that the linux_gpio_spi driver only works on Linux, and depends on libgpiod.
1245.SS
David Hendricksf9a30552015-05-23 20:30:30 -07001246.BR "linux_mtd " programmer
1247.IP
1248You may specify the MTD device to use with the
1249.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001250.B " flashprog \-p linux_mtd:dev=/dev/mtdX"
David Hendricksf9a30552015-05-23 20:30:30 -07001251.sp
1252syntax where
1253.B /dev/mtdX
1254is the Linux device node for your MTD device. If left unspecified the first MTD
1255device found (e.g. /dev/mtd0) will be used by default.
1256.sp
1257Please note that the linux_mtd driver only works on Linux.
1258.SS
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +00001259.BR "linux_spi " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +00001260.IP
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +00001261You have to specify the SPI controller to use with the
1262.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001263.B " flashprog \-p linux_spi:dev=/dev/spidevX.Y"
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +00001264.sp
1265syntax where
1266.B /dev/spidevX.Y
1267is the Linux device node for your SPI controller.
1268.sp
Stefan Tauner0554ca52013-07-25 22:54:25 +00001269In case the device supports it, you can set the SPI clock frequency with the optional
1270.B spispeed
1271parameter. The frequency is parsed as kilohertz.
1272Example that sets the frequency to 8 MHz:
1273.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001274.B " flashprog \-p linux_spi:dev=/dev/spidevX.Y,spispeed=8000"
Stefan Tauner0554ca52013-07-25 22:54:25 +00001275.sp
Carl-Daniel Hailfinger8541d232012-02-16 21:00:27 +00001276Please note that the linux_spi driver only works on Linux.
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001277.SS
1278.BR "mstarddc_spi " programmer
Stefan Tauner4c723152016-01-14 22:47:55 +00001279.IP
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001280The Display Data Channel (DDC) is an I2C bus present on VGA and DVI connectors, that allows exchanging
Stefan Tauner0be072c2016-03-13 15:16:30 +00001281information between a computer and attached displays. Its most common uses are getting display capabilities
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001282through EDID (at I2C address 0x50) and sending commands to the display using the DDC/CI protocol (at address
12830x37). On displays driven by MSTAR SoCs, it is also possible to access the SoC firmware flash (connected to
1284the Soc through another SPI bus) using an In-System Programming (ISP) port, usually at address 0x49.
Nico Huberc3b02dc2023-08-12 01:13:45 +02001285This flashprog module allows the latter via Linux's I2C driver.
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001286.sp
1287.B IMPORTANT:
1288Before using this programmer, the display
1289.B MUST
Nico Huberc3b02dc2023-08-12 01:13:45 +02001290be in standby mode, and only connected to the computer that will run flashprog using a VGA cable, to an
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001291inactive VGA output. It absolutely
1292.B MUST NOT
1293be used as a display during the procedure!
1294.sp
1295You have to specify the DDC/I2C controller and I2C address to use with the
1296.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001297.B " flashprog \-p mstarddc_spi:dev=/dev/i2c-X:YY"
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001298.sp
1299syntax where
1300.B /dev/i2c-X
1301is the Linux device node for your I2C controller connected to the display's DDC channel, and
1302.B YY
1303is the (hexadecimal) address of the MSTAR ISP port (address 0x49 is usually used).
1304Example that uses I2C controller /dev/i2c-1 and address 0x49:
1305.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001306.B " flashprog \-p mstarddc_spi:dev=/dev/i2c-1:49
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001307.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001308It is also possible to inhibit the reset command that is normally sent to the display once the flashprog
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001309operation is completed using the optional
1310.B noreset
Nico Huberc3b02dc2023-08-12 01:13:45 +02001311parameter. A value of 1 prevents flashprog from sending the reset command.
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001312Example that does not reset the display at the end of the operation:
1313.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001314.B " flashprog \-p mstarddc_spi:dev=/dev/i2c-1:49,noreset=1
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001315.sp
Stefan Tauner0be072c2016-03-13 15:16:30 +00001316Please note that sending the reset command is also inhibited if an error occurred during the operation.
Nico Huberc3b02dc2023-08-12 01:13:45 +02001317To send the reset command afterwards, you can simply run flashprog once more, in chip probe mode (not specifying
Alexandre Boeglin80e64712014-12-20 20:25:19 +00001318an operation), without the
1319.B noreset
1320parameter, once the flash read/write operation you intended to perform has completed successfully.
1321.sp
1322Please also note that the mstarddc_spi driver only works on Linux.
Urja Rannikko0870b022016-01-31 22:10:29 +00001323.SS
1324.BR "ch341a_spi " programmer
1325The WCH CH341A programmer does not support any parameters currently. SPI frequency is fixed at 2 MHz, and CS0 is
1326used as per the device.
Lubomir Rintelb2154e82018-01-14 17:35:33 +01001327.SS
Nicholas Chin197b7c72022-10-23 13:10:31 -06001328.BR "ch347_spi " programmer
Nico Huberc32e9542023-02-21 00:46:37 +00001329.IP
1330The driver is currently hard-coded to use
1331.BR CS0 .
1332An optional
1333.B spispeed
1334parameter specifies the frequency of the SPI bus.
1335Syntax is
1336.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001337.B " flashprog \-p ch347_spi:spispeed=frequency"
Nico Huberc32e9542023-02-21 00:46:37 +00001338.sp
1339where
1340.B frequency
1341is given in
1342.B kHz
1343and can be in the range 468 .. 60000. The frequency will be rounded down to
1344a supported value (60 MHz divided by a power of 2). The default is a frequency
1345of 7.5 MHz.
Nicholas Chindac42392024-07-30 20:01:59 -06001346The SPI mode can also be set using the spimode parameter:
1347.sp
1348.B " flashprog \-p ch347_spi:spimode=mode"
1349.sp
1350where
1351.B mode
1352is in the range 0 to 3. The default is mode 0.
Nicholas Chin197b7c72022-10-23 13:10:31 -06001353.SS
Miklós Márton2d20d6d2018-01-30 20:20:15 +01001354.BR "ni845x_spi " programmer
1355.IP
1356An optional
1357.B voltage
1358parameter could be used to specify the IO voltage. This parameter is available for the NI USB-8452 device.
1359The default unit is Volt if no unit is specified. You can use
1360.BR mV ", " milliVolt ", " V " or " Volt
1361as unit specifier.
1362Syntax is
1363.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001364.B " flashprog \-p ni845x_spi:voltage=value"
Miklós Márton2d20d6d2018-01-30 20:20:15 +01001365.sp
1366where
1367.B value
1368can be
1369.BR 1.2V ", " 1.5V ", " 1.8V ", " 2.5V ", " 3.3V
1370or the equivalent in mV.
1371.sp
1372In the case if none of the programmer's supported IO voltage is within the supported voltage range of
Nico Huberc3b02dc2023-08-12 01:13:45 +02001373the detected flash chip the flashprog will abort the operation (to prevent damaging the flash chip).
Miklós Márton2d20d6d2018-01-30 20:20:15 +01001374You can override this behaviour by passing "yes" to the
1375.B ignore_io_voltage_limits
1376parameter (for e.g. if you are using an external voltage translator circuit).
1377Syntax is
1378.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001379.B " flashprog \-p ni845x_spi:ignore_io_voltage_limits=yes"
Miklós Márton2d20d6d2018-01-30 20:20:15 +01001380.sp
1381You can use the
1382.B serial
1383parameter to explicitly specify which connected NI USB-845x device should be used.
1384You should use your device's 7 digit hexadecimal serial number.
1385Usage example to select the device with 1230A12 serial number:
1386.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001387.B " flashprog \-p ni845x_spi:serial=1230A12"
Miklós Márton2d20d6d2018-01-30 20:20:15 +01001388.sp
1389An optional
1390.B spispeed
1391parameter specifies the frequency of the SPI bus.
1392Syntax is
1393.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001394.B " flashprog \-p ni845x_spi:spispeed=frequency"
Miklós Márton2d20d6d2018-01-30 20:20:15 +01001395.sp
1396where
1397.B frequency
1398should a number corresponding to the desired frequency in kHz.
1399The maximum
1400.B frequency
1401is 12 MHz (12000 kHz) for the USB-8451 and 50 MHz (50000 kHz) for the USB-8452.
1402The default is a frequency of 1 MHz (1000 kHz).
1403.sp
1404An optional
1405.B cs
1406parameter specifies which target chip select line should be used. Syntax is
1407.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001408.B " flashprog \-p ni845x_spi:csnumber=value"
Miklós Márton2d20d6d2018-01-30 20:20:15 +01001409.sp
1410where
1411.B value
1412should be between
1413.BR 0 " and " 7
1414By default the CS0 is used.
1415.SS
Lubomir Rintelb2154e82018-01-14 17:35:33 +01001416.BR "digilent_spi " programmer
1417.IP
1418An optional
1419.B spispeed
1420parameter specifies the frequency of the SPI bus.
1421Syntax is
1422.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001423.B " flashprog \-p digilent_spi:spispeed=frequency"
Lubomir Rintelb2154e82018-01-14 17:35:33 +01001424.sp
1425where
1426.B frequency
1427can be
1428.BR 62.5k ", " 125k ", " 250k ", " 500k ", " 1M ", " 2M " or " 4M
1429(in Hz). The default is a frequency of 4 MHz.
Nico Huber5d6cc5d2023-02-24 18:20:26 +01001430.SS
Jean THOMASe28d8e42022-10-11 17:54:30 +02001431.BR "dirtyjtag_spi " programmer
1432.IP
1433An optional
Nico Huber5d6cc5d2023-02-24 18:20:26 +01001434.B spispeed
Jean THOMASe28d8e42022-10-11 17:54:30 +02001435parameter specifies the frequency of the SPI bus.
1436Syntax is
1437.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001438.B " flashprog \-p dirtyjtag_spi:spispeed=frequency"
Jean THOMASe28d8e42022-10-11 17:54:30 +02001439.sp
1440where
Nico Huber5d6cc5d2023-02-24 18:20:26 +01001441.B frequency
1442can be any value in hertz, kilohertz or megahertz supported by the programmer.
1443The default is a frequency of 100 kHz.
Lubomir Rintelb2154e82018-01-14 17:35:33 +01001444.SS
Marc Schink3578ec62016-03-17 16:23:03 +01001445.BR "jlink_spi " programmer
1446.IP
1447This module supports SEGGER J-Link and compatible devices.
1448
1449The \fBMOSI\fP signal of the flash chip must be attached to \fBTDI\fP pin of
1450the programmer, \fBMISO\fP to \fBTDO\fP and \fBSCK\fP to \fBTCK\fP.
1451The chip select (\fBCS\fP) signal of the flash chip can be attached to
1452different pins of the programmer which can be selected with the
1453.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001454.B " flashprog \-p jlink_spi:cs=pin"
Marc Schink3578ec62016-03-17 16:23:03 +01001455.sp
1456syntax where \fBpin\fP can be either \fBTRST\fP or \fBRESET\fP.
1457The default pin for chip select is \fBRESET\fP.
1458Note that, when using \fBRESET\fP, it is normal that the indicator LED blinks
1459orange or red.
1460.br
1461Additionally, the \fBVTref\fP pin of the programmer must be attached to the
1462logic level of the flash chip.
1463The programmer measures the voltage on this pin and generates the reference
1464voltage for its input comparators and adapts its output voltages to it.
1465.sp
1466Pinout for devices with 20-pin JTAG connector:
1467.sp
1468 +-------+
1469 | 1 2 | 1: VTref 2:
1470 | 3 4 | 3: TRST 4: GND
1471 | 5 6 | 5: TDI 6: GND
1472 +-+ 7 8 | 7: 8: GND
1473 | 9 10 | 9: TCK 10: GND
1474 | 11 12 | 11: 12: GND
1475 +-+ 13 14 | 13: TDO 14:
1476 | 15 16 | 15: RESET 16:
1477 | 17 18 | 17: 18:
1478 | 19 20 | 19: PWR_5V 20:
1479 +-------+
1480.sp
1481If there is more than one compatible device connected, you can select which one
1482should be used by specifying its serial number with the
1483.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001484.B " flashprog \-p jlink_spi:serial=number"
Marc Schink3578ec62016-03-17 16:23:03 +01001485.sp
1486syntax where
1487.B number
1488is the serial number of the device (which can be found for example in the
1489output of lsusb -v).
1490.sp
1491The SPI speed can be selected by using the
1492.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001493.B " flashprog \-p jlink_spi:spispeed=frequency"
Marc Schink3578ec62016-03-17 16:23:03 +01001494.sp
1495syntax where \fBfrequency\fP is the SPI clock frequency in kHz.
1496The maximum speed depends on the device in use.
Marc Schink137f02f2020-08-23 16:19:44 +02001497.sp
1498The \fBpower=on\fP option can be used to activate the 5 V power supply (PWR_5V)
1499of the J-Link during a flash operation.
Marc Schink3578ec62016-03-17 16:23:03 +01001500.SS
Miklós Márton324929c2019-08-01 19:14:10 +02001501.BR "stlinkv3_spi " programmer
1502.IP
1503This module supports SPI flash programming through the STMicroelectronics
1504STLINK V3 programmer/debugger's SPI bridge interface
1505.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001506.B " flashprog \-p stlinkv3_spi"
Miklós Márton324929c2019-08-01 19:14:10 +02001507.sp
1508If there is more than one compatible device connected, you can select which one
1509should be used by specifying its serial number with the
1510.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001511.B " flashprog \-p stlinkv3_spi:serial=number"
Miklós Márton324929c2019-08-01 19:14:10 +02001512.sp
1513syntax where
1514.B number
1515is the serial number of the device (which can be found for example in the
1516output of lsusb -v).
1517.sp
1518The SPI speed can be selected by using the
1519.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001520.B " flashprog \-p stlinkv3_spi:spispeed=frequency"
Miklós Márton324929c2019-08-01 19:14:10 +02001521.sp
1522syntax where \fBfrequency\fP is the SPI clock frequency in kHz.
1523If the passed frequency is not supported by the adapter the nearest lower
1524supported frequency will be used.
1525.SS
Marc Schink3578ec62016-03-17 16:23:03 +01001526
Carl-Daniel Hailfinger0b9af362012-07-21 16:56:04 +00001527.SH EXAMPLES
1528To back up and update your BIOS, run
1529.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001530.B flashprog -p internal -r backup.rom -o backuplog.txt
Carl-Daniel Hailfinger0b9af362012-07-21 16:56:04 +00001531.br
Nico Huberc3b02dc2023-08-12 01:13:45 +02001532.B flashprog -p internal -w newbios.rom -o writelog.txt
Carl-Daniel Hailfinger0b9af362012-07-21 16:56:04 +00001533.sp
1534Please make sure to copy backup.rom to some external media before you try
1535to write. That makes offline recovery easier.
1536.br
Nico Huberc3b02dc2023-08-12 01:13:45 +02001537If writing fails and flashprog complains about the chip being in an unknown
Carl-Daniel Hailfinger0b9af362012-07-21 16:56:04 +00001538state, you can try to restore the backup by running
1539.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001540.B flashprog -p internal -w backup.rom -o restorelog.txt
Carl-Daniel Hailfinger0b9af362012-07-21 16:56:04 +00001541.sp
1542If you encounter any problems, please contact us and supply
1543backuplog.txt, writelog.txt and restorelog.txt. See section
1544.B BUGS
1545for contact info.
Peter Stuge42688e52009-01-26 02:20:56 +00001546.SH EXIT STATUS
Nico Huberc3b02dc2023-08-12 01:13:45 +02001547flashprog exits with 0 on success, 1 on most failures but with 3 if a call to mmap() fails.
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001548.SH REQUIREMENTS
Nico Huberc3b02dc2023-08-12 01:13:45 +02001549flashprog needs different access permissions for different programmers.
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001550.sp
1551.B internal
1552needs raw memory access, PCI configuration space access, raw I/O port
1553access (x86) and MSR access (x86).
1554.sp
Jonathan Kollasch7f0f3fa2014-06-01 10:26:23 +00001555.B atavia
1556needs PCI configuration space access.
1557.sp
Sergey Lichack98f47102012-08-27 01:24:15 +00001558.BR nic3com ", " nicrealtek " and " nicnatsemi "
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001559need PCI configuration space read access and raw I/O port access.
1560.sp
1561.B atahpt
1562needs PCI configuration space access and raw I/O port access.
1563.sp
Kyösti Mälkki72d42f82014-06-01 23:48:31 +00001564.BR gfxnvidia ", " drkaiser " and " it8212
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001565need PCI configuration space access and raw memory access.
1566.sp
Carl-Daniel Hailfingere7fdd6e2010-07-21 10:26:01 +00001567.B rayer_spi
1568needs raw I/O port access.
1569.sp
Ricardo Ribalda Delgado2a41f0a2014-07-28 20:35:21 +00001570.BR satasii ", " nicintel ", " nicintel_eeprom " and " nicintel_spi
1571need PCI configuration space read access and raw memory access.
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001572.sp
Joseph C. Lehnerc2644a32016-01-16 23:45:25 +00001573.BR satamv " and " atapromise
1574need PCI configuration space read access, raw I/O port access and raw memory
Carl-Daniel Hailfinger9321f062011-07-24 18:41:13 +00001575access.
1576.sp
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001577.B serprog
1578needs TCP access to the network or userspace access to a serial port.
1579.sp
1580.B buspirate_spi
1581needs userspace access to a serial port.
1582.sp
Nico Huberd99a2bd2016-02-18 21:42:49 +00001583.BR ft2232_spi ", " usbblaster_spi " and " pickit2_spi
Stefan Taunere49edbb2016-01-31 22:10:14 +00001584need access to the respective USB device via libusb API version 0.1.
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001585.sp
Nico Huberd99a2bd2016-02-18 21:42:49 +00001586.BR ch341a_spi " and " dediprog
1587need access to the respective USB device via libusb API version 1.0.
Urja Rannikko0870b022016-01-31 22:10:29 +00001588.sp
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001589.B dummy
1590needs no access permissions at all.
1591.sp
Sergey Lichack98f47102012-08-27 01:24:15 +00001592.BR internal ", " nic3com ", " nicrealtek ", " nicnatsemi ", "
Joseph C. Lehnerc2644a32016-01-16 23:45:25 +00001593.BR gfxnvidia ", " drkaiser ", " satasii ", " satamv ", " atahpt ", " atavia " and " atapromise
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001594have to be run as superuser/root, and need additional raw access permission.
1595.sp
Lubomir Rintelb2154e82018-01-14 17:35:33 +01001596.BR serprog ", " buspirate_spi ", " dediprog ", " usbblaster_spi ", " ft2232_spi ", " pickit2_spi ", " \
Jean THOMASe28d8e42022-10-11 17:54:30 +02001597ch341a_spi ", " digilent_spi " and " dirtyjtag_spi
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001598can be run as normal user on most operating systems if appropriate device
1599permissions are set.
1600.sp
Mark Marshall90021f22010-12-03 14:48:11 +00001601.B ogp
1602needs PCI configuration space read access and raw memory access.
1603.sp
Carl-Daniel Hailfingerb63b0672010-07-02 17:12:50 +00001604On OpenBSD, you can obtain raw access permission by setting
Uwe Hermann941a2732011-07-25 21:12:57 +00001605.B "securelevel=-1"
1606in
1607.B "/etc/rc.securelevel"
1608and rebooting, or rebooting into single user mode.
Stefan Reinauer261144c2006-07-27 23:29:02 +00001609.SH BUGS
Angel Pons1900e1d2021-07-02 12:42:23 +02001610You can report bugs, ask us questions or send success reports
1611via our communication channels listed here:
Nico Huberc3b02dc2023-08-12 01:13:45 +02001612.URLB "https://www.flashprog.org/Contact" "" .
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001613.sp
Angel Pons1900e1d2021-07-02 12:42:23 +02001614Also, we provide a
Stefan Tauner4c723152016-01-14 22:47:55 +00001615.URLB https://paste.flashrom.org "pastebin service"
Angel Pons1900e1d2021-07-02 12:42:23 +02001616that is very useful to share logs without spamming the communication channels.
Stefan Tauner9e9f6842012-02-16 20:55:27 +00001617.SS
1618.B Laptops
1619.sp
Nico Huberc3b02dc2023-08-12 01:13:45 +02001620Using flashprog on older laptops is dangerous and may easily make your hardware
1621unusable. flashprog will attempt to detect if it is running on a susceptible
Nico Huber2e50cdc2018-09-23 20:20:26 +02001622laptop and restrict flash-chip probing for safety reasons. Please see the
Nico Huberc3b02dc2023-08-12 01:13:45 +02001623detailed discussion of this topic and associated flashprog options in the
Stefan Tauner9e9f6842012-02-16 20:55:27 +00001624.B Laptops
1625paragraph in the
1626.B internal programmer
1627subsection of the
Stefan Tauner6697f712014-08-06 15:09:15 +00001628.B PROGRAMMER-SPECIFIC INFORMATION
Stefan Tauner4c723152016-01-14 22:47:55 +00001629section and the information
Nico Huberc3b02dc2023-08-12 01:13:45 +02001630.URLB "https://flashprog.org/Laptops" "in our wiki" .
Daniel Lenski65922a32012-02-15 23:40:23 +00001631.SS
1632One-time programmable (OTP) memory and unique IDs
1633.sp
1634Some flash chips contain OTP memory often denoted as "security registers".
1635They usually have a capacity in the range of some bytes to a few hundred
Nico Huberc3b02dc2023-08-12 01:13:45 +02001636bytes and can be used to give devices unique IDs etc. flashprog is not able
Daniel Lenski65922a32012-02-15 23:40:23 +00001637to read or write these memories and may therefore not be able to duplicate a
1638chip completely. For chip types known to include OTP memories a warning is
1639printed when they are detected.
1640.sp
1641Similar to OTP memories are unique, factory programmed, unforgeable IDs.
1642They are not modifiable by the user at all.
Stefan Taunerac54fbe2011-07-21 19:52:00 +00001643.SH LICENSE
Nico Huberc3b02dc2023-08-12 01:13:45 +02001644.B flashprog
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001645is covered by the GNU General Public License (GPL), version 2. Some files are
Stefan Tauner23e10b82016-01-23 16:16:49 +00001646additionally available under any later version of the GPL.
Stefan Reinauer261144c2006-07-27 23:29:02 +00001647.SH COPYRIGHT
Stefan Reinauer261144c2006-07-27 23:29:02 +00001648.br
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001649Please see the individual files.
Stefan Reinauer261144c2006-07-27 23:29:02 +00001650.SH AUTHORS
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001651Andrew Morgan
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001652.br
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001653Carl-Daniel Hailfinger
1654.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001655Claus Gindhart
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001656.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001657David Borg
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001658.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001659David Hendricks
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001660.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001661Dominik Geyer
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001662.br
Edward O'Callaghan0cd11d82019-09-23 22:46:12 +10001663Edward O'Callaghan
1664.br
Stefan Reinaueredc61882010-01-03 14:40:30 +00001665Eric Biederman
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001666.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001667Giampiero Giancipoli
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001668.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001669Helge Wagner
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001670.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001671Idwer Vollering
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001672.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001673Joe Bao
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001674.br
Stefan Taunerc0aaf952011-05-19 02:58:17 +00001675Joerg Fischer
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001676.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001677Joshua Roys
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001678.br
Stefan Tauner5c316f92015-02-08 21:57:52 +00001679Ky\[:o]sti M\[:a]lkki
1680.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001681Luc Verhaegen
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001682.br
Carl-Daniel Hailfinger451dc802009-05-01 11:00:39 +00001683Li-Ta Lo
1684.br
Mark Marshall90021f22010-12-03 14:48:11 +00001685Mark Marshall
1686.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001687Markus Boas
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001688.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001689Mattias Mattsson
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001690.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001691Michael Karcher
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +00001692.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001693Nikolay Petukhov
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001694.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001695Patrick Georgi
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001696.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001697Peter Lemenkov
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001698.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001699Peter Stuge
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001700.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001701Reinder E.N. de Haan
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001702.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001703Ronald G. Minnich
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001704.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001705Ronald Hoogenboom
Stefan Reinauer261144c2006-07-27 23:29:02 +00001706.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001707Sean Nelson
Carl-Daniel Hailfinger8841d3e2010-05-15 15:04:37 +00001708.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001709Stefan Reinauer
Stefan Reinauer261144c2006-07-27 23:29:02 +00001710.br
Uwe Hermann68b9cca2011-06-15 23:44:52 +00001711Stefan Tauner
1712.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001713Stefan Wildemann
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001714.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001715Stephan Guilloux
Carl-Daniel Hailfinger3e854422010-10-06 23:03:21 +00001716.br
Steve Markgraf61899472023-01-09 23:06:52 +01001717Steve Markgraf
1718.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001719Steven James
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001720.br
Stefan Tauner23e10b82016-01-23 16:16:49 +00001721Urja Rannikko
1722.br
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001723Uwe Hermann
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001724.br
Stefan Reinaueredc61882010-01-03 14:40:30 +00001725Wang Qingpei
Carl-Daniel Hailfinger851ecf22009-01-08 04:56:59 +00001726.br
Stefan Reinaueredc61882010-01-03 14:40:30 +00001727Yinghai Lu
Stefan Reinauerf8337dd2006-08-03 10:49:09 +00001728.br
Nico Huberc3b02dc2023-08-12 01:13:45 +02001729some others, please see the flashprog git history for details.
Carl-Daniel Hailfingeref697832010-10-07 22:21:45 +00001730.br
Nico Huberac90af62022-12-18 00:22:47 +00001731Active maintainers can be reached via
Nico Huberc3b02dc2023-08-12 01:13:45 +02001732.MTOB "flashprog@flashprog.org" "the mailing list" .
Stefan Reinauer261144c2006-07-27 23:29:02 +00001733.PP
Stefan Tauner4c723152016-01-14 22:47:55 +00001734This manual page was written by
1735.MTOB "uwe@hermann-uwe.de" "Uwe Hermann" ,
1736Carl-Daniel Hailfinger, Stefan Tauner and others.
Uwe Hermann42eb17f2008-01-18 17:48:51 +00001737It is licensed under the terms of the GNU GPL (version 2 or later).