This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using pstorage for large, non-fixed size buffers

In my application I need to use the whole flash memory available (128 KB of the nRF51422 QFAC). My data is first stored on a 2KB buffer and once the buffer is full, data is compressed to another buffer and then saved to nvram. Depending on my data, compression might work very well of very poor (5 to 50% compression). I will know the size after compression, but then it won't be page aligned anymore and setting a small block-size would make me call the register command a lot.

Is this case, how can I register blocks so I don't lose any space on my flash?

Can I register the whole 128KB space for use and write on offsets? How page alignment applies in this context?

Thanks in advance

Parents
  • @Victor: QFAC is the 256kB flash chip variant. I think for your application where you dynamically register blocks, it's better to not using pstorage 's modules and blocks but access the flash in pstorage raw mode.

    If you use SDK v7.x and ealier there is raw APIs in the pstorage.c library. If you use SDK v8.x, the raw mode is remove from the default pstorage library, you have to use pstorage_raw.c located in the same folder as pstorage.c. You can refer to the dfu example to know how we used it.

    You would need to maintain a database to keep track of your compressed data blocks' size and their address.

Reply
  • @Victor: QFAC is the 256kB flash chip variant. I think for your application where you dynamically register blocks, it's better to not using pstorage 's modules and blocks but access the flash in pstorage raw mode.

    If you use SDK v7.x and ealier there is raw APIs in the pstorage.c library. If you use SDK v8.x, the raw mode is remove from the default pstorage library, you have to use pstorage_raw.c located in the same folder as pstorage.c. You can refer to the dfu example to know how we used it.

    You would need to maintain a database to keep track of your compressed data blocks' size and their address.

Children
Related