1.. _zybo:
2
3Digilent Zybo
4#############
5
6Overview
7********
8
9The `Digilent Zybo`_ (ZYnq BOard) is a feature-rich, ready-to-use embedded software and digital
10circuit development board. It is built around the Xilinx Zynq-7000 family, which is based on the
11Xilinx All Programmable System-on-Chip (AP SoC) architecture. This architecture tightly integrates a
12dual-core ARM Cortex-A9 processor with Xilinx 7-series Field Programmable Gate Array (FPGA) logic.
13
14.. figure:: zybo-0.jpg
15   :align: center
16   :alt: Digilent Zybo
17
18   Digilent (Credit: Digilent)
19
20Hardware
21********
22
23Supported Features
24==================
25
26The zybo board configuration supports the following hardware features:
27
28+------------+------------+-------------------------------------+
29| Interface  | Controller | Driver/Component                    |
30+============+============+=====================================+
31| GICv1      | on-chip    | ARM generic interrupt controller v1 |
32+------------+------------+-------------------------------------+
33| ARCH TIMER | on-chip    | ARM architected timer               |
34+------------+------------+-------------------------------------+
35| PINCTRL    | on-chip    | pinctrl                             |
36+------------+------------+-------------------------------------+
37| GPIO       | on-chip    | gpio                                |
38+------------+------------+-------------------------------------+
39| UART       | on-chip    | serial port-polling;                |
40|            |            | serial port-interrupt               |
41+------------+------------+-------------------------------------+
42
43The default configuration can be found in
44:zephyr_file:`boards/digilent/zybo/zybo_defconfig`
45
46Other hardware features are not currently supported by the port.
47
48Programming and Debugging
49*************************
50
51The Zynq-7000 series SoC needs to be initialized prior to running a Zephyr application. This can be
52achieved in a number of ways (e.g. using the Xilinx First Stage Boot Loader (FSBL), the Xilinx
53Vivado generated ``ps_init.tcl`` JTAG script, Das U-Boot Secondary Program Loader (SPL), ...).
54
55The instructions here use the U-Boot SPL. For further details and instructions for using Das U-Boot
56with Xilinx Zynq-7000 series SoCs, see the following documentation:
57
58- `Das U-Boot Website`_
59- `Using Distro Boot With Xilinx U-Boot`_
60
61Building Das U-Boot
62===================
63
64Clone and build Das U-Boot for the Digilent Zybo:
65
66.. code-block:: console
67
68   git clone -b v2022.04 https://source.denx.de/u-boot/u-boot.git
69   cd u-boot
70   make distclean
71   make xilinx_zynq_virt_defconfig
72   export PATH=/path/to/zephyr-sdk/arm-zephyr-eabi/bin/:$PATH
73   export CROSS_COMPILE=arm-zephyr-eabi-
74   export DEVICE_TREE="zynq-zybo"
75   make
76
77Flashing
78========
79
80Here is an example for running the :zephyr:code-sample:`hello_world` application via JTAG.
81
82Ensure the board is configured for JTAG boot, open a serial terminal, turn on/reset the board (press
83the ``PS-SRST`` button), and initialize the Zynq-7000 series SoC by uploading and running the U-Boot
84SPL via JTAG.
85
86Next, upload and run the Zephyr application:
87
88.. zephyr-app-commands::
89   :zephyr-app: samples/hello_world
90   :board: zybo
91   :goals: flash
92
93You should see the following message in the terminal:
94
95.. code-block:: console
96
97   *** Booting Zephyr OS vx.xx.x-xxx-gxxxxxxxxxxxx ***
98   Hello World! zybo
99
100Another option is to load and run the :zephyr:code-sample:`hello_world` application via U-Boot. Copy
101``u-boot/spl/boot.bin``, ``u-boot/u-boot.img``, and ``zephyr/zephyr.bin`` to a FAT32 formatted
102microSD card, insert the card in the ``SD MICRO`` slot on the Zybo board, ensure the board is
103configured for ``SD`` boot, and turn on the board.
104
105Once U-boot is done initializing, load an run the Zephyr application:
106
107.. code-block:: console
108
109   Zynq> fatload mmc 0 0x0 zephyr.bin
110   817120 bytes read in 56 ms (13.9 MiB/s)
111   Zynq> go 0x0
112   ## Starting application at 0x00000000 ...
113   *** Booting Zephyr OS vx.xx.x-xxx-gxxxxxxxxxxxx ***
114   Hello World! zybo
115
116Debugging
117=========
118
119Here is an example for the :zephyr:code-sample:`hello_world` application.
120
121Ensure the board is configured for JTAG boot, open a serial terminal, turn on/reset the board (press
122the ``PS-SRST`` button), and initialize the Zynq-7000 series SoC by uploading and running the U-Boot
123SPL via JTAG.
124
125Next, upload and debug the Zephyr application:
126
127.. zephyr-app-commands::
128   :zephyr-app: samples/hello_world
129   :board: zybo
130   :goals: debug
131
132Step through the application in your debugger, and you should see the following message in the
133terminal:
134
135.. code-block:: console
136
137   *** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx ***
138   Hello World! zybo
139
140.. _Digilent Zybo:
141   https://digilent.com/reference/programmable-logic/zybo/start
142
143.. _Das U-Boot Website:
144   https://www.denx.de/wiki/U-Boot
145
146.. _Using Distro Boot With Xilinx U-Boot:
147   https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/749142017/Using+Distro+Boot+With+Xilinx+U-Boot
148