[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] How To Read/Write To Flash Device
On Mon, 2009-09-07 at 09:21 +1000, John Williams wrote:
> On Mon, Sep 7, 2009 at 8:20 AM, Torin Ford<torin@xxxxxxxxxxxx> wrote:
> > Hopefully a quick question here. I'm assuming that /dev/mtdblock[0-n]
> > are the partitions that are defined under "Flash Partition Table" and
> > are setup as READ ONLY devices. Does that then mean that /dev/mtd[0-n]
> > are the READ/WRITE devices for that same flash device?
> Not quite - /dev/mtdN are character device iunterfaces to the flash
> partitions, while mtdblockN are block device interfaces. So, if you
> want to mount a filesystem (other than JFFS2) on MTD, you use the
> block interface.
> > If this is true,
> > does anything special need to be done to correctly write to them? I did
> > a read, then a write, and then another read. What I wrote was not what
> > I read back on the second read, but it also wasn't what I read on the
> > first read. So it apparently changed the bits on the device, but not to
> > what I was looking for. btw, I believe the device I'm using is a
> > Spansion NOR chip.
> The simplest sequence to test is something like:
> $ eraseall /dev/mtdN
> $ cat /path/to/somefile > /dev/mtdD
> $ cat /dev/mtdN
> You can then confirm that the data were corectly written. Don't
> forget the eraseall command - you must clear the flash before you
> rewrite it.
Thanks for the response. I tried it out and it worked as expected.
I checked out the eraseall code and incorporated the ioctl call(s) into
my code to do the erase. That's what he problem was.
microblaze-uclinux mailing list
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/