Differences
This shows you the differences between two versions of the page.
| programmable-logic:arty-a7:arty_a7_100_risc_v:start [2022/09/12 19:15] – changed forum.digilentinc.com to forum.digilent.com jeff.greenberg_ni.com | programmable-logic:arty-a7:arty_a7_100_risc_v:start [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Running a RISC-V Processor on the Arty A7 ====== | ||
| + | |||
| + | The Arty A7-100T contains a Xilinx XC7A100T FPGA which is the largest FPGA available for the Arty A7 and is ideal for deployment of | ||
| + | softcore processors. These processors can be either proprietary or open source. One of the most popular open source processors is the RISC-V. This tutorial covers building a RISC-V processor, specifically the SiFive Freedom E310. This guide steps through the process of loading the Freedom E310 onto an Arty A7, and programming it using the Arduino IDE. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | ---- | ||
| + | ==== Inventory ==== | ||
| + | |||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * 10 Flying leads to connect between the programmer and one of the Arty's Pmod connectors, which is connected to the JTAG Test Access Port of the processor | ||
| + | * A Linux development or virtual machine is needed to compile the processor, generate the bitstream and upload applications to the processor. | ||
| + | * Install the following on the Linux development machine: | ||
| + | |||
| + | - Git - the following command can be used: < | ||
| + | - Device Tree Compiler - the following command can be used: < | ||
| + | - Java Run Time Environment - the following command can be used: < | ||
| + | - JAVAC installed - the following command can be used: < | ||
| + | - Ensure the JAVA_HOME environment variable is set | ||
| + | |||
| + | ---- | ||
| + | ==== Getting Started ==== | ||
| + | |||
| + | Download and install version 2017.1 of [[https:// | ||
| + | |||
| + | Set up Vivado by sourcing the settings script in the terminal command line, using the following command: | ||
| + | < | ||
| + | source / | ||
| + | </ | ||
| + | |||
| + | **Note:** //If using a 32-bit Linux environment, | ||
| + | |||
| + | Download and include the Digilent' | ||
| + | < | ||
| + | git clone https:// | ||
| + | </ | ||
| + | Once downloaded, copy the ' | ||
| + | < | ||
| + | sudo cp -r vivado-boards/ | ||
| + | </ | ||
| + | |||
| + | Now it is possible to generate the processor and the FPGA implementation. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Building the RISC-V ==== | ||
| + | |||
| + | Generation and implementation of the processor can be done by running Makefiles. | ||
| + | |||
| + | <WRAP group> <WRAP column half> | ||
| + | First, download the SiFive freedom processor by using git and cloning its repository: | ||
| + | < | ||
| + | git clone --recursive https:// | ||
| + | </ | ||
| + | |||
| + | Cloning will take a little while due to a large number of files to download. Once downloaded, a new folder called " | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | Within this directory, there are several Makefiles. This tutorial will be using the Makefile.e300artydevkit example. The example script will generate the RISC-V processor for both the Arty A7-35T and Arty A7-100T. The toolchain must be compiled first. In the terminal window, change the working directory to the toolchains directory within rocket-chip/ | ||
| + | the following command: | ||
| + | |||
| + | < | ||
| + | |||
| + | Compiling the files will take a little time to complete. Generating generic Verilog files will allow either Arty A7-35T or Arty A7-100T to be targeted. | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> <WRAP column half> | ||
| + | In the terminal window, the peripherals and their locations in the memory map can be seen. | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> <WRAP column half> | ||
| + | With the Verilog description of the processor available, the next step is to decide which of the Arty boards will be targeted. No changes need to be made if targeting the Arty A7-35T. If targeting the Arty A7-100T, then some minor adjustments need to be made. To make these changes, open the makefile Makefile.e300artydevkit using a text editor and change board type. By default, the Makefile will generate the FPGA implementation for the Arty A7-35T. | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | To generate an implementation for the Arty A7-100T, change the board type to arty_a7_100T. Open a file browser and navigate to the freedom/ | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | Back in the text editor with the Makefile, change the board name to the arty_a7_100. | ||
| + | |||
| + | Save and close the modified file. | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | With that, the FPGA implementation can now be generated. In the terminal window issue the following command: | ||
| + | < | ||
| + | | ||
| + | This will take time, as the script will use Vivado and the RISC-V toolchain to generate both a bitstream and an MCS file. The MCS file can be | ||
| + | programmed into the flash memory on the Arty A7 100T and load the RISC-V processor when the board is powered on. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The output files will be available under the directory: | ||
| + | < | ||
| + | | ||
| + | The BIT files, MCS files, and Vivado implementation reports can all be found here. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ==== Programming the Hardware ==== | ||
| + | |||
| + | With the programming file available, the next step is to program the flash memory using Vivado. | ||
| + | |||
| + | Open Vivado using the command: " | ||
| + | |||
| + | <WRAP group> <WRAP column half> | ||
| + | Once the GUI starts, the next step is to connect the Arty A7-100T to the development machine via the micro USB port (J10), and to open Vivado' | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | |||
| + | <WRAP group> <WRAP column half> | ||
| + | After selecting the device, a dialog prompt will ask whether the device should be programmed now. Click **Yes** and another dialog will open. | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | |||
| + | <WRAP group> <WRAP column half> | ||
| + | Select the generated MCS file, and the device will be programmed. Once this process is complete, the Arty A7-100T will be running the RISC-V processor. Check that the Arty A7's jumpers are configured so that it can be programmed from flash and press the reset button. | ||
| + | </ | ||
| + | {{ : | ||
| + | |||
| + | </ | ||
| + | |||
| + | Confirm that the processor is running by doing the following: | ||
| + | - Press button 3 and see LED 6 go out | ||
| + | - Press the reset button and see LED 4 go out | ||
| + | |||
| + | However, a custom application still needs to be created and uploaded. This can be achieved by using the Arduino development environment. | ||
| + | |||
| + | ---- | ||
| + | ==== Generating Software ==== | ||
| + | <WRAP group> <WRAP column half> | ||
| + | First though, the Olimex JTAG pod needs to be connected to the Arty A7's Pmod Port D, allowing programs to be downloaded and | ||
| + | debugged using the JTAG interface. The pin out between for connecting the two can | ||
| + | be found [[https:// | ||
| + | |||
| + | With that, a custom application can now be developed. The best way to get started programming the RISC-V is to use the Arduino development environment. | ||
| + | |||
| + | Installing support for the SiFive Freedom processor is easy. Under "File -> Preferences", | ||
| + | Additional Boards Manager URL to the following URL: < | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | <WRAP group> <WRAP column half> | ||
| + | The next step is to install the board using the Board Manager found through the "Tools -> Boards" | ||
| + | |||
| + | In the Board Manager dialog, select the **Contributed** type to find the SiFive Freedom Boards. | ||
| + | </ | ||
| + | {{ : | ||
| + | </ | ||
| + | |||
| + | Once this is installed, applications can be developed, and examples applications loaded, just the same as for any other board in this environment. Just remember to select the Freedom Arty Dev Kit from the board selection list. | ||
| + | |||
| + | ==== Troubleshooting ==== | ||
| + | |||
| + | 1. Ensure that the Xilinx cable drivers are installed. This can be achieved by first changing the directory to < | ||
| + | |||
| + | 2. Ensure that the Olimex USB has the required permissions. Edit the following file: | ||
| + | < | ||
| + | < | ||
| + | # These are for the Olimex Debugger for use with E310 Arty Dev Kit | ||
| + | SUBSYSTEM==" | ||
| + | GROUP=" | ||
| + | SUBSYSTEM==" | ||
| + | GROUP=" | ||
| + | </ | ||
| + | |||
| + | 3. If problems occur while uploading, check the connections between the Olimex and Pmod Port D, | ||
| + | and ensure that the user is a member of the plugdev group. | ||
| + | |||
| + | ---- | ||
| + | ===== Next Steps ===== | ||
| + | |||
| + | For more guides on how to use the Arty A7, visit the device' | ||
| + | |||
| + | For more information on Vivado, visit Digilent' | ||
| + | |||
| + | For technical support, please visit the [[https:// | ||
| + | |||
| + | {{tag> | ||
| + | |||
| + | |||
| + | |||

