Part 1
요약·해설
v1.8.6 기본 가정, 100 MHz·64 KiB IMEM·32 KiB DMEM, JTAG와 image_gen 영속화 차이를 설명합니다.
RISC-V C · M · Zicsr
64 KiB IMEM · 32 KiB DMEM
block RAM vs zephyr.vhd bitstream
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
7507F0687B6EB96ADEA7E7E975EBE8AAB0B2E8F9EFCA72B72195D72FD025CC3A
.. _neorv32:
NEORV32
#######
Overview
********
The NEORV32 is an open-source RISC-V compatible processor system intended as a
ready-to-go auxiliary processor within larger SoC designs or as a stand-alone
customizable microcontroller.
For more information about the NEORV32, see the following websites:
- `The NEORV32 RISC-V Processor GitHub`_
- `The NEORV32 RISC-V Processor Datasheet`_
- `The NEORV32 RISC-V Processor User Guide`_
The currently supported version is 1.8.6.
Supported Features
==================
The ``neorv32`` board configuration can be used a generic definition for NEORV32
based boards. Customisation to fit custom NEORV32 implementations can be done
using :ref:`devicetree overlays <use-dt-overlays>`.
Zephyr currently supports the following hardware features of the NEORV32
Processor (SoC):
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| INTC | on-chip | interrupt controller |
+-----------+------------+-------------------------------------+
| MTIME | on-chip | system timer |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio, non-interrupt |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| TRNG | on-chip | entropy |
+-----------+------------+-------------------------------------+
The default board configuration for the NEORV32 Processor (SoC) can be found in
the defconfig file: :file:`boards/riscv/neorv32/neorv32_defconfig`.
System Clock
============
The default board configuration assumes a system clock of 100 MHz. The clock
frequency can be overridden by changing the ``clock-frequency`` property of the
``cpu0`` devicetree node.
CPU
===
The default board configuration assumes the NEORV32 CPU implementation has the
following RISC-V ISA extensions enabled:
- C (Compresses Instructions)
- M (Integer Multiplication and Division)
- Zicsr (Control and Status Register (CSR) Instructions)
Internal Instruction Memory
===========================
The default board configuration assumes the NEORV32 SoC implementation has a 64k
byte internal instruction memory (IMEM) for code execution. The size of the
instruction memory can be overridden by changing the ``reg`` property of the
``imem`` devicetree node.
Internal Data Memory
====================
The default board configuration assumes the NEORV32 SoC implementation has a 32k
byte internal data memory (DMEM). The size of the data memory can be overridden
by changing the ``reg`` property of the ``dmem`` devicetree node.
Serial Port
===========
The default configuration assumes the NEORV32 SoC implements UART0 for use as
system console.
.. note::
The default configuration uses a baud rate of 19200 to match that of the
standard NEORV32 bootloader. The baudrate can be changed by modifying the
``current-speed`` property of the ``uart0`` devicetree node.
True Random-Number Generator
============================
The True Random-Number Generator (TRNG) of the NEORV32 is supported, but
disabled by default. For NEORV32 SoC implementations supporting the TRNG,
support can be enabled by setting the ``status`` property of the ``trng``
devicetree node to ``okay``.
Programming and Debugging
*************************
First, configure the FPGA with the NEORV32 bitstream as described in the NEORV32
user guide.
Next, build and flash applications as usual (see :ref:`build_an_application` and
:ref:`application_run` for more details).
Configuring a Console
=====================
Use the following settings with your serial terminal of choice (minicom, putty,
etc.):
- Speed: 19200
- Data: 8 bits
- Parity: None
- Stop bits: 1
Flashing via JTAG
=================
Here is an example for building and flashing the :ref:`hello_world` application
for the NEORV32 via JTAG. Flashing via JTAG requires a NEORV32 SoC
implementation with the On-Chip Debugger (OCD) and bootloader enabled.
.. note::
If the bootloader is not enabled, the internal instruction memory (IMEM) is
configured as ROM which cannot be modified via JTAG.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: neorv32
:goals: flash
The default board configuration uses an :ref:`openocd-debug-host-tools`
configuration similar to the example provided by the NEORV32 project. Other
JTAGs can be used by providing further arguments when building. Here is an
example for using the Flyswatter JTAG:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: neorv32
:goals: flash
:gen-args: -DBOARD_RUNNER_ARGS_openocd="--config;interface/ftdi/flyswatter.cfg;--config;neorv32.cfg;--cmd-pre-init;'adapter speed 2000'"
After flashing, you should see message similar to the following in the terminal:
.. code-block:: console
*** Booting Zephyr OS build zephyr-vn.n.nn ***
Hello World! neorv32
Note, however, that the application was not persisted in flash memory by the
above steps. It was merely written to internal block RAM in the FPGA. It will
revert to the application stored in the block RAM within the FPGA bitstream
the next time the FPGA is configured.
The steps to persist the application within the FPGA bitstream are covered by
the NEORV32 user guide. If the :kconfig:option:`CONFIG_BUILD_OUTPUT_BIN` is enabled and
the NEORV32 ``image_gen`` binary is available, the build system will
automatically generate a :file:`zephyr.vhd` file suitable for initialising the
internal instruction memory of the NEORV32.
In order for the build system to automatically detect the ``image_gen`` binary
it needs to be in the :envvar:`PATH` environment variable. If not, the path
can be passed at build time:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: neorv32
:goals: build
:gen-args: -DCMAKE_PROGRAM_PATH=<path/to/neorv32/sw/image_gen/>
Uploading via UART
==================
If the :kconfig:option:`CONFIG_BUILD_OUTPUT_BIN` is enabled and the NEORV32
``image_gen`` binary is available, the build system will automatically generate
a :file:`zephyr_exe.bin` file suitable for uploading to the NEORV32 via the
built-in bootloader as described in the NEORV32 user guide.
Debugging via JTAG
==================
Here is an example for the :ref:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: neorv32
:goals: debug
Step through the application in your debugger, and you should see a message
similar to the following in the terminal:
.. code-block:: console
*** Booting Zephyr OS build zephyr-vn.n.nn ***
Hello World! neorv32
.. _The NEORV32 RISC-V Processor GitHub:
https://github.com/stnolting/neorv32
.. _The NEORV32 RISC-V Processor Datasheet:
https://stnolting.github.io/neorv32/
.. _The NEORV32 RISC-V Processor User Guide:
https://stnolting.github.io/neorv32/ug/
Part 3
한국어 전문 번역
개요
NEORV32는 대형 SoC 안의 바로 사용할 수 있는 auxiliary processor 또는 stand-alone customizable microcontroller를 목표로 하는 open-source RISC-V compatible processor system입니다. 현재 지원 version은 1.8.6입니다.
neorv32 board configuration은 NEORV32 기반 board의 generic definition입니다. Custom implementation은 devicetree overlay로 맞춥니다.
지원 기능
| 인터페이스 | 컨트롤러 | 드라이버/컴포넌트 |
|---|---|---|
INTC | on-chip | interrupt controller |
MTIME | on-chip | system timer |
GPIO | on-chip | gpio, non-interrupt |
UART | on-chip | serial port-polling; serial port-interrupt |
TRNG | on-chip | entropy |
기본 구성은 boards/riscv/neorv32/neorv32_defconfig입니다.
기본 SoC 가정
System clock
기본값은 100 MHz이며 cpu0 devicetree node의 clock-frequency로 바꿀 수 있습니다.
CPU ISA
C: compressed instructionsM: integer multiplication/divisionZicsr: CSR instructions
Memory
기본 IMEM은 code 실행용 64 KiB이며 imem node의 reg로 크기를 바꿉니다. 기본 DMEM은 32 KiB이고 dmem node의 reg로 바꿉니다.
Serial
UART0가 system console입니다. Standard NEORV32 bootloader와 맞추기 위해 기본 baud는 19200이며 uart0의 current-speed로 바꿀 수 있습니다.
TRNG
TRNG driver는 지원하지만 기본 비활성입니다. 구현에 TRNG가 있으면 trng node의 status = "okay"로 활성화합니다.
프로그래밍과 디버깅
먼저 NEORV32 user guide에 따라 FPGA에 NEORV32 bitstream을 구성합니다. Serial terminal은 19200 baud, 8 data bits, no parity, 1 stop bit입니다.
JTAG flash
On-Chip Debugger(OCD)와 bootloader가 활성화된 SoC가 필요합니다. Bootloader가 없으면 IMEM이 JTAG로 수정할 수 없는 ROM으로 구성됩니다.
# Zephyr 저장소 루트에서
west build -b neorv32 samples/hello_world
west flash기본 OpenOCD 구성 대신 Flyswatter JTAG를 쓰는 예:
west build -b neorv32 samples/hello_world -- -DBOARD_RUNNER_ARGS_openocd="--config;interface/ftdi/flyswatter.cfg;--config;neorv32.cfg;--cmd-pre-init;'adapter speed 2000'"
west flash출력 예:
*** Booting Zephyr OS build zephyr-vn.n.nn ***
Hello World! neorv32
Application을 bitstream에 영속화하는 절차는 NEORV32 user guide에 있습니다. CONFIG_BUILD_OUTPUT_BIN과 NEORV32 image_gen이 있으면 build system이 IMEM 초기화용 zephyr.vhd를 자동 생성합니다. image_gen이 PATH에 없으면 경로를 지정합니다.
west build -b neorv32 samples/hello_world -- -DCMAKE_PROGRAM_PATH=<path/to/neorv32/sw/image_gen/>
UART upload
CONFIG_BUILD_OUTPUT_BIN과 image_gen이 있으면 built-in bootloader로 upload할 zephyr_exe.bin도 자동 생성합니다.
JTAG debug
# Zephyr 저장소 루트에서
west build -b neorv32 samples/hello_world
west debugDebugger에서 step하면 다음 출력이 보입니다.
*** Booting Zephyr OS build zephyr-vn.n.nn ***
Hello World! neorv32
참고 자료
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.