zephyr/samples/drivers/flash_shell
Alberto Escolar Piedras cb53e40ff9 drivers uart_native_posix: rename to native_pty and support N instances
Rename the driver from uart_native_posix to uart_native_pty.
Including renaming the DTS compatible, and kconfig options, deprecating
the old ones.

And refactor the driver, generalizing it, so we can have any number of
instances.
Note that, unfortunately generalizing to N instances cannot be done
without a degree of backwards compatibility breakage: This driver was
born with all its configuration and selection of the instances based on
kconfig.
When the driver was made to use DT, it was done in a way that required
both DT and kconfig needing to manually coherently enable the 2nd UART.
This has now been fixed, which it means only DT is used to decide how
many instances are avaliable, and UART_NATIVE_POSIX_PORT_1_ENABLE is
just ignored.

Including:
* Deprecate UART_NATIVE_WAIT_PTS_READY_ENABLE: the options is always on
  now as it has no practical drawbacks.
* Deprecate UART_NATIVE_POSIX_PORT_1_ENABLE: DTS intanciation defines it
  being available now.
* Rename a few functions and in general shorten pseudo-tty/pseudo-
  terminal to PTY instead of PTTY.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-11 18:54:02 +01:00
..
boards
src
CMakeLists.txt
prj.conf
README.rst
sample.yaml
test_shell.yml

.. 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...|