6 years, 1 month ago.

About filesystem and writing own block driver

Hello,

I am trying to write my own block driver for parallel NOR flash device, but there is lack of documentation on how to make your own block device driver. Can someone give me a brief idea or example to write own block driver and implement on mbed FATfs?

1 Answer

6 years, 1 month ago.

Hi Binnie,

You're right our documentation on how to write your own block device driver is lacking. The best I can say right now is that we are currently working on this.

At the moment the best starting point is to extend the BlockDevice class and implement the abstract methods:
https://os.mbed.com/docs/v5.6/mbed-os-api-doxy/class_block_device.html#a376030c17aa25a665195fb82dbdb236b

You can also use the SPI NOR flash driver in Mbed OS as a starting point:
https://github.com/armmbed/spif-driver

Once you have a working block device, you should be able to plug it into the filesystem example to start using the filesystems inside Mbed OS:
https://github.com/armmbed/mbed-os-example-filesystem#changing-the-block-device