Efficient Memory Use

Version 1
    Question: How to efficiently use RAM and Flash resources while writing data into flash?



    There are certain guidelines which should be followed while routing data into flash to maximize the efficiency of both Flash and RAM resources.

    Plenty of Flash - Efficient usage of RAM

    •   Write data in blocks of 64 bytes even if data to be stored is less.
    •   Always read data in with the correct byte amount.

    Efficient usage of Flash

    •   Always write exact amount of data.
    •   Always read exact amount of data.

    For e.g. if 20 bytes of data has to be written in flash and plenty of flash is available, then while writing these data bytes pass byte count as 64 but while reading read only 20 bytes of data.