1.. _samples_eeprom:
2
3EEPROM Sample
4#############
5
6Overview
7********
8
9This sample demonstrates the EEPROM driver API in a simple boot counter
10application.
11
12Building and Running
13********************
14
15In case the target board has defined an EEPROM with alias ``eeprom-0`` the
16sample can be built without further ado. This applies for example to the
17:ref:`native_posix` board:
18
19.. zephyr-app-commands::
20   :zephyr-app: samples/drivers/eeprom
21   :host-os: unix
22   :board: native_posix
23   :goals: run
24   :compact:
25
26Otherwise either a board specific overlay needs to be defined, or a shield must
27be activated. Any board with Arduino headers can for example build the sample
28as follows:
29
30.. zephyr-app-commands::
31   :zephyr-app: samples/drivers/eeprom
32   :board: nrf52840dk_nrf52840
33   :goals: build
34   :shield: x_nucleo_eeprma2
35   :compact:
36
37Sample Output
38=============
39
40.. code-block:: console
41
42    Found EEPROM device "EEPROM_M24C02"
43    Using eeprom with size of: 256.
44    Device booted 7 times.
45    Reset the MCU to see the inceasing boot counter.
46