Hi,
I dont think you can use losetup to create a mtd device. loop devices
are regular block devices. This will only work if littlefs can mount a
block device (no idea if thats possible)
what you need is an adaptation layer that will implement a mtd device on
an eeprom.
You can duplicate a spi flash driver, and change its read/erase/write
routines (and initialization) by copying code from a spi eeprom driver.
Sebastien.
Le 14/12/2023 à 19:13, Tim Hardisty a écrit :
Question first, then explanation.
How do I use losetup (which is what I think I need) with a character
memory device and mount an FS on it? SPI EEPROM and LittleFS
specifically.
Yes, it's a bad idea, probably, but I just want to have a play and
lack of NuttX/POSIX/Linux knowledge has bitten my behind again. This
is perhaps the 3rd time over the years I've asked but even checking
the dev emails archive and I can't find what I need.
SPI EEPROM is correctly registered as /dev/at25 and I can
read/write/etc to it as a character device. NB: it does not initialize
in the same way as an I2C EEPROM so you can't directly initialise it
as an mtd. It is for storage of settings, and some of the values may
change 10,000's time over the life of the product, hence EEPROM with
1,000,000+ write cycles.
But there is then no wear levelling or anything like that as just a
character device, so I thought I'd have a play, and LittleFS has a
small minimum sector size and *might* work. A quick Google turns up
the same Linux-related losetup examples that don't seem relevant; my
Googling skills are probably as bad as those of my software
engineering <grin><rolleyes>.
Any pointers/suggestions please?