ARMmbed / flashiap-driver

[experimental] Block device driver using the mbed OS FlashIAP API
Apache License 2.0
5 stars 3 forks source link

Confusing documentation #7

Open edablan opened 5 years ago

edablan commented 5 years ago

I am trying to see if it is possible to use an nRF52 board (actually a UBLOX NINA-B112) and its internal flash to store the BLE Keys for bonding on power reset. The documentation is a bit confusing/fuzzy. It states:

This driver should only be used on platforms where the FlashIAP implementation is using external flash or in conjunction with a filesystem with wear leveling, that can operate on a page size granularity.

First off, why does a platform require the FlashIAP implementation to use external flash? Doesn't this defeat the entire purpose of using In Application Programming to use the internal flash of the processor? I was under the impression from reading the documentation of FlashIAP, that it uses the internal flash to do reads and writes. So what does having external flash have anything to do with the FlashIAP?

Secondly, it states I need to use a filesystem with wear leveling that can operate on a page size granularity. I would need a FileSystem to mount the FlashIAPBLockDevice in order to use the internal security manager that is built in to store the BLE keys for you. If I used the LittleFileSystem wouldn't I get the wear leveling? Not sure about the page size granularity though.

My point is if I don't have external flash available on the NRF52, will I be able to use this FlashIAP driver with the LittleFileSystem in order to store bonded keys (to be used on resets) using the BLE Security Manager?

marcuschangarm commented 5 years ago

In application programming doesn't necessarily mean internal flash. We support platforms without internal flash where the application is stored on an external SPI flash.

For NRF52, using LittleFS would satisfy the wear leveling requirement. You would have to make it work with the security manager yourself. And be aware of the consequences of wearing down the internal flash on the NRF52.

edablan commented 5 years ago

@marcuschangarm

That's great I can use LittleFS. It seem's the security manager just needs a pointer to a file created from the file system. So as long as I create a FlashIAPBlockDevice, and mount it to the filesystem I can just pass the file pointer to the security manager using the init function provided. Should be straightforward.