The friendly Operating System for the Internet of Things
flashpage.h File Reference

Low-level flash page peripheral driver interface. More...

Detailed Description

This interface provides a very simple and straight forward way for writing a MCU's internal flash. This interface is only capable of reading, verifying, and writing complete flash pages, it has no support for partial flash access. This enables for very slim and efficient implementations.

A module for more fine-grained access of memory locations can easily be programmed on top of this interface.

Flash memory has only a limited amount of erase cycles (mostly around 10K times), so using this interface in some kind of loops can damage you MCU!
Hauke Petersen

Definition in file flashpage.h.

#include <stdint.h>
#include "periph_cpu.h"
+ Include dependency graph for flashpage.h:

Go to the source code of this file.


#define CPU_FLASH_BASE   (0)
 Per default, we expect the internal flash to start at address 0.


 Make sure the page size and the number of pages is defined. More...


static void * flashpage_addr (int page)
 Translate the given page number into the page's starting address. More...
static int flashpage_page (void *addr)
 Translate the given address into the corresponding page number. More...
void flashpage_write (int page, void *data)
 Write the given page with the given data. More...
void flashpage_read (int page, void *data)
 Read the given page into the given memory location. More...
int flashpage_verify (int page, void *data)
 Verify the given page against the given data. More...
int flashpage_write_and_verify (int page, void *data)
 Write the given page and verify the results. More...