Part 1
요약·해설
실제 native_sim build와 eeprom command/output 4개를 원문 그대로 제공합니다.
size · read
write · fill · verify
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
27B126F38BCA6D4CAEE802E7EB6C56D912DF90A27C275B87B5EC39E303409303
.. _eeprom_shell:
EEPROM Shell
############
.. contents::
:local:
:depth: 1
Overview
********
The EEPROM shell provides an ``eeprom`` command with a set of subcommands for the :ref:`shell
<shell_api>` module. It allows testing and exploring the :ref:`EEPROM <eeprom_api>` driver API
through an interactive interface without having to write a dedicated application. The EEPROM shell
can also be enabled in existing applications to aid in interactive debugging of EEPROM issues.
In order to enable the EEPROM shell, the following :ref:`Kconfig <kconfig>` options must be enabled:
* :kconfig:option:`CONFIG_SHELL`
* :kconfig:option:`CONFIG_EEPROM`
* :kconfig:option:`CONFIG_EEPROM_SHELL`
For example, building the :ref:`hello_world` sample for the :ref:`native_sim` with the EEPROM shell:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: native_sim
:gen-args: -DCONFIG_SHELL=y -DCONFIG_EEPROM=y -DCONFIG_EEPROM_SHELL=y
:goals: build
See the :ref:`shell <shell_api>` documentation for general instructions on how to connect and
interact with the shell. The EEPROM shell comes with built-in help (unless
:kconfig:option:`CONFIG_SHELL_HELP` is disabled). The built-in help messages can be printed by
passing ``-h`` or ``--help`` to the ``eeprom`` command or any of its subcommands. All subcommands
also support tab-completion of their arguments.
.. tip::
All of the EEPROM shell subcommands take the name of an EEPROM peripheral as their first argument,
which also supports tab-completion. A list of all devices available can be obtained using the
``device list`` shell command when :kconfig:option:`CONFIG_DEVICE_SHELL` is enabled. The examples
below all use the device name ``eeprom@0``.
EEPROM Size
***********
The size of an EEPROM can be inspected using the ``eeprom size`` subcommand as shown below:
.. code-block:: console
uart:~$ eeprom size eeprom@0
32768 bytes
Writing Data
************
Data can be written to an EEPROM using the ``eeprom write`` subcommand. This subcommand takes at
least three arguments; the EEPROM device name, the offset to start writing to, and at least one data
byte. In the following example, the hexadecimal sequence of bytes ``0x0d 0x0e 0x0a 0x0d 0x0b 0x0e
0x0e 0x0f`` is written to offset ``0x0``:
.. code-block:: console
uart:~$ eeprom write eeprom@0 0x0 0x0d 0x0e 0x0a 0x0d 0x0b 0x0e 0x0e 0x0f
Writing 8 bytes to EEPROM...
Verifying...
Verify OK
It is also possible to fill a portion of the EEPROM with the same pattern using the ``eeprom fill``
subcommand. In the following example, the pattern ``0xaa`` is written to 16 bytes starting at offset
``0x8``:
.. code-block:: console
uart:~$ eeprom fill eeprom@0 0x8 16 0xaa
Writing 16 bytes of 0xaa to EEPROM...
Verifying...
Verify OK
Reading Data
************
Data can be read from an EEPROM using the ``eeprom read`` subcommand. This subcommand takes three
arguments; the EEPROM device name, the offset to start reading from, and the number of bytes to
read:
.. code-block:: console
uart:~$ eeprom read eeprom@0 0x0 8
Reading 8 bytes from EEPROM, offset 0...
00000000: 0d 0e 0a 0d 0b 0e 0e 0f |........ |
Part 3
한국어 전문 번역
개요
eeprom command와 여러 subcommand를 통해 별도 application을 작성하지 않고 interactive interface에서 EEPROM driver API를 시험·탐색합니다. 기존 application에 켜서 EEPROM 문제를 interactive debugging하는 데도 사용할 수 있습니다.
활성화에 필요한 Kconfig option은 다음과 같습니다.
CONFIG_SHELLCONFIG_EEPROMCONFIG_EEPROM_SHELL
다음은 native_sim용 hello_world sample을 EEPROM shell과 함께 build하는 예입니다.
# From the root of the zephyr repository
west build -b native_sim samples/hello_world -- -DCONFIG_SHELL=y -DCONFIG_EEPROM=y -DCONFIG_EEPROM_SHELL=yCONFIG_SHELL_HELP를 끄지 않았다면 eeprom 또는 subcommand에 -h/--help를 넘겨 built-in help를 볼 수 있습니다. 모든 argument는 tab completion을 지원합니다.
eeprom subcommand의 첫 argument는 EEPROM peripheral 이름이며 tab completion을 지원합니다. CONFIG_DEVICE_SHELL을 켰다면 device list로 device 목록을 볼 수 있습니다. 예제 device 이름은 eeprom@0입니다.
EEPROM 크기
eeprom size로 EEPROM 크기를 확인합니다.
uart:~$ eeprom size eeprom@0
32768 bytesData 쓰기
eeprom write는 device 이름, write 시작 offset, 하나 이상의 data byte를 받습니다. 다음은 offset 0x0에 8-byte hexadecimal sequence를 씁니다.
uart:~$ eeprom write eeprom@0 0x0 0x0d 0x0e 0x0a 0x0d 0x0b 0x0e 0x0e 0x0f
Writing 8 bytes to EEPROM...
Verifying...
Verify OKeeprom fill은 EEPROM 일부를 같은 pattern으로 채웁니다. 다음은 offset 0x8부터 16 byte를 0xaa로 씁니다.
uart:~$ eeprom fill eeprom@0 0x8 16 0xaa
Writing 16 bytes of 0xaa to EEPROM...
Verifying...
Verify OKData 읽기
eeprom read는 device 이름, read 시작 offset, 읽을 byte 수를 받습니다.
uart:~$ eeprom read eeprom@0 0x0 8
Reading 8 bytes from EEPROM, offset 0...
00000000: 0d 0e 0a 0d 0b 0e 0e 0f |........ |
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.