linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Binary Nandwrite/read to Flash
@ 2008-03-13 12:18 Manuel Sahm
  2008-03-13 12:47 ` Ricard Wanderlof
  0 siblings, 1 reply; 8+ messages in thread
From: Manuel Sahm @ 2008-03-13 12:18 UTC (permalink / raw)
  To: linux-mtd

Hello,

is it possible to write directly to nandflash, or to store a file in 
nand flash ?

Thank you

-- 
Best regards 

Manuel Sahm	

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Binary Nandwrite/read to Flash
  2008-03-13 12:18 Binary Nandwrite/read to Flash Manuel Sahm
@ 2008-03-13 12:47 ` Ricard Wanderlof
       [not found]   ` <47D92581.1030007@feig.de>
  2008-03-13 14:27   ` Matthieu CASTET
  0 siblings, 2 replies; 8+ messages in thread
From: Ricard Wanderlof @ 2008-03-13 12:47 UTC (permalink / raw)
  To: Manuel Sahm; +Cc: Linux mtd


On Thu, 13 Mar 2008, Manuel Sahm wrote:

> Hello,
>
> is it possible to write directly to nandflash, or to store a file in 
> nand flash ?

Yes, use the mtdtools applications nandwrite and nanddump in order to skip 
bad blocks during read and write. You'll need the pad option to nandwrite 
in order to fill out to an even multiple of the page size.

If you're writing a file, it really is raw byte by byte, with no 
indication of file size, access times etc, so to the extent you need that 
info you'll have to store it explicitly.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Binary Nandwrite/read to Flash
       [not found]   ` <47D92581.1030007@feig.de>
@ 2008-03-13 13:53     ` Ricard Wanderlof
  2008-03-13 14:22       ` Manuel Sahm
  0 siblings, 1 reply; 8+ messages in thread
From: Ricard Wanderlof @ 2008-03-13 13:53 UTC (permalink / raw)
  To: Manuel Sahm; +Cc: Linux mtd


On Thu, 13 Mar 2008, Manuel Sahm wrote:

> Thank you,
>
> could you tell me the exact call:
>
> I have a NAND-Flash with PAGESSIZE = 0x800 and ERASEBLOCKSIZE=0x20000
>
> I want to write a file maybe called "test.txt" at adress 0x02000000 of the 
> NAND flash.

Something like

nandwrite -s 0x02000000 -p /dev/mtd0 test.txt

(mtd0 depending on which device your nandflash is)

(Note: you don't have to specify the padding size, nandwrite figures it 
out by querying mtd).

> And read it back to a file "test2.txt" afterwards.

Something like

nanddump -o -b -s 0x02000000 -l <filesize> -f test2.txt /dev/mtd0

where <filesize> is the size of your file.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Binary Nandwrite/read to Flash
  2008-03-13 13:53     ` Ricard Wanderlof
@ 2008-03-13 14:22       ` Manuel Sahm
  2008-03-13 14:26         ` Ricard Wanderlof
  0 siblings, 1 reply; 8+ messages in thread
From: Manuel Sahm @ 2008-03-13 14:22 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: linux-mtd



Ricard Wanderlof schrieb:
>
> On Thu, 13 Mar 2008, Manuel Sahm wrote:
>
>> Thank you,
>>
>> could you tell me the exact call:
>>
>> I have a NAND-Flash with PAGESSIZE = 0x800 and ERASEBLOCKSIZE=0x20000
>>
>> I want to write a file maybe called "test.txt" at adress 0x02000000 
>> of the NAND flash.
>
> Something like
>
> nandwrite -s 0x02000000 -p /dev/mtd0 test.txt
>
> (mtd0 depending on which device your nandflash is)
>
> (Note: you don't have to specify the padding size, nandwrite figures 
> it out by querying mtd).
>
>> And read it back to a file "test2.txt" afterwards.
>
> Something like
>
> nanddump -o -b -s 0x02000000 -l <filesize> -f test2.txt /dev/mtd0
>
> where <filesize> is the size of your file.
>
> /Ricard
> -- 
> Ricard Wolf Wanderlöf                           ricardw(at)axis.com
> Axis Communications AB, Lund, Sweden            www.axis.com
> Phone +46 46 272 2016                           Fax +46 46 13 61 30
Thank you very much....

Is it possible to write/read to the NAND flash "directly" without an 
partition ?(/dev/mtdX) ?

Best regards 

Manuel Sahm	

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Binary Nandwrite/read to Flash
  2008-03-13 14:22       ` Manuel Sahm
@ 2008-03-13 14:26         ` Ricard Wanderlof
  2008-03-13 15:12           ` Manuel Sahm
  0 siblings, 1 reply; 8+ messages in thread
From: Ricard Wanderlof @ 2008-03-13 14:26 UTC (permalink / raw)
  To: Manuel Sahm; +Cc: linux-mtd


On Thu, 13 Mar 2008, Manuel Sahm wrote:

> Thank you very much....
>
> Is it possible to write/read to the NAND flash "directly" without an 
> partition ?(/dev/mtdX) ?

No, but you can set up a /dev/mtdX device to span the whole device, even 
if you then have additional /dev/mtdX devices which refer to partitions.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Binary Nandwrite/read to Flash
  2008-03-13 12:47 ` Ricard Wanderlof
       [not found]   ` <47D92581.1030007@feig.de>
@ 2008-03-13 14:27   ` Matthieu CASTET
  1 sibling, 0 replies; 8+ messages in thread
From: Matthieu CASTET @ 2008-03-13 14:27 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: Manuel Sahm, Linux mtd

Ricard Wanderlof wrote:
> On Thu, 13 Mar 2008, Manuel Sahm wrote:
> 
>> Hello,
>>
>> is it possible to write directly to nandflash, or to store a file in 
>> nand flash ?
> 
> Yes, use the mtdtools applications nandwrite and nanddump in order to skip 
> bad blocks during read and write. You'll need the pad option to nandwrite 
> in order to fill out to an even multiple of the page size.
> 
> If you're writing a file, it really is raw byte by byte, with no 
> indication of file size, access times etc, so to the extent you need that 
> info you'll have to store it explicitly.
> 
And if bits flip appear you've got a problem : you need to rewrite the file.


Matthieu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Binary Nandwrite/read to Flash
  2008-03-13 14:26         ` Ricard Wanderlof
@ 2008-03-13 15:12           ` Manuel Sahm
  2008-03-14  7:41             ` Ricard Wanderlof
  0 siblings, 1 reply; 8+ messages in thread
From: Manuel Sahm @ 2008-03-13 15:12 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: linux-mtd



Ricard Wanderlof schrieb:
>
> On Thu, 13 Mar 2008, Manuel Sahm wrote:
>
>> Thank you very much....
>>
>> Is it possible to write/read to the NAND flash "directly" without an 
>> partition ?(/dev/mtdX) ?
>
> No, but you can set up a /dev/mtdX device to span the whole device, 
> even if you then have additional /dev/mtdX devices which refer to 
> partitions.
>
> /Ricard
> -- 
> Ricard Wolf Wanderlöf                           ricardw(at)axis.com
> Axis Communications AB, Lund, Sweden            www.axis.com
> Phone +46 46 272 2016                           Fax +46 46 13 61 30
>
Thank you,

it´s very dangerous, because if I use the wrong address I´ll kill my 
system :-)

Is ther a possibility to make the /dev/mtdX read only (write protected) ?

Thank you


Best regards 

Manuel Sahm	

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Binary Nandwrite/read to Flash
  2008-03-13 15:12           ` Manuel Sahm
@ 2008-03-14  7:41             ` Ricard Wanderlof
  0 siblings, 0 replies; 8+ messages in thread
From: Ricard Wanderlof @ 2008-03-14  7:41 UTC (permalink / raw)
  To: Manuel Sahm; +Cc: linux-mtd


On Thu, 13 Mar 2008, Manuel Sahm wrote:

>>> Is it possible to write/read to the NAND flash "directly" without an 
>>> partition ?(/dev/mtdX) ?
>> 
>> No, but you can set up a /dev/mtdX device to span the whole device, even if 
>> you then have additional /dev/mtdX devices which refer to partitions.
>> 
> it´s very dangerous, because if I use the wrong address I´ll kill my system 
> :-)
>
> Is ther a possibility to make the /dev/mtdX read only (write protected) ?

Yes, in the driver that registers the flash with mtd you can specify that 
the partition should be read only. However, as far as I know [someone 
please correct me if I'm wrong] this can then not be changed while the 
system is running, so it's not possible to write or erase the partition 
without rebooting.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-03-14  7:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13 12:18 Binary Nandwrite/read to Flash Manuel Sahm
2008-03-13 12:47 ` Ricard Wanderlof
     [not found]   ` <47D92581.1030007@feig.de>
2008-03-13 13:53     ` Ricard Wanderlof
2008-03-13 14:22       ` Manuel Sahm
2008-03-13 14:26         ` Ricard Wanderlof
2008-03-13 15:12           ` Manuel Sahm
2008-03-14  7:41             ` Ricard Wanderlof
2008-03-13 14:27   ` Matthieu CASTET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).