How the OS handles internally the write operations to flash?

Hi.

Tipically, a flash memory is always accessed in blocks of N kbytes (for example 64Kbytes), this accesses include write/read/erase operations. According to this when it is necessary to modify 1 byte of a block the entire block must be read, the byte must be modified and then the entire block must be written again. This implies that write one byte spends one erasure cycle of the entire block.

Do both adl_flhWrite and adl_flhErase work in the way mentioned above? or do these functions can operate on a single byte??

Thanks in advance,

No, it doesn’t.

There are plenty of “wear levelling” schemes that avoid this.

Yes, they can operate on individual bytes.

The whole point of working through an API is that you don’t have to concern yourself with the implementation details.

You can get some hints from the description in the ADL User Guide - it speaks of garbage collection, and things being “considered” erased, even if the physical storage is not actually erased…