-
Notifications
You must be signed in to change notification settings - Fork 7
2Prepare
Using a Zynq or an SoCFGPA means dealing with the FPGA part, but also with the CPU part. Thus, before configuring the oscimpDigital environment, the operating system must be configured for the targeted board, including by providing a cross-compiler to build drivers, libraries and userspace applications. See the buildroot page for detailed information about this topic.
Downloading this repository and its submodules in a single command is achieved with
git clone --recursive https://github.com/oscimp/oscimpDigital.git
which can be split in the following individual commands
git clone https://github.com/oscimp/oscimpDigital.git
cd oscimpDigital
git submodule init
git submodule update
to 1/ clone oscimpDigital and 2/ add submodule contents.
If later the repository is updated, the local copy of the repositories can be updated as well using the following commands
git pull
git submodule update
All environment variable information is provided by the settings.sh.sample
bash script. This file provides all used env variables and needs to be tuned according to the local setup.
# define the board being used. Must be adapted to either:
# plutosdr for the Xilinx Zynq-based ADI PlutoSDR board
# redpitaya for the Xilinx Zynq-based 14-bit legacy Red Pitaya board
# redpitaya16 for the new Xilinx Zynq-based 16-bit Red Pitaya board
# de0nansoc for the Altera/Intel Terrasic DE0Nano SoC
export BOARD_NAME=
#define Buildroot location
export BR_DIR=
# define target IP
# 192.168.0.10 for RedPitaya
# 192.168.2.1 for PlutoSDR
export IP=
#only mandatory for plutosdr
#export ADI_HDL_DIR=
# define where to install apps, drivers, etc
export OSCIMP_DIGITAL_NFS=/nfs
OSCIMP_DIGITAL=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
source $OSCIMP_DIGITAL/app/setenv.sh # defines $OSCIMP_DIGITAL_APP
source $OSCIMP_DIGITAL/fpga_ip/setenv.sh # defines OSCIMP_DIGITAL_IP
source $OSCIMP_DIGITAL/lib/setenv.sh # OSCIMP_DIGITAL_LIB
source $OSCIMP_DIGITAL/linux_driver/setenv.sh
export PATH=$PATH:$OSCIMP_DIGITAL_APP/tools/module_generator:$OSCIMP_DIGITAL_IP/tools/
# /!\ locale settings for Vivado (uses '.' as separator, as opposed to the French ',')
export LANG=en_US.UTF-8
# /!\ check /etc/locale.gen: en_US.UTF-8 UTF-8 must be UNcommented. If it was commented:
# remove comment and execute as root locale-gen
We recommend you to make a copy of this file and name it settings.sh
and to modify this file instead of the settings.sh.sample
to keep the empty file in case you need to make a new configuration.
Most important information are:
- BOARD_NAME used to determine target board and adapt the behavior of Makefiles
- BR_DIR variable provides the path to the buildroot directory. Mandatory to build drivers, library and userspace applications.
Additional variables are less important but must defined:
- NFS_DIR: a solution to share bitstream and binaries, is to use NFS (Network File System. By using this variable, a directory located on the host system (personal computer) will be shared with the target (embedded) board. This directory (and sub-directories) will be available from your target platform.
For example for the Redpitaya STEM-125 14 board, the sample file is copied as
settings.sh
in the oscimpDigital/
directory and filled with relevant information:
BOARD_NAME='redpitaya'
BR_DIR=~/git/buildroot-2020.11.1/
resulting in the following settings.sh
file:
export BOARD_NAME='redpitaya'
export BR_DIR='~/git/buildroot-2020.11.1'
export IP=192.168.0.10
export OSCIMP_DIGITAL_NFS='/nfs'
OSCIMP_DIGITAL=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
source $OSCIMP_DIGITAL/app/setenv.sh # defines $OSCIMP_DIGITAL_APP
source $OSCIMP_DIGITAL/fpga_ip/setenv.sh # defines OSCIMP_DIGITAL_IP
source $OSCIMP_DIGITAL/lib/setenv.sh # OSCIMP_DIGITAL_LIB
source $OSCIMP_DIGITAL/linux_driver/setenv.sh
export PATH=$PATH:$OSCIMP_DIGITAL_APP/tools/module_generator:$OSCIMP_DIGITAL_IP/tools/
# /!\ locale settings for Vivado (uses '.' as separator, as opposed to the French ',')
export LANG=en_US.UTF-8
# /!\ check /etc/locale.gen: en_US.UTF-8 UTF-8 must be UNcommented. If it was commented:
# remove comment and execute as root locale-gen
Make sure to always source this file every time and in each terminal you want to use OscimpDigital in, to load the variables in your shell :
source oscimpDigital/settings.sh
Libraries must be compiled after cloning the repository or updating the local copy. Go to the lib sub-directory to build libraries with :
cd lib
make
Two files are now added to the directory, one with a .so
extension, the other with a .a
extension
There are two solutions to install/reinstall libraries :
- before SD card flash
Run this command in the oscimpDigital/lib/ directory :
make install
Then, in the buildroot root directory re-run make
to update the sdcard.img
and flash the disk image on the SD card.
- at runtime
First, make sure you can access to the target board from the host computer through ssh. Then run the command :
make install_ssh
It will ask for the root password of the target board (root
by default), and then it will copy the .so
file in the /usr/lib/
directory of the target board.
As for libraries, you need to have all required shell variables. Ensure that you used the source settings.sh
with the terminal you are using. Then, we will have to make sure the buildroot toolchain path is included in your $PATH. If not,
export PATH=/somewhere/output/host/usr/bin:$PATH
where somewhere
is the location of the buildroot, installed as described at https://github.com/trabucayre/redpitaya.
Then go in the linux_driver
directory :
cd linux_driver
And execute :
make install_nfsdir
This command will build all drivers and install them in directory called modules
below the directory defined by $OSCIMP_DIGITAL_NFS/$BOARD_NAME
.
module_generator
is a necessary tool to handle the CPU part of a project (see gettingStarted for example). This tool is available in oscimpDigital/app/tools/module_generator. In order to build it, make sure that the dependencies specified in the README of the module are installed on your system, then go into the directory oscimpDigital/app/tools/module_generator
and run make install
to build it. More information on how to build it can be found in the README.
Console (command line interface) access to the board can be granted through a serial port or by using ssh:
- for the first case a tool like minicom, screen or kermit must be installed on the host computer
- for the second case openssh must be installed on the host computer
The default way to access bistreams, applications and drivers is through a NFS (Network File System) shared directory. First nfs-kernel-server must be installed on the host computer.
As root, run :
apt install nfs-kernel-server nfs-common
mkdir /nfs
To have right access to /nfs
and subdirectories owner must be changed (as root):
chown -R $(id -u).$(id -g) /nfs
Then /etc/exports must be configured to allow for the /nfs
directory to be mounted on the remote
board with something like
/nfs *(rw,no_root_squash,sync,no_subtree_check)
This configuration will allow any remote computer to mount the host /nfs
. The NFS configuration can be tailored
to a more secure configuration with
/nfs 192.168.0.10(rw,no_root_squash,sync)
for a single target. Alternatively, a range of ip can be given acces to your nfs server with a netmask:
/nfs 192.168.0.10/255.255.255.0(rw,no_root_squash,sync)
On the target board, mounting the host /nfs
directory is automated with by adding at the end of the
/etc/fstab
file of the board OS (assuming that the host computer IP address is 192.168.0.1):
192.168.0.1:/nfs /usr/local nfs defaults,noauto,nolock 0 0
or by uncommenting this line which already exists on the Redpitaya Buildroot overlay. Thanks to such a configuration, mounting the NFS directory on the target board can be done by running this command on the target board :
mount /usr/local