Skip to main content
Topic: Adding Bus Pirate support to flashrom? (Read 62481 times) previous topic - next topic

Re: Adding Bus Pirate support to flashrom?

Reply #15
SPI configuration initialization was incomplete, but audiohacked thankfully added that and we may get this committed soon.
If you have any flashrom problems, please mail flashrom@flashrom.org and include "Bus Pirate" in the subject line. As an alternative, you can send me a private message.
It is recommended to use at least flashrom 0.9.2 or later, and latest flashrom from svn if you want a 3x speedup.

Re: Adding Bus Pirate support to flashrom?

Reply #16
Great work! Keep me updated, I might have an extra Bus Pirate in a few days that I can send you for testing when you've got things going.
Got a question? Please ask in the forum for the fastest answers.

Re: Adding Bus Pirate support to flashrom?

Reply #17
I have posted a few flashrom infrastructure patches to make sure Bus Pirate support doesn't have any unwanted dependencies. Depending on reviews of those patches, Bus Pirate support may be committed this weekend.

Right now lots of stuff (speed, settings) is hardcoded, but the infrastructure to make that confgurable is already present.

Chip write is using the generic write function (on-the-wire overhead factor 5), not the fastest possible variant (on-the-wire overhead factor 1.344) because the generic function demands less of the programmer. Once we are sure everything works, fast write support is a matter of ~20 LOC. Fast read is already implemented (overhead factor 1.5), and changing it to maximum efficiency (overhead factor 1.344) is just a matter of testing 16-byte transfer reliability and changing a single integer constant.

If we get transaction support in the Bus Pirate, we can reduce read/write overhead to a factor of 1.0156 for the majority of the supported chips (some don't support low overhead writing).

I'll report back once this is committed or once we have the first successful identify/read/write (whichever happens first).
If you have any flashrom problems, please mail flashrom@flashrom.org and include "Bus Pirate" in the subject line. As an alternative, you can send me a private message.
It is recommended to use at least flashrom 0.9.2 or later, and latest flashrom from svn if you want a 3x speedup.

Re: Adding Bus Pirate support to flashrom?

Reply #18
Bus Pirate support was committed to flashrom in revision 772. Patch tracker entry: http://patchwork.coreboot.org/patch/584/

Thanks go to audiohacked for providing the SPI mode configuration (speed, polarity, ...) code and for testing flashrom.

AFAICS it should be possible to use flashrom with a Bus Pirate on all of Linux/*BSD/MacOSX.
If you have any flashrom problems, please mail flashrom@flashrom.org and include "Bus Pirate" in the subject line. As an alternative, you can send me a private message.
It is recommended to use at least flashrom 0.9.2 or later, and latest flashrom from svn if you want a 3x speedup.

Re: Adding Bus Pirate support to flashrom?

Reply #19
I should add that SPI speed is hardcoded to 8 MHz right now and that Bus Pirate support is not yet mentioned in the man page.

Usage hasn't changed since I last mentioned it, but here it is again:
Code: [Select]
flashrom -p buspiratespi:dev=/dev/ttyUSB0 -V
Replace /dev/ttyUSB0 with the device node of your Bus Pirate.
-V means verbose output, very useful to debug if something goes wrong.

For read/write/erase commands please consult the flashrom man page.
If you have any flashrom problems, please mail flashrom@flashrom.org and include "Bus Pirate" in the subject line. As an alternative, you can send me a private message.
It is recommended to use at least flashrom 0.9.2 or later, and latest flashrom from svn if you want a 3x speedup.

Re: Adding Bus Pirate support to flashrom?

Reply #20
A patch has been posted to speed up reading to maximum efficiency possible without transaction mode, and Bus Pirate SPI speed is now selectable on the command line.
Code: [Select]
flashrom -p buspiratespi:spispeed=2.6MHz,dev=/dev/ttyUSB0
The man page is explaining Bus Pirate support as well.

The current flashrom tree already supports all actions (probe/read/erase/write) on a Bus Pirate and the patch mentioned above is mainly cosmetic.

This project is completed.
If you have any flashrom problems, please mail flashrom@flashrom.org and include "Bus Pirate" in the subject line. As an alternative, you can send me a private message.
It is recommended to use at least flashrom 0.9.2 or later, and latest flashrom from svn if you want a 3x speedup.

Re: Adding Bus Pirate support to flashrom?

Reply #21
Wow, awesome job. Congratulations, I'll email you about an address for the bounty.
Got a question? Please ask in the forum for the fastest answers.

Re: Adding Bus Pirate support to flashrom?

Reply #22
Final flashrom patch committed in revision 776.

If anyone is using flashrom with the Bus Pirate, please give me a shout about whether it works for you on Linux/*BSD/MacOSX/Solaris.
By the way, I heard rumors someone wants to work on flashrom + Bus Pirate support for Windows (needs some serial code changes in flashrom). No detailed info so far.

Ian, thank you for the bounty!
If you have any flashrom problems, please mail flashrom@flashrom.org and include "Bus Pirate" in the subject line. As an alternative, you can send me a private message.
It is recommended to use at least flashrom 0.9.2 or later, and latest flashrom from svn if you want a 3x speedup.

Re: Adding Bus Pirate support to flashrom?

Reply #23
Thanks for the blog entry, Ian!

We plan to package a release (0.9.2) of flashrom version with Bus Pirate support before Christmas and will of course advertise this big new feature. In the past it was difficult to do SPI flashing with a cheap programmer, but now I'm happy to tell people to use the Bus Pirate.
If you have any flashrom problems, please mail flashrom@flashrom.org and include "Bus Pirate" in the subject line. As an alternative, you can send me a private message.
It is recommended to use at least flashrom 0.9.2 or later, and latest flashrom from svn if you want a 3x speedup.

Re: Adding Bus Pirate support to flashrom?

Reply #24
its a good thing as long as there is a windows version.  flashrom looks like a great project, but a majority of people running aroud with laptops use some form of windows.. not linux, or mac osx
until there is a new windows version of flashrom SPI flashing should not be removed or disabled from other projects..

Re: Adding Bus Pirate support to flashrom?

Reply #25
There's always the perl/python/window-c scripts you can use. I'm still in the process of internally redesigning the SPI interface in BusPirateGUI. And honestly I don't see much reason for BusPirateGUI to have any kind of explicit flashing support. Because I don't want to start a supported flashchip database for the BusPirateGUI, which would be recreating what flashrom already does for every Operating System except for Windows.

You're more than welcome to contribute a Windows port of flashrom, but I don't know how you are going to be able to support XP, Vista, and Windows 7; there are many other methods that you can use.

And SPI Flashing didn't even work in BusPirateGUI.

PS If you were talking about BusPirateGUI. Also there isn't an official version of flashrom for windows. Also, I don't do windows programming otherthan as a last thought, and because it's just a huge PITA.

Re: Adding Bus Pirate support to flashrom?

Reply #26
Whoa! Good job! This was definitely something I was looking for... Actually, I was trying to find my USB to UART programmer so I could start BIOS hacking on my EEEPC, but now it seems that I can use my BusPirate for it :D

Thanks again, BusPirate community!
Vote "Logic Ninja" or "Bit Ninja" for the DangerousPrototypes SUMP Logic Analyzer!

Re: Adding Bus Pirate support to flashrom?

Reply #27
[quote author="dvbguy"]
its a good thing as long as there is a windows version.  flashrom looks like a great project, but a majority of people running aroud with laptops use some form of windows.. not linux, or mac osx
until there is a new windows version of flashrom SPI flashing should not be removed or disabled from other projects..
[/quote]

Oh, there is a somewhat outdated patch for flashrom with Windows support created as a proof of concept hack, but the developer of that piece of code lost interest (he uses Mac OS X exclusively) and there was not even a single request for Windows support from any user in the last 12+ months.
Heck, the flashrom project got even a request for Haiku (BeOS clone) support in the last few weeks and that particular project may be finished before end of January 2010.

With zero users interested in flashrom for Windows and zero people willing to test, it is quite hard to do development (no feedback means developers will lose interest). This will of course change if someone is willing to test any Windows code. If you're really interested in compiling the code and testing it (together with maybe a dozen patch iterations), join the flashrom mailing list and tell the developers that you're willing to test with a Bus Pirate on Windows.

Side note: There are multiple Linux Live CDs with flashrom, so you can use flashrom with the Bus Pirate even if you don't have Windows installed.
If you have any flashrom problems, please mail flashrom@flashrom.org and include "Bus Pirate" in the subject line. As an alternative, you can send me a private message.
It is recommended to use at least flashrom 0.9.2 or later, and latest flashrom from svn if you want a 3x speedup.

Re: Adding Bus Pirate support to flashrom?

Reply #28
I'm currently working on a mingw (ie. win32) port of flashrom. USB, dummy are available, buspiratespi and serial are on my list - that would be flashrom with all supported external flashers, if I'm not mistaken - before I release.

Regards,
Patrick

Re: Adding Bus Pirate support to flashrom?

Reply #29
That's excellent. Please keep us updated, I'll do a post when you make your release.
Got a question? Please ask in the forum for the fastest answers.