[flashrom] flashrom support for read\write word\byte actions
c-d.hailfinger.devel.2006 at gmx.net
Sun Nov 9 16:50:12 CET 2014
On 09.11.2014 12:27, Peri, Chanan wrote:
> Do you know what does this "core" of flashrom include in terms of dediprog API for more specific operations (sector erase, read\write byte\word)?
Right now we use a common (to all programmers and all flash chips)
abstraction in flashrom which allows you to read/write/erase down to
arbitrary small sizes, but internally larger operations (usually
sector-based) happen. Think of it like the 512 Byte sector emulation of
4 kB hard drives. This is the abstraction we plan to make publicly
available as part of libflashrom.
There is also an internal common command submission engine which can
send arbitrary raw commands to a flash chip, one engine per flash bus
(SPI, FWH/LPC/Parallel). This engine is also common to all programmers
of the same flash bus type.
> Would it be reasonably possible for me (using the source code of flashrom) to add what I need, even if it's specific to dediprog or to some specific flash type?
I think it should be reasonably easy to do this generically (see spi25.c
for code which does SPI command submission), and there is no reason to
make this dediprog specific.
The suggested course of action also depends on whether you want a simple
"read some bytes, write some bytes, erase manually/automatically"
interface, or whether you want explicit SPI command submission and want
to handle all the nasty details (verifying write/erase, handling
programmer errors) yourself.
> -----Original Message-----
> From: Stefan Tauner [mailto:stefan.tauner at alumni.tuwien.ac.at]
> Sent: Sunday, November 09, 2014 11:48
> To: Peri, Chanan
> Cc: flashrom at flashrom.org
> Subject: Re: [flashrom] flashrom support for read\write word\byte actions
> currently there exist already some patches that allow to read and write single sectors with some preparation and the user interface is probably not what you want (I am talking about layout files that allow to define and operate on regions of flash space).
> The midterm plan is to make the core of flashrom more library-like, which would ease the creation of a special purpose tool like the one you probably require. Note that midterm in flashrom terms can mean some years since developer time has been rather scarce lately...
> All of that is pretty much programmer-agnostic because most of the time we specify exactly what is sent to the SPI (or other) bus.
More information about the flashrom