zephyr/samples/subsys/edac
Benjamin Cabé 9b8b7b36be doc: samples: edac: add syntax highlight to code blocks
display Zephyr shell snippets as "console" code blocks.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-10-18 15:51:22 +03:00
..
src samples, tests, boards: Switch main return type from void to int 2023-04-14 07:49:41 +09:00
CMakeLists.txt cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
prj.conf samples: edac: Add EDAC shell sample application 2021-01-21 08:34:07 -05:00
README.rst doc: samples: edac: add syntax highlight to code blocks 2023-10-18 15:51:22 +03:00
sample.yaml boards: x86: Add intel_ prefix to Elkhart Lake boards 2023-08-15 11:24:35 +00:00

.. zephyr:code-sample:: edac
   :name: EDAC shell
   :relevant-api: edac

   Test error detection and correction (EDAC) using shell commands.

Overview
********

This sample demonstrates the :ref:`EDAC driver API <edac_api>` in a simple EDAC shell sample.

Building and Running
********************

This sample can be found under :zephyr_file:`samples/subsys/edac` in the
Zephyr tree.
The sample can be built as follows for the :ref:`intel_ehl_crb` board:

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/edac
   :host-os: unix
   :board: intel_ehl_crb
   :goals: build
   :compact:

The Zephyr image that's created can be run on the :ref:`intel_ehl_crb` board
as per the instructions in the board documentation. Check out the
:ref:`intel_ehl_crb` for details.

Sample output
*************

Getting help
============

After the application has started help can be read with the following
command:

.. code-block:: console

   uart:~$ edac -h
   edac - EDAC information
   Subcommands:
     info    :Show EDAC information
              edac info <subcommands>
     inject  :Inject ECC error commands
              edac inject <subcommands>

Help for subcommand info can be read with:

.. code-block:: console

   uart:~$ edac info -h
   info - Show EDAC information
          edac info <subcommands>
   Subcommands:
     ecc_error     :ECC Error Show / Clear commands
     parity_error  :Parity Error Show / Clear commands

Injection help can be received with:

.. code-block:: console

   uart:~$ edac inject -h
   inject - Inject ECC error commands
            edac inject <subcommands>
   Subcommands:
     addr          :Get / Set physical address
     mask          :Get / Set address mask
     trigger       :Trigger injection
     error_type    :Get / Set injection error type
     disable_nmi   :Disable NMI
     enable_nmi    :Enable NMI
     test_default  :Test default injection parameters

Testing Error Injection
=======================

Set Error Injection parameters with:

.. code-block:: console

   uart:~$ edac inject addr 0x1000
   Set injection address base to: 0x1000

   uart:~$ edac inject mask 0x7fffffffc0
   Set injection address mask to 7fffffffc0

   uart:~$ edac inject error_type correctable
   Set injection error type: correctable

Trigger injection with:

.. code-block:: console

   uart:~$ edac inject trigger
   Triggering injection

Now Read / Write to the injection address to trigger Error Injection with
following devmem commands:

.. code-block:: console

   uart:~$ devmem 0x1000 32 0xabcd
   Mapped 0x1000 to 0x2ffcf000

   Using data width 32
   Writing value 0xabcd

   uart:~$ devmem 0x1000
   Mapped 0x1000 to 0x2ffce000

   Using data width 32
   Read value 0xabcd

We should get the following message on screen indicating an IBECC event:

.. code-block:: none

   Got notification about IBECC event