Circular buffer Implementation

I need to write an application to use mangOH red as a datalogger.

At beginning a fixed amount of memory is reserved.

Data is saved every 30s.

When memory is full, the oldest data will be overwritten with new data (circular buffer).
Data cannot be erased after power off.
Does Legato have available any API ( or sample code ) implementing a circular buffer?
Thanks

There is quite a lot of example for circular buffer example in internet.
E.g.

Thank you for information. What I really need is a circular buffer implementation for flash memory considering the maximum number of times each memory block can be written/erased and time optimization for these operations.
I know there are plenty of samples in the internet but I am just starting with Legato and I am finding the tutorials somehow confusing with information scattered in many places. It’s not that simple when you want to implement something a little more complex than the basic samples. Considering the importance of flash memory storage using circular buffers, does anyone have a simple sample code that could be shared for Legato?

do you mean the flash driver wear leveling algorithm?
Probably this is handled in BSP driver level but not in application level.

From Legato Reference Manual:

  • " WARNING: Because config data can be saved to flash storage, granting write access to a config tree can make it possible for the app to wear out your flash device. Granting an untrusted app write access to another app’s config settings creates a security hole, because it makes it possible for the untrusted app to interfere with the other app’s operation. It’s especially dangerous to grant write access to the system tree, because it’s possible to completely compromise the target device…"

I would like to know where can I find documentation related to flash memory direct access…
I would like to create a partition invisible to users and managed directly by my app to save configuration files and logger data that is not accessible to users. Is this possible?
Thanks.


"NOTE: Directories in the persistent (flash) file system are never made writeable because the on-target flash file system does not support usage quotas (yet) " .

How about setting the access right of your file to root user only?