1.. zephyr:code-sample:: eeprom
2   :name: EEPROM
3   :relevant-api: eeprom_interface
4
5   Store a boot count value in EEPROM.
6
7Overview
8********
9
10This sample demonstrates the :ref:`EEPROM driver API <eeprom_api>` in a simple boot counter
11application.
12
13Building and Running
14********************
15
16In case the target board has defined an EEPROM with alias ``eeprom-0`` the
17sample can be built without further ado. This applies for example to the
18:ref:`native_sim` board:
19
20.. zephyr-app-commands::
21   :zephyr-app: samples/drivers/eeprom
22   :host-os: unix
23   :board: native_sim
24   :goals: run
25   :compact:
26
27Otherwise either a board specific overlay needs to be defined, or a shield must
28be activated. Any board with Arduino headers can for example build the sample
29as follows:
30
31.. zephyr-app-commands::
32   :zephyr-app: samples/drivers/eeprom
33   :board: nrf52840dk/nrf52840
34   :goals: build
35   :shield: x_nucleo_eeprma2
36   :compact:
37
38For :zephyr:board:`gd32f450i_eval` board. First bridge the JP5 to USART with the jumper cap,
39Then the sample can be built and executed for the  as follows:
40
41.. zephyr-app-commands::
42   :zephyr-app: samples/drivers/eeprom
43   :board: gd32f450i_eval
44   :goals: build flash
45   :compact:
46
47Sample Output
48=============
49
50.. code-block:: console
51
52    Found EEPROM device "EEPROM_M24C02"
53    Using eeprom with size of: 256.
54    Device booted 7 times.
55    Reset the MCU to see the increasing boot counter.
56