littlefs icon indicating copy to clipboard operation
littlefs copied to clipboard

user_provided_block_device_<> functions are not self-explaining

Open Protonerd opened this issue 5 years ago • 5 comments

I just now started to implement littleFS on an Adafruit Feather BLE using a Nordic nRF52 chip. In the example I see a config filled out like this:

const struct lfs_config cfg = { .read = user_provided_block_device_read, .prog = user_provided_block_device_prog, .erase = user_provided_block_device_erase, .sync = user_provided_block_device_sync, …. and so forth.

Unfortunately I can't seem to find any reference as to what function calls to substitute the user_provided_block_device_<>'s. I tried with the functions like lfs_file_read etc. from the lfs.c but it does not work, gives me an error: "sorry, unimplemented: non-trivial designated initializers not supported"

I'm using Arduino IDE. Is there a better example explaining how to configure lfs?

Protonerd avatar Oct 09 '19 18:10 Protonerd

Look at the declaration for struct lfs_config in lfs.h, which is reasonably self-explanatory. There are also some more detailed explanations in the responses to some of the issues raised. Edit: See https://github.com/ARMmbed/littlefs/issues/1

e107steved avatar Oct 10 '19 08:10 e107steved

Obviously if searching the net up and down had delivered an answer I would not have asked. I red the linked issue but I got no wiser... can someone link in an example code for Arduino? Is the lib compatible with the compiler of Arduino at all?

Protonerd avatar Oct 10 '19 16:10 Protonerd

@Protonerd I think you will find the following link useful. Adafruit has added littlefs to its core library for the nRF52, which I understand from your post on the Arduino forum is the device you are using.

https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/develop/libraries

sslupsky avatar Oct 17 '19 18:10 sslupsky

Thanks a lo sslupsky, that one looks exactly like what I’ve been looking for. I will sure give it a try!!!

Protonerd avatar Oct 21 '19 08:10 Protonerd

@Protonerd I think you will find the following link useful. Adafruit has added littlefs to its core library for the nRF52, which I understand from your post on the Arduino forum is the device you are using.

https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/develop/libraries

@sslupsky link you provided on Oct 17, 2019 is no longer valid would you provide a replacement link?

rgeleta avatar Aug 09 '22 08:08 rgeleta