samples/drivers/fpga/fpga_controller/README.html · samples/drivers/fpga/fpga_controller/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Drivers · FPGA

FPGA Controller

준비된 bitstream과 사용자가 전송한 bitstream을 QuickFeather FPGA에 적용합니다.

Official pathsamples/drivers/fpga/fpga_controller/README.html
Source filesamples/drivers/fpga/fpga_controller/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Build부터 address 확인, devmem 전송과 재업로드까지 전체 shell 흐름을 보존합니다.

Board

QuickFeather

Bitstream size

75,960 bytes

Shell

fpga · devmem

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 AB6401E3A78C6380F448F4A361536D950EF75DB8F3805FC2F4DAFD5D35C57770
.. zephyr:code-sample:: fpga-controller
   :name: FPGA Controller

   Load a bitstream into an FPGA and perform basic operations on it.

Overview
********
This module is an FPGA driver that can easily load a bitstream, reset it, check its status, enable or disable the FPGA.
This sample demonstrates how to use the FPGA driver API and the FPGA controller shell subsystem.
Currently the sample works with `Quicklogic Quickfeather board`_.

Requirements
************

* Zephyr RTOS
  or
* Zephyr RTOS with shell subsystem enabled (for shell application)
* `Quicklogic Quickfeather board`_

Building
********

For building on QuickLogic QuickFeather board:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/fpga/fpga_controller
   :host-os: unix
   :board: quick_feather
   :goals: build


To build the FPGA Controller shell application, use the supplied
configuration file prj_shell.conf:

.. zephyr-app-commands::
   :zephyr-app: samples/drivers/fpga/fpga_controller
   :host-os: unix
   :board: quick_feather
   :conf: prj_shell.conf
   :goals: build
   :compact:


Running
*******

See :ref:`quickfeather` on how to load an image to the board.

Sample output
=============

Once the board is programmed, the LED should alternately flash red and green.

For the FPGA controller shell application, after connecting to the shell console you should see the following output:

.. code-block:: console

    Address of the bitstream (red): 0xADDR
    Address of the bitstream (green): 0xADDR
    Size of the bitstream (red): 75960
    Size of the bitstream (green): 75960

    uart:~$

This sample is already prepared with bitstreams.
After executing the sample, you can see at what address it is stored and its size in bytes.

The FPGA controller command can now be used (``fpga load <device> <address> <size in bytes>``):

.. code-block:: console

    uart:~$ fpga load FPGA 0x2001a46c 75960
    FPGA: loading bitstream


The LED should start blinking (color depending on the selected bitstream).
To upload the bitstream again you need to reset the FPGA:

.. code-block:: console

    uart:~$ fpga reset FPGA
    FPGA: resetting FPGA

You can also use your own bitstream.
To load a bitstream into device memory, use `devmem load` command.
It is important to use the -e option when sending a bitstream via `xxd`:

.. code-block:: console

    uart:~$ devmem load -e 0x10000
    Loading...
    Press ctrl-x + ctrl-q to stop

Now, the loader is waiting for data.
You can either type it directly from the console or send it from the host PC (replace `ttyX` with the appropriate one for your shell console):

.. code-block:: console

    xxd -p data > /dev/ttyX

(It is important to use plain-style hex dump)
Once the data is transferred, use `ctrl-x + ctrl-q` to quit loader.
It will print the sum of the read bytes and return to the shell:

.. code-block:: console

    Number of bytes read: 75960
    uart:~$

Now the bitstream can be uploaded again.

.. code-block:: console

    uart:~$ fpga load FPGA 0x10000 75960
    FPGA: loading bitstream

References
**********

.. _Quicklogic Quickfeather board:
   https://github.com/QuickLogic-Corp/quick-feather-dev-board

Part 3

한국어 전문 번역

개요

이 module은 bitstream을 쉽게 load하고, reset하고, status를 확인하며, FPGA를 enable 또는 disable할 수 있는 FPGA driver입니다. 이 sample은 FPGA driver API와 FPGA controller shell subsystem을 사용하는 방법을 보여줍니다. 현재는 QuickLogic QuickFeather board에서 동작합니다.

요구 사항

  • Zephyr RTOS
  • 또는 shell application을 위한 shell subsystem이 활성화된 Zephyr RTOS
  • QuickLogic QuickFeather board

Build

QuickLogic QuickFeather board용 build 명령은 다음과 같습니다.

# From the root of the zephyr repository
west build -b quick_feather samples/drivers/fpga/fpga_controller

FPGA Controller shell application을 build하려면 제공된 prj_shell.conf 구성 파일을 사용합니다.

west build -b quick_feather samples/drivers/fpga/fpga_controller -- -DCONF_FILE=prj_shell.conf

실행

Board에 image를 load하는 방법은 quick_feather board 문서를 참조하십시오.

Sample 출력

Board programming이 끝나면 LED가 red와 green으로 번갈아 깜박여야 합니다.

FPGA controller shell application에서는 shell console에 연결한 뒤 다음 출력을 볼 수 있습니다.

Address of the bitstream (red): 0xADDR
Address of the bitstream (green): 0xADDR
Size of the bitstream (red): 75960
Size of the bitstream (green): 75960

uart:~$

이 sample에는 bitstream이 이미 준비되어 있습니다. Sample을 실행하면 저장된 address와 byte 단위 size를 확인할 수 있습니다.

이제 fpga load <device> <address> <size in bytes> 형식의 FPGA controller 명령을 사용할 수 있습니다.

uart:~$ fpga load FPGA 0x2001a46c 75960
FPGA: loading bitstream

LED가 깜박이기 시작해야 하며 색은 선택한 bitstream에 따라 달라집니다. Bitstream을 다시 upload하려면 FPGA를 reset해야 합니다.

uart:~$ fpga reset FPGA
FPGA: resetting FPGA

자체 bitstream도 사용할 수 있습니다. Device memory로 bitstream을 load하려면 devmem load 명령을 사용합니다. xxd를 통해 bitstream을 보낼 때는 -e option을 사용하는 것이 중요합니다.

uart:~$ devmem load -e 0x10000
Loading...
Press ctrl-x + ctrl-q to stop

이제 loader가 data를 기다립니다. Console에서 직접 입력하거나 host PC에서 보낼 수 있습니다. ttyX는 shell console에 맞는 device로 바꾸십시오.

xxd -p data > /dev/ttyX

Plain-style hex dump를 사용해야 합니다. Data 전송이 끝나면 ctrl-x와 ctrl-q를 사용해 loader를 종료합니다. Loader는 읽은 byte의 합계를 출력하고 shell로 돌아갑니다.

Number of bytes read: 75960
uart:~$

이제 bitstream을 다시 upload할 수 있습니다.

uart:~$ fpga load FPGA 0x10000 75960
FPGA: loading bitstream

참고 자료

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.