Installing Xilinx Vivado for Red Pitaya FPGA programming.
Peter Halverson                     Last update 9/2/2019
http://halverscience.net/index.html

Link to latest notes on Google Docs:
https://docs.google.com/document/d/1MpGDt-FqmUyy9EuTfq82yU7thd97kCuhg9waSxvlw7Y/edit?usp=sharing

These are Halverson's personal notes. They are unedited and there is no guarantee of accuracy.  Use at your own risk. I am making them available to you because they might actually be helpful.  If they are helpful, I would really appreciate a "thank you". 

Caution:    I never succeeded in getting Vivado to properly re-compile the Red Pitaya FPGA code.    Red Pitaya is VERY complicated. It uses many different languages, layers of software. So if you just want to learn about FPGAs, go elsewhere.  I highly recommend the NandLand tutorials and the GoBoard. https://www.nandland.com/

---------------------- System description -----------------------
My computer:  Intel NUC5i5RYH, core i5 cpu, 16 Gb RAM, 500 Gb disk drive (solid state drive).
https://ark.intel.com/content/www/us/en/ark/products/83255/intel-nuc-kit-nuc5i5ryh.html

Starting with a generic Ubuntu Desktop version 16.04 clean installation and all Ubuntu updates installed.  This install was from an external usb connected DVD. At the start of the installation the installer asked about whether to use a legacy boot loader or a pre-installed UEFI boot loader.  I opted to keep the UEFI boot.

------------------- Install emergency shutdown in case Vivado hangs ---------------
On another machine, I had a bad experience with Vivado hopelessly locking up my system when it ran out of memory.  So I am going to enable the “magic key” feature of Linux to allow an emergency kill of Vivado and a controlled shutdown.

Edit (using nano) the file    /etc/sysctl.d/10-magic-sysrq.conf   to include the line 
Kernel.sysrq = 1
I got this info from 
https://askubuntu.com/questions/11002/alt-sysrq-reisub-doesnt-reboot-my-laptop

Reboot and test the magic key.  It works. 
(Notes on how to use it are in my Ubuntu_notes.txt file)

-------------- Install Libraries that Vivado will need but aren’t part of default Ubuntu -----------
The following steps were gleaned from “Installing Vivado with SDK 2018.2 on Ubuntu 16.04 LTS”
https://www.knitronics.com/knitronicsblog/installing-vivado-w-sdk-20182-on-ubuntu-1604-lts

Note that you need a lot of disk space 100 Gb and a lot of RAM, at least 16 Gb.

Start by installing software in 32-bit node that Vivado will apparently need.

sudo dpkg --add-architecture i386
sudo apt-get install chrpath socat texinfo gcc-multilib libsdl1.2-dev xinetd tofrodos iproute
sudo apt-get install gawk gcc git-core make net-tools ncurses-dev libcurses5-dev 
sudo apt-get install zlib1g-dev flex bison lib32z1 lib32ncurses5 lib32stdc++6
sudo apt-get install libselinux1 xvfb autoconf libtool libbz2-1.0 xinetd tftpd tftp 
sudo apt-get install lib32stdc++6 libgtk2.0-0:i386 libfontconfig1:i386 libx11-6:i386 
sudo apt-get install libxext6:i386 libxrender1:i386 libsm6:i386 libssl-dev libqtgui4:i386
sudo apt-get install libxft2 libxft2:i386                 
(That last install, apt-get install libxft2 libxft2:i386, comes from the Red Pitaya instructions)

-------------------------- Set up tftp, recommended by Knitronics ------------
Set up tftp (Trivial File Transfer Protocol)   (Does Vivado really need this? - Halverson)

sudo nano /etc/xinetd.d/tftp
service tftp
    {
    protocol = udp 
    port = 69
    socket_type = dgram
    wait = yes
    user = nobody 
    server = /usr/sbin/in.tftpd
    server_args = /tftpboot
    disable = no
    }

Make a folder needed by tftp
sudo mkdir /tftpboot
sudo chmod -R 777 /tftpboot
sudo chown -R nobody /tftpboot

Restart the tftp service to allow for all the edits to take effect.
sudo /etc/init.d/xinetd stop
sudo /etc/init.d/xinetd start

---------------- Disable Ubuntu’s “dash” shell and replace with “bash” shell -----------------
Knitronics says Xilinx’s IDEs aren’t guaranteed to get along well with your shell being dash, so you’ll want to switch it over to bash:
sudo dpkg-reconfigure dash
Select the yes option on this when it pops up.
------------------------------ Install serial port tools. -------------------------------
 (Probably not needed with RedPitaya? - Halverson)

Install tools to make it easier to use the serial port, in case you use the UART on the FPGA board.
sudo apt-get install grep      (It seems this wasn’t necessary. Grep was already installed.)
sudo apt install screen        (This is a serial terminal program)

REBOOT

--------------- Get the Vivado software from Xilinx ---------------------
Go to the Xilinx Downloads page:
https://www.xilinx.com/support/download.html

Navigate to    (Before doing this, stop and read ahead a few lines; Red Pitaya won't work with this version.)
Vivado HLx 2018.2: All OS installer Single-File Download (TAR/GZIP - 17.11 GB) 
and download.  (2.5 hours download time on my home internet.)
(To actually start the download, you need to have created a Xilinx username and password.  There is no charge for that.)

NOTE:  I have to install Vivado HLx 2017.2: All OS installer Single-File Download (TAR/GZIP - 22.13 GB) because example project 0.94 from RedPitaya was made with this version.  (3 hour download time)

Basically, I did the installation steps twice.  The first time it was for Vivado 2018.2 and the second time it was for Vivado 2017.2.  As I said above, 2017.2 is needed to compile the RedPitaya 0.94 project. The installation steps are identical (just put “2017.2” instead of “2018.2” in the commands), with the possible exception of the ethernet port, which I talk about later.

Important information for installing Vivado is in the Xilinx UG973 document.  (Weird name?) There is one for each release. I Googled Xilinx UG973 2018.2 and got this:
https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug973-vivado-release-notes-install-license.pdf

At this point I am following instructions from the Xilinx UG973 guide, chapter 3, starting on page 16.
Allow Firefox (my browser is version 68.0.2) to show pop-up windows from https://www.o-ms.com/
Do this by going to Edit > Preferences > Privacy and Security > Block Pop-up Windows > Exceptions...

To allow Xilinx pages to show secure and non-secure items on the same page I click the “shield” in the address bar and click “Turn off content blocking for this site.”  The “shield” changes and now has a slash through it.

I am skipping the verification step.  Had trouble getting it to work. (Theoretically, this is a security risk.)

------------------ Uncompress the downloaded Vivado software ----------------
Navigate to Downloads folder and uncompress the downloaded file  (takes about 5 minutes)
cd Downloads
tar -xvzf Xilinx_Vivado_SDK_2018.2_0614_1954.tar.gz

Navigate into the newly created Xilinx folder:
 cd Xilinx_Vivado_SDK_2018.2_0614_1954

--------------- Run the Vivado installer ------------------
Make the installation script executable:
chmod +x xsetup

Run the installer:
sudo ./xsetup

A Welcome screen opens and it tells you that a newer version of Vivado is available.  (I’m declining)

Click Next, Agree, Agree, Agree, Next

For a NO COST version of Vivado,
click Vivado HL WebPack, Next

For my goal of programming the FGPA in Red Pitaya, I
click (or make sure it is selected)
-- Vivado design Suite
-- Software Development Kit (SDK)
-- DocNav
-- SoCs
-- 7 Series
UltraScale and UltraScale+ NOT NEEDED
-- Enable WebTalk for Vivado
-- Enable WebTalk for SDK
(This was specified here: https://documentation-rp-test.readthedocs.io/en/latest/tutorfpga1.html)
Click Next
I’m in the Select Destination Directory screen.   /opt/Xilinx is fine and the two options “Create program group entries” and “Create desktop shortcuts” are selected.  NOTE: The shortcuts failed to be created.
Click Next
I’m at the Installation summary which confirms my selections
Click Install

!!!!!!!!!!!!!!!! YEA IT’S INSTALLING !!!!!!!!!!!!!!   (Installation took 8 minutes)
I get a window saying “Installation Completed Successfully” and now the installer exits.

---------------- Install Xilinx cable drivers ---------------------
Referring again to knitronics’s information, I install drivers that Xilinx would use if I were using their programming boards.  This probably doesn’t apply to Red Pitaya, but I’m doing it anyway:
 cd /opt/Xilinx/Vivado/2018.2/data/xicom/cable_drivers/lin64/install_script/install_drivers
sudo ./install_drivers


---------------- Get the Vivado desktop shortcuts ----------------
There is a bug in the Vivado installer, that causes the Desktop shortcuts for Vivado to be put in the wrong place.  So I need to copy the desktop shortcuts for Vivado, Documentation Navigator and HLS from the root account’s desktop to my desktop.
To do that I need to become the root account which is disabled, by default in Ubuntu.
First make sure I’m in MY Desktop:
cd ~/Desktop

Enable the root account:
sudo passwd root                     (This sets the password for the root account)
sudo passwd -u root                 (This unlocks it.)
(The article also explains how to optionally lock it again:   sudo passwd -l root)

Become root:
su      (Enter the password you just created)

Copy the desktop shortcuts and change their permissions so that I can use them:
cp /root/Desktop/* .       (Copies the shortcuts to “.” which means copy to “here,” i.e. “Desktop”)
chmod 777 *.desktop           (Makes it so I can use the desktop shortcuts in spite of them belonging to root)
exit

Now the shortcuts appear on my Desktop.   I got the info about the shortcuts going to the wrong places from here:  https://forums.xilinx.com/t5/Installation-and-Licensing/Where-is-Vivado-after-the-install/td-p/797898

Double clicking the Vivado shortcut starts Vivado!!!!  Woohoo!

--------------------------- Obtain Vivado License ----------------------------------
Quit Vivado because…

I STILL need to load a license for Vivado.

Xilinx emailed me my Vivado License.  The starting point for that process is here: https://www.xilinx.com/products/intellectual-property/license.html
Click “Generate a License Key”
Fill out the U.S. Government Export Approval form.  Click Next
Select the No Charge, No expiration date ISEWebPACK license  and click Generate Node-Locked license. I think “Node Locked” means that the license is usable on only one “node”, i.e. one computer.

Xilinx emails the license to you.  It is a text file called “Xilinx.lic”  Get it from the email and put it on your Desktop.

--------------------- Install License ----------------------
First run a script that puts vlm (and other commands) into the PATH:
source /opt/Xilinx/Vivado/2018.2/settings64.sh

Run the license manager:
vlm

--------------------- Fixing the 000000000000 error in the license manager --------------------
If you get an error message about the computer’s MAC address being “000000000000” the do the steps below, otherwise skip.
The 2018 license manager runs OK but the 2017 license manager has a problem with the labeling of the ethernet ports which has changed with Ubuntu 16.  A solution is to rename the ethernet port to one that the license manager can understand. (The license manager uses the ethernet MAC address as a sort of fingerprint for that machine.)

Changing the ethernet name is explained here:
https://www.itzgeek.com/how-tos/mini-howtos/change-default-network-name-ens33-to-old-eth0-on-ubuntu-16-04.html

First confirm that the ethernet port has a weird name:
nmcli dev status

On my machine the port’s name is enp0s25.  Not good. I want it to be eth0.

Confirm that the renaming happened in the grub program
dmesg | grep -i eth

I can see the renaming happening

Edit the grub script:
sudo nano /etc/default/grub

In grub, change the line that says GRUB_CMDLINE_LINUX="" to GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

Save and exit nano

Generate a new grub file:
sudo grub-mkconfig -o /boot/grub/grub.cfg

REBOOT.  Then check the ethernet port name:
nmcli dev status               YES! the ethernet now has the name “eth0”

Run the script that puts vlm (and other commands) into the PATH:
source /opt/Xilinx/Vivado/2018.2/settings64.sh
Next run the license manager:
vlm
--------------------- End of fixing the 000000000000 error -------------------------
I put the Xilinx.lic file that I previously obtained (for free) from Xilinx on to my Desktop.  Then in vlm, I click Load License > Copy License and navigate to the Xilinx.lic file on my desktop.  Seems to work OK. It seems to have copied Xilinx.lic to ~/.Xilinx/Xilinx.lic
-------------------- End of license -------------
=========  End of Vivado Installation ===================

---------------  Make bootable backup of system ----------------

After all this work, it’s time to do a backup.
Notes on how to do this moved to Halverson's Ubuntu_notes.txt

------------ End of backup ------------

----------- TIME TO GET SOME FPGA CODE ----------------------------------
Go to the Red Pitaya Web site.  https://www.redpitaya.com/

 (I’m using Firefox.)  

Turn off “blocking” of certain information by firefox, by clicking the little shield icon to the left of the web address and selecting “Turn off blocking.”   (Not important?)

We want the Red Pitaya FPGA tutorial.  There a link to it at the bottom in the section titled “STEMlab as TEACHING/LEARNING platform.”  The link takes us here: https://documentation-rp-test.readthedocs.io/en/latest/

At this point I am referring to Chapter 16, Programming the FPGA.  https://documentation-rp-test.readthedocs.io/en/latest/tutorfpga2.html

Following instructions, I get the FPGA Github repository from here: https://github.com/RedPitaya/RedPitaya
Clicking “Clone or Download” download RedPitaya-master.zip

Unzip (extract) the code by right-clicking RedPitaya-master.zip > Extract here

In the Terminal 
cd ~/Downloads/RedPitaya-master/fpga/

------------------------ “Compile” the FPGA code using Vivado ---------------------

Still referring to Chapter 16, Programming the FPGA.  https://documentation-rp-test.readthedocs.io/en/latest/tutorfpga2.html

Go to the appropriate directory, set up environment variables, and run the Vivado system using this command. Note also that the “.” command is the same as the Linux “source” command

cd ~/Downloads/RedPitaya-master/fpga/
source /opt/Xilinx/Vivado/2017.2/settings64.sh 
make project PRJ=v0.94

Vivado opens a window and begins.  Very cool looking wiring diagrams appear.  
Yay! It’s working!!!!!!!!!

Follow the steps here, for a first project, a blinking LED, on the RedPitaya board:
https://documentation-rp-test.readthedocs.io/en/latest/tutorfpga2.html

(Monitoring my RAM usage, I see that Vivado is using up to 3.5 Gb.  No wonder my old computer couldn’t run Vivado.)

At this time I am still encountering problems.  In the Rep Pitaya tutorial, I am told to compile version 0.94, with modifications that are supposed to make an LED blink.

Unfortunately, the projects has “critical errors.”  I tried with and without the modifications for the LED and I get the same errors.   My suspicions is that Vivado 2017.2 is too “new” and that I need to go back even further for a compatible Vivado.  (To be honest, I’m a bit pissed that the tutorial didn’t catch this issue, if that is indeed the cause.)

The specific error occurs in the 2nd phase, implementation.  Here are the error messages:


[Vivado 12-4739] set_false_path:No valid object(s) found for '-to [get_clocks dac_clk_o]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":212]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-to [get_clocks dac_clk_2x]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":213]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-to [get_clocks dac_clk_2p]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":214]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-to [get_clocks dac_clk_1x]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":216]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-to [get_clocks dac_clk_2x]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":217]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-to [get_clocks dac_clk_2p]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":218]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-to [get_clocks ser_clk]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":219]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-to [get_clocks pdm_clk]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":220]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-from [get_clocks dac_clk_o]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":221]
[Vivado 12-4739] set_false_path:No valid object(s) found for '-from [get_clocks dac_clk_o]'. ["/home/halver/Downloads/RedPitaya-master/fpga/prj/v0.94/project/redpitaya.srcs/constrs_1/imports/sdc/red_pitaya.xdc":222]

[Timing 38-282] The design failed to meet the timing requirements. Please see the timing summary report for details on the timing violations.

==================== Attempting resolve the above errors ======================
Note that an alternate set of instructions from Red Pitaya exists here: https://redpitaya.readthedocs.io/en/latest/developerGuide/fpga.html
  From here I learn that the make command can be used in various ways.

Tried the “classic” project:
make project PRJ=classic

But I’m getting similar errors.

Try the non-gui version of making the code:
make PRJ=classic                               (Just leave out the word “project”)

Now I have an error because the TCL script red_pitaya_vivado_Z10.tcl is using the “git” command which is not installed.  I will install it now.

==================== Installing git ==================================
This web page is helpful:  https://www.liquidweb.com/kb/install-git-ubuntu-16-04-lts/

sudo apt-get update                       (Update Ubuntu, recommended by the above web page.)
sudo apt install git
git --version                                              (Check if git is alive. It should say “git version 2.7.4”)
git config --global user.name "halver"     (Set up my user information. You would put your info)
git config --global user.email "pghalverson@gmail.com"
cat ~/.gitconfig        (Just checking the user info)
git config --list

================= End of installing git ==================================

Still not OK.  Before installing git the error was
“couldn't execute "git": no such file or directory”

Now the error is 
fatal: Not a git repository (or any of the parent directories): .git

9/10/19

I think “git” is not really needed to construct the FPGA code.  Try commenting out the
two lines in red_pitaya_vivado_Z10.tcl that refer to “git”

NOTE:  EVENTUALLY THIS CAUSES TROUBLE.  APPARENTLY THE MAKE FILE needs access to a git created file.  I will put the lines that refer to "git" back in.

That helps.  Now it goes a lot further through the script and dies when it tries to run gmake, which is not on my system.

Script crashes because the command “gmake” is not found.  According to documentation in the installation, in RedPitaya-master/doc/developerGuide/ecosystem/ecosystem.rst, the problem is that Vivado needs gmake.  According to it, I can make a link to “make” so it is called when Vivado calls gmake.

sudo ln -s /usr/bin/make /usr/bin/gmake

Also recommended by ecosystem.rst, add the environment variable $LC_ALL.  If should be set to “C”. (Check by typing in the terminal echo $LC_ALL. On my system it returned a blank.)
So in the terminal, type 
export LC_ALL=C

Also, add this line to the end of .bashrc, so:
Start a new terminal
nano .bashrc
Go to the bottom and add the export LC_ALL=C
^o^x and exit the terminal.

=========  Different approach, Try following the instructions beginning here =========

https://redpitaya.readthedocs.io/en/latest/index.html

Downloaded the image needed for the RedPitaya flash card from here: https://redpitaya.readthedocs.io/en/latest/quickStart/SDcard/SDcard.html

Downloaded file red_pitaya_OS-stable.img.zip
Right click to extract with Archive Manager.  This creates a file called redpitaya_ubuntu_17-11-35_01-sep-2017.img

Purchase 32 Gb Micro-SD and SD adaptor, connect via USB adaptor to this computer.

Run Startup Disk Creator (installed from the Ubuntu Software "store") and put the .iso file onto the Micro-SD

Ethernet address of my RedPitaya is rp-xxxxxx.local/   where xxxxxx is from my board's MAC address. F000BD

So it should be at rp-F000BD.local
YES!  I can connect to it at 
http://rp-f000bd.local/




----------------------------------- Installing stuff needed by the "ecosystem --------------------------
Instructions here: https://redpitaya.readthedocs.io/en/latest/developerGuide/ecosystem/ecosystem.html

# generic dependencies
sudo apt-get install make curl xz-utils
# U-Boot build dependencies
sudo apt-get install libssl-dev device-tree-compiler u-boot-tools
# secure chroot
sudo apt-get install schroot
# QEMU
sudo apt-get install qemu qemu-user qemu-user-static
# 32 bit libraries
sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386 lib32stdc++6

sudo apt-get install python3 python3-pip
sudo pip3 install --upgrade pip
sudo pip3 install meson
sudo apt-get install ninja-build

(Skip Vivado 2917.2 installation, since I have already done it.)

sudo ln -s /usr/bin/make /usr/bin/gmake    (Previously done)

Create a directory for RedPitaya development.

mkdir work
cd work

Get a clone of the RedPitaya git.     (Note that I previously installed the "git" application)

git clone https:   //github.com/RedPitaya/RedPitaya.git       (Takes a little time to download)
cd RedPitaya
source settings.sh                                     #This set environment variables
(Instructions say to do ". settings.sh") but I find the command "source" to be understandable than ".")

mkdir -p dl                        (Make a download cache directory)
export DL=$PWD/dl

Get the ARM Ubuntu root environment:
wget http://downloads.redpitaya.com/downloads/redpitaya_ubuntu_13-14-23_25-sep-2017.tar.gz
(Download takes a few minutes)
sudo chown root:root redpitaya_ubuntu_13-14-23_25-sep-2017.tar.gz
sudo chmod 664 redpitaya_ubuntu_13-14-23_25-sep-2017.tar.gz


Create file /etc/schroot/chroot.d/red-pitaya-ubuntu.conf
sudo nano /etc/schroot/chroot.d/red-pitaya-ubuntu.conf

This what I put in it           (My user name is "halver" and I put the path to the downloaded tar file.)
[red-pitaya-ubuntu]
description=Red Pitaya Debian/Ubuntu OS image
type=file
file=/home/halver/work/RedPitaya/redpitaya_ubuntu_13-14-23_25-sep-2017.tar.gz
users=halver                                               
root-users=halver                                                    
root-groups=root
profile=desktop
personality=linux
preserve-environment=true

See Forum discussion: https://forum.redpitaya.com/viewtopic.php?t=1732

Start "making" the "Ecosystem"      (This runs Vivado in batch mode, building the FPGA takes more than 30 minutes)
make -f Makefile.x86
schroot -c red-pitaya-ubuntu <<-EOL_CHROOT    (I got rid of a blank after the "-". I get a > prompt)
make                                                                                         (Again I get a >)
EOL_CHROOT                                                                         (It begins building a lot of stuff)

make -f Makefile.x86 zip

Apparently the next command, which is not needed starts a shell that pretends to be the environment that runs on the RedPitaya board:
schroot -c red-pitaya-ubuntu                     (To exit, type "exit")

======================= End of Building the "Ecosystem" ==================

At this point I see .bit files and it seems that the "Ecosystem" has been made.  Next task is how to get this stuff into the RedPitaya board.

=============== Detour for my education - Try the LED Button Example ========

This is about messing with the applications running on the RedPitaya board: https://redpitaya.readthedocs.io/en/latest/developerGuide/software/webexamples/addLEDbut.html

Preliminary steps here: https://redpitaya.readthedocs.io/en/latest/developerGuide/software/firstApp.html

First ssh into the RP (RedPitaya) board:
ssh root@rp-f000bd.local                          (The password is "root")

The above crucial info is missing from the documentation!  I found the ssh command here:
https://www.rs-online.com/designspark/red-pitaya-a-quick-guide-for-developers

rw                 (Make the board's file system writable.  Appears to be a command unique to RP)
apt-get install git     (Install git on the RP board)
git config --global user.name "halver"            (My username)
git config --global user.email "pghalverson@gmail.com"

Go to root directory and clone Red Pitaya Project:
cd /root/
git clone https://github.com/RedPitaya/RedPitaya.git    (Takes a few minutes to download)

Now in root I see that there is a new RedPitaya directory and within that Examples and lots of stuff.

Replicate the project structure (explained in 3.2.1.2.3)

cd /opt/redpitaya/www/apps
cp -r /root/RedPitaya/Examples/web-tutorial/1.template ./myFirstApp
cd myFirstApp

(Notice: the name of the application folder defines unique Application ID)

cd info
nano info.json                             This is what I put:
{
    "name": "My First App",
    "version": "0.01",
    "revision": "PETER1",
    "description": "Peters first app."
}

(I'm not bothering to change the icon)
cd ..             (I am now back in /opt/redpitaya/www/apps/myFirstApp)
nano index.html                      Modify the Title line:

(I'm not modifying the css style file)
cd js
nano app.js
    APP.config.app_id = 'myFirstApp';   (Change the app_id to match the directory name)
cd ..    (or cd /opt/redpitaya/www/apps/myFirstApp/  )


Compile the application:
make INSTALL_DIR=/opt/redpitaya

At this point "My First App" shows up on the RP web interface.  (It doesn't do anything, though)

-------------------------  After the preliminaries let's turn on/off LED.  Section 3.2.1.3.1 ---------

I think this sends the 0.94 version of the FPGA bitfile to the FPGA 
cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg

The editing stuff is very unclear.  See this forum discussion:
https://forum.redpitaya.com/viewtopic.php?t=2251

See also this discussion: https://forum.redpitaya.com/viewtopic.php?t=1909
It recommends this:
export LD_LIBRARY_PATH=/opt/redpitaya/lib

Edit index.html in myFirstApp and add to the body, inside 'content', at the end
       
        < div id='led_off'>LED Off

        < div id='led_on'>LED On


(Note that I had to run the "rw" command to be able to save my changes ???)

Edit the css/style.css file and append this stuff:
#led_off {
    color: #F00;
}

#led_on {
    display: none;
    color: #0F0;
}

#led_state {
    margin-top: 20px;
    padding: 10px;
}

Edit js/app.js and insert this stuff:  The code has to be pasted between "$(function() {" and "APP.startApp();".

APP.led_state = false;
   // program checks if led_state button was clicked
   $('#led_state').click(function() {

       // changes local led state
       if (APP.led_state == true){
           $('#led_on').hide();
           $('#led_off').show();
           APP.led_state = false;
       }
       else{
           $('#led_off').hide();
           $('#led_on').show();
           APP.led_state = true;
       }

       // sends current led state to backend
       var local = {};
       local['LED_STATE'] = { value: APP.led_state };
       APP.ws.send(JSON.stringify({ parameters: local }));
   });

Edit src/main.cpp
Insert this line after #include "main.h"
CBooleanParameter ledState("LED_STATE", CBaseParameter::RW, false, 0);

Insert the following code within the {} of OnNewParams
ledState.Update();
if (ledState.Value() == false)
{
    rp_DpinSetState(RP_LED0, RP_LOW);
}
else
{
    rp_DpinSetState(RP_LED0, RP_HIGH);
}

Make the following additions to rp_app_init and rp_app_exit:
int rp_app_init(void)
{
    fprintf(stderr, "Loading template application\n");
    rpApp_Init();
    return 0;
}

int rp_app_exit(void)
{
    fprintf(stderr, "Unloading template application\n");
    rpApp_Release();
    return 0;
}


Note that there is a much simpler (and less informative) LED blink example here
https://redpitaya.readthedocs.io/en/latest/developerGuide/comC.html
and it actually works!

Back to the "real" example in /opt/redpitaya/www/apps/myFirstApp

Go to /opt/redpitaya/www/apps/myFirstApp/src
make INSTALL_DIR=/opt/redpitaya


MAKE for this example:
root@rp-f000bd:~/RedPitaya/Examples/C# make digital_led_blink
cc -g -std=gnu99 -Wall -Werror -I/opt/redpitaya/include  -L/opt/redpitaya/lib digital_led_blink.c -lm -lpthread -lrp -o digital_led_blink
root@rp-f000bd:~/RedPitaya/Examples/C# cat Makefile
CFLAGS  = -g -std=gnu99 -Wall -Werror
CFLAGS += -I/opt/redpitaya/include
LDFLAGS = -L/opt/redpitaya/lib
LDLIBS = -lm -lpthread -lrp

SRCS=$(wildcard *.c)
OBJS=$(SRCS:.c=)

all: $(OBJS)

%.o: %.c
    $(CC) -c $(CFLAGS) $< -o $@

clean:
    $(RM) *.o
    $(RM) $(OBJS)
root@rp-f000bd:~/RedPitaya/Examples/C#

===================================================================
3/15/2020
At this point I gave up on Red Pitaya as a means to learn Verilog or FPGA coding.
Is far too complicated for a beginner like myself.


==================== More links I used to figure this stuff out: ================

https://www.xilinx.com/support/download.html

https://forum.redpitaya.com/viewforum.php?f=14

https://documentation-rp-test.readthedocs.io/en/latest/tutorfpga1.html  **

https://www.zachpfeffer.com/single-post/Installing-20174-Vivado-and-SDK-on-Linux

https://www.knitronics.com/knitronicsblog/installing-vivado-w-sdk-20182-on-ubuntu-1604-lts   **

https://blog.hackster.io/design-flow-for-a-custom-fpga-board-in-vivado-and-petalinux-b998c0b4f9f7

https://www.google.com/search?source=hp&ei=8N1WXcDFKLzB0PEPiMeEqAI&q=install+xilinx+vivado+on+ubuntu&oq=install+xilinx+vivado+on+ubuntu&gs_l=psy-ab.3..0i22i30.2687.12900..13562...1.0..0.204.3077.28j4j1......0....1..gws-wiz.....6..0i308i154j0i131j0.d4UUA5Rhxkk&ved=0ahUKEwjA_aXg64fkAhW8IDQIHYgjASUQ4dUDCAc&uact=5

https://sites.google.com/site/fpgaresearchnepal/research-blog/xilinx-vivado-installation-in-ubuntu-machine

How to find out which libraries are missing from linux that Vivado needs:
https://www.xilinx.com/support/answers/66184.html

Where is Vivado after the Install?
https://forums.xilinx.com/t5/Installation-and-Licensing/Where-is-Vivado-after-the-install/td-p/797898

Where is the license manager?
https://www.xilinx.com/support/answers/36564.html


Here are the first few lines of the file “Xilinx.lic” that was emailed to me from Xilinx,  It was Unix text file, with LF end-of-lines. (This is the default for TextWrangler)
# ----- REMOVE LINES ABOVE HERE --------------------------
#
# This license is valid from Fri Aug 16 04:52:19 UTC 2019.
#
# This is license NODELOCKED to HOSTID=ANY;
# there is no need to run lmgrd for this license.
#
#
# This is a permanent license generated on Fri Aug 16 04:52:19 UTC 2019
INCREMENT SDK xilinxd 2020.08 permanent uncounted A35B03187DBE \