Skip to contentSkip to conversation

NOR flash writing

DISCUSSION Antony Pavlov 2 participants 2 messages Jul 28, 2014 – Jul 29, 2014

lore
Share & tools
lore
#0 lore raw

Hi All!

I have barebox running on a board with SPI flash chip.
I can write to the SPI flash chip using /dev/nor0 interface.
Before writing data to the /dev/nor0 device I have to erase it explicitly with 'erase /dev/nor0' command.

How I can write to /dev/nor0 in a more transparent way. E.g. if I want to update only several bytes on /dev/nor0 then I use 'mw -d /dev/nor0 ...' command and barebox automatically reads appropriate flash sector into RAM, modify it, erase NOR flash device sector and write new sector content into NOR flash device.

--
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw
Quoted 9 lines · Antony Pavlov

Hi All!

I have barebox running on a board with SPI flash chip.
I can write to the SPI flash chip using /dev/nor0 interface.
Before writing data to the /dev/nor0 device I have to erase it explicitly with 'erase /dev/nor0' command.

How I can write to /dev/nor0 in a more transparent way. E.g. if I want to update only several bytes on /dev/nor0 then I use 'mw -d /dev/nor0 ...' command and barebox automatically reads appropriate flash sector into RAM, modify it, erase NOR flash device sector and write new sector content into NOR flash device.

There's no convenient way for this, you have to do it manually:

- read a block to a file using memcpy
- modify it using mw
- erase flash block
- copy back using memcpy

I can't think up a good API to combine this into a single command. I mean for simple modifications some more intelligent read/modify/write command would work, but normally if you have more than one modification to do then you don't want to erase your flash with each modification.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox