zephyr/samples/drivers/flash_shell
Jeppe Odgaard f1ae151ef6 samples: flash_shell: remove sample code and use FLASH_SHELL
The flash sample and flash shell have implementations that differ
providing similar features.
This commit removes all the code in main.c, only `main()` remains to
reduce redundancy.

Features or improved implementations has not been merged into the flash
shell in this commit.
It should be possible to do in future commits if desired.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-10-20 15:01:17 +02:00
..
boards drivers: flash: Add Infineon CAT1 Flash driver 2023-05-08 11:16:09 +02:00
src samples: flash_shell: remove sample code and use FLASH_SHELL 2023-10-20 15:01:17 +02:00
CMakeLists.txt cmake: increase minimal required version to 3.20.0 2021-08-20 09:47:34 +02:00
prj.conf samples: flash_shell: remove sample code and use FLASH_SHELL 2023-10-20 15:01:17 +02:00
README.rst samples: flash_shell: remove sample code and use FLASH_SHELL 2023-10-20 15:01:17 +02:00
sample.yaml tests: cleanup metadata and filtering 2023-06-13 09:38:27 -04:00

.. zephyr:code-sample:: flash-shell
   :name: Flash shell
   :relevant-api: flash_interface

   Explore a flash device using shell commands.

Overview
********

This is a simple shell module that allows arbitrary boards with flash
driver support to explore the flash device.

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

This project can be built and executed on as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/flash_shell
   :host-os: unix
   :board: qemu_x86
   :goals: run
   :compact:

Sample Output
=============

.. code-block:: console

    uart:~$ flash page_info 0
    Page for address 0x0:
    start offset: 0x0
    size: 4096
    index: 0
    uart:~$ flash erase 0x1000
    Erase success.
    uart:~$ flash write 0x1000 0x12345678 0x9abcdef0
    Write OK.
    Verified.
    uart:~$ flash write 0x1000 0x11111111
    Write internal ERROR!
    uart:~$ flash read 0x1000 0x10
    00001000: 78 56 34 12 f0 de bc 9a  ff ff ff ff ff ff ff ff |xV4..... ........|

    uart:~$ flash write 0x101c 0xabcd1234
    Write OK.
    Verified.
    uart:~$ flash read 0x1000 0x20
    00001000: 78 56 34 12 f0 de bc 9a  ff ff ff ff ff ff ff ff |xV4..... ........|
    00001010: ff ff ff ff ff ff ff ff  ff ff ff ff 34 12 cd ab |........ ....4...|