1.. _adp_xc7k_ae350:
2
3Andes ADP-XC7K AE350
4####################
5
6Overview
7********
8
9ADP-XC7K AE350 board is for AndeShape AE350 platform on ADP-XC7K series
10FPGA-based development boards.
11
12ADP-XC7K series are FPGA-based development and prototyping boards for evaluation of
13variety of AndesCore processors and AndeShape SoC platform IPs.
14AE350 is a RISC-V platform which can integrate AndesCore CPUs with a collection
15of fundamental peripheral IPs.
16
171st figure shows the green PCB is ADP-XC7K160 and 2nd figure shows the red PCB is ADP-XC7K410.
18
19.. image:: img/adp_xc7k160.jpg
20     :align: center
21     :alt: ADP-XC7K160
22
23.. image:: img/adp_xc7k410.jpg
24     :align: center
25     :alt: ADP-XC7K410
26
27More information can be found on `ADP-XC7K160/410`_ and `AndeShape AE350`_ websites.
28
29Hardware
30********
31
32The ADP-XC7K AE350 platform integrates 1 ~ 4 cores 32/64-bit 60MHz RISC-V CPUs, DSP,
331GB RAM, Cache, SPI flash memory, ethernet controller and other peripherals.
34
35The ADP-XC7K AE350 platform provides following hardware components:
36
37- 1 ~ 4 cores 32/64-bit 60MHz AndeStar v5 RISC-V CPUs
38- 1GB on-board SDRAM
39- 2MB SPI flash memory (1MB can be used for XIP)
40- UART
41- I2C
42- SPI
43- GPIO
44- PWM
45- DMA
46- 10/100 Ethernet RJ45 port
47- LCD module connector
48- 16KB I2C EEPROM
49- SD memory card slot
50- MIC-in, Line-in, and Line-out with AC97 audio codec
51
52Supported Features
53==================
54
55The ``adp_xc7k_ae350`` board configuration supports the following hardware features:
56
57+----------------+------------+----------------------+
58| Interface      | Controller | Driver/Component     |
59+================+============+======================+
60| PLIC           | on-chip    | interrupt_controller |
61+----------------+------------+----------------------+
62| RISC-V Machine | on-chip    | timer                |
63| Timer          |            |                      |
64+----------------+------------+----------------------+
65| GPIO           | on-chip    | gpio                 |
66+----------------+------------+----------------------+
67| UART           | on-chip    | serial               |
68+----------------+------------+----------------------+
69
70Other hardware features are not supported yet.
71
72Connections and IOs
73===================
74
75The ADP-XC7K AE350 platform has 1 GPIO controller. It providing 32 bits of IO.
76It is responsible for pin input/output, pull-up, etc.
77
78Mapping from GPIO controller to the ADP-XC7K board pins:
79
80+--------------------+--------------------+
81| GPIO controller    | Usage / Board pins |
82+====================+====================+
83| **Push Buttons**   |                    |
84+--------------------+--------------------+
85| GPIO.0             | SW1                |
86+--------------------+--------------------+
87| GPIO.1             | SW2                |
88+--------------------+--------------------+
89| GPIO.2             | SW3                |
90+--------------------+--------------------+
91| GPIO.3             | SW4                |
92+--------------------+--------------------+
93| GPIO.4             | SW5                |
94+--------------------+--------------------+
95| GPIO.5             | SW6                |
96+--------------------+--------------------+
97| GPIO.6             | SW7                |
98+--------------------+--------------------+
99| **7-Segment LED1** |                    |
100+--------------------+--------------------+
101| GPIO.16            | 7SEG1.A            |
102+--------------------+--------------------+
103| GPIO.17            | 7SEG1.B            |
104+--------------------+--------------------+
105| GPIO.18            | 7SEG1.C            |
106+--------------------+--------------------+
107| GPIO.19            | 7SEG1.D            |
108+--------------------+--------------------+
109| GPIO.20            | 7SEG1.E            |
110+--------------------+--------------------+
111| GPIO.21            | 7SEG1.F            |
112+--------------------+--------------------+
113| GPIO.22            | 7SEG1.G            |
114+--------------------+--------------------+
115| GPIO.23            | 7SEG1.DP           |
116+--------------------+--------------------+
117| **7-Segment LED2** |                    |
118+--------------------+--------------------+
119| GPIO.24            | 7SEG2.A            |
120+--------------------+--------------------+
121| GPIO.25            | 7SEG2.B            |
122+--------------------+--------------------+
123| GPIO.26            | 7SEG2.C            |
124+--------------------+--------------------+
125| GPIO.27            | 7SEG2.D            |
126+--------------------+--------------------+
127| GPIO.28            | 7SEG2.E            |
128+--------------------+--------------------+
129| GPIO.29            | 7SEG2.F            |
130+--------------------+--------------------+
131| GPIO.30            | 7SEG2.G            |
132+--------------------+--------------------+
133| GPIO.31            | 7SEG2.DP           |
134+--------------------+--------------------+
135| **GPIO pins**      |                    |
136+--------------------+--------------------+
137| GPIO.7             | IDE_CON1.4         |
138+--------------------+--------------------+
139| GPIO.8             | IDE_CON1.6         |
140+--------------------+--------------------+
141| GPIO.9             | IDE_CON1.8         |
142+--------------------+--------------------+
143| GPIO.10            | IDE_CON1.10        |
144+--------------------+--------------------+
145| GPIO.11            | IDE_CON1.11        |
146+--------------------+--------------------+
147| GPIO.12            | IDE_CON1.12        |
148+--------------------+--------------------+
149| GPIO.13            | IDE_CON1.13        |
150+--------------------+--------------------+
151| GPIO.14            | IDE_CON1.14        |
152+--------------------+--------------------+
153| GPIO.15            | IDE_CON1.15        |
154+--------------------+--------------------+
155
156Other peripheral mapping are listed below:
157
158+-------------+---------------------------------+
159| Peripherals | Usage / Board pins              |
160+=============+=================================+
161| SPI_1       | internal connected to SPI Flash |
162+-------------+---------------------------------+
163| SPI_2_CS    | IDE_CON1.37                     |
164+-------------+---------------------------------+
165| SPI_2_MOSI  | IDE_CON1.36                     |
166+-------------+---------------------------------+
167| SPI_2_MISO  | IDE_CON1.38                     |
168+-------------+---------------------------------+
169| SPI_2_SCLK  | IDE_CON1.35                     |
170+-------------+---------------------------------+
171| I2C_SDA     | J27.1                           |
172+-------------+---------------------------------+
173| I2C_SCL     | J27.2                           |
174+-------------+---------------------------------+
175
176System Clock
177------------
178
179The ADP-XC7K AE350 platform has 60MHz core clock.
180
181Serial Port
182-----------
183
184The ADP-XC7K AE350 platform has 2 UARTs.
185The Zephyr console output is by default assigned to UART2 and the default
186settings are 115200 8N1.
187
188Programming and debugging
189*************************
190
191For debugging zephyr applications or burning them into a flash, you will need to
192connect Andes ICE from host computer to ADP-XC7K board and execute the
193Andes ICE management software, ICEman, on this host computer.
194
195Connecting Andes ICE (AICE)
196===========================
197
198AICE is used for flashing and debugging the board. Please connect AICE to both
199ADP-XC7K board and the host computer as shown in the figure.
200
201.. image:: img/connect_aice.jpg
202     :align: center
203     :alt: Connect AICE
204
205More information can be found on `AICE-MINI+`_, `AICE-MICRO`_ website
206
207Building
208========
209
210You can build applications in the usual way. Here is an example for
211the :ref:`hello_world` application.
212
213.. zephyr-app-commands::
214   :board: adp_xc7k_ae350
215   :goals: build
216
217Flashing
218========
219
220Before flashing, you have to download ICEman (``ice.zip``) from the
221`Andes Development Kit`_.
222If you want to use XIP mode (``CONFIG_XIP=y``), you also need to download
223the flash burner (``flash.zip``).
224
225At first, you should run ICEman when flashing and debugging program.
226
227.. code-block:: console
228
229   # Enable execute file permission of ICEman
230   chmod a+x ./ICEman
231
232   # Running the ICEman server
233   sudo ./ICEman -Z v5
234
235.. note::
236
237   To run ICEman commands as a normal user, you will need to install the
238   :file:`70-ndsusb-v1.rules` udev rules file (usually by placing it in
239   :file:`/etc/udev/rules.d`, then unplugging and plugging the
240   AICE adapter in again via USB.).
241
242If ``CONFIG_XIP=n``, you can load the program (``zephyr.elf``) into RAM directly
243and execute it.
244
245.. code-block:: console
246
247   # Check the ICEman server is running
248   # Load the program into RAM and execute it
249   riscv64-zephyr-elf-gdb zephyr/zephyr.elf
250   (gdb) target remote :1111
251   (gdb) monitor reset halt
252   (gdb) load
253   (gdb) quit
254
255If ``CONFIG_XIP=y``, you need to burn the program (``zephyr.bin``) into flash memory
256and execute it.
257
258.. code-block:: console
259
260   # Check the ICEman server is running
261   # Burn the program into flash and execute it
262   <FLASH>/bin/target_burn_frontend \
263       -P 4444 --unlock --verify --image=zephyr/zephyr.bin \
264       --algorithm-bin=<FLASH>/target_bin/target_SPI_v5_[32|64].bin
265
266   # Note:
267   #   1. Assume the flash burner is downloaded to <FLASH> directory
268   #   2. For algorithm-bin file, use target_SPI_v5_32.bin in RV32 platform and
269   #      use target_SPI_v5_64.bin in RV64 platform
270
271Open a serial terminal with the following settings:
272
273- Speed: 115200
274- Data: 8 bits
275- Parity: None
276- Stop bits: 1
277
278you should see the following message in the terminal:
279
280.. code-block:: console
281
282   ***** Booting Zephyr OS v2.4.0 *****
283   Hello World! adp_xc7k_ae350
284
285Debugging
286=========
287
288.. code-block:: console
289
290   # Check the ICEman server is running
291   # Load and debug program
292   ./riscv64-zephyr-elf-gdb zephyr/zephyr.elf
293   (gdb) target remote :1111
294   (gdb) monitor reset halt
295   (gdb) load
296
297If ``CONFIG_XIP=y``, please follow the flashing section to burn the program into
298flash memory first.
299Then, you can use GDB to debug program by above commands but do NOT execute ``load``
300command since the program has been placed in the flash memory.
301
302References
303**********
304
305.. target-notes::
306
307.. _ADP-XC7K160/410: http://www.andestech.com/en/products-solutions/andeshape-platforms/adp-xc7k160-410/
308
309.. _AndeShape AE350: http://www.andestech.com/en/products-solutions/andeshape-platforms/ae350-axi-based-platform-pre-integrated-with-n25f-nx25f-a25-ax25/
310
311.. _AICE-MINI+: http://www.andestech.com/en/products-solutions/andeshape-platforms/aice-mini-plus/
312
313.. _AICE-MICRO: http://www.andestech.com/en/products-solutions/andeshape-platforms/aice-micro/
314
315.. _Andes Development Kit: https://github.com/andestech/Andes-Development-Kit/releases
316