How to Setup Development Environment at Home
1. Virtualize if not on Linux (Ubuntu 20.04, 22.04)
The course work assumes you are using Ubuntu Linux operating system. If you are running another operating system, you have the following options for virtualization.
- Winduws Subsystem for Linux (WSL) a lightwight Linux virtualization well integrated with Windows (recommended for Windows users)
- Docker
- Virtual Machine
- Dual Boot
- Don’t virtualize, just use COE Linux Environment
1.1. Windows Subsystem for Linux (WSL)
- Install Ubuntu 22.04 LTS in Windows Subsystem for Linux (WSL) (detailed instructions) by entering the following command on Windows Command Line with Administrator Rights enter:
wsl --install -d Ubuntu-22.04
- Start a new WSL terminal by clicking on Windows Start -> Ubuntu 22.04
- After logging into WSL for the first time, follow the instructions for generic Linux below.
Note to benefit from the speed advantage of WSL 2, use your /home/
Windows applications can be started from the WSL side as well (and will open on Windows). Applications that take file arguments as input magically can even open files that are stored within WSL (/home/…). GTKWave is one example, install it in Windows and display files from WSL side.
Should you need a graphical output from WSL applications please check the WSLDisplay Instructions.
2. Linux (Ubuntu 22.04)
Install base development tools and git with:
sudo apt install build-essential git libyaml-dev pkg-config
2.1. SystemC
Starting from HW2, we will use SystemC. Install SystemC using the packages already available for Ubuntu.
sudo apt install libsystemc-dev
Since SystemC is installed in your system’s default location, additional environment changes are not needed while compiling.
2.1.1 SystemC Debug Symbols
Some debugging will become more convenient with SystemC debug symbols. E.g. when an error message is in SystemC but you want to find out what triggered the error.
First, specify the C/C++ Standard version that fits your environment. In the future, application compilation will need to match this standard version number. Check C++ Standards Support in GCC to match the toolchain you used. For GCC version 11.4.0, on Ubuntu 22.04, the C-std version can be 17
.
Then, go to the base directory where you want SystemC to be installed (it will create a subdir systemc-2.3.3
).
SYSTEMC_VERSION=2.3.3
wget https://www.accellera.org/images/downloads/standards/systemc/systemc-${SYSTEMC_VERSION}.tar.gz
tar xzf systemc-${SYSTEMC_VERSION}.tar.gz
mkdir systemc-${SYSTEMC_VERSION}/objdir
cd systemc-${SYSTEMC_VERSION}/objdir
../configure --enable-debug CXXFLAGS="-std=c++17" CFLAGS="-std=c17"
make -j
make install
Create a setup script to use SystemC with debug symbols (instead of the system installed version without debug symbols).
cd ..
printf '#!/usr/bin/bash\nexport SYSTEMC=%s\nexport SYSTEMC_LIBS=lib-linux64\nexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${SYSTEMC}/${SYSTEMC_LIBS}' `pwd` > setup-systemc
You can then source this environment, compile, and link against the debug SystemC.
source setup-systemc
2.2. Cross-compilation for ARM and Simulation
The tools for cross-compilation and the simulation environment are packaged as an SDK.
- Download the SDK installer binary. Install the SDK by executing the downloaded file. Accept the default installation path or enter a new one (but avoid spaces in the path). For the next steps, we’ll assume it is installed under the default
~/eslsdk
.SDK_INST=esl-glibc-$(uname -m)-esl-image-full-cortexa9t2hf-neon-zedboard-esl-v3-toolchain-2023.1.sh wget https://www1.coe.neu.edu/~esl/eslsdk/zedboard/2023.1/$SDK_INST # add --no-check-certificate if the CA is misconfigured, same as the qemu-esl download. bash ./$SDK_INST -d ~/eslsdk
-
In order to use the SDK, the build environment needs to be activated each time a new shell is started (See Using SDK). Note, however, that the SDK since it is self-contained comes with its own set of many system binaries which it puts in the front of the PATH (so that they are found first). Hence, when the SDK is activated, you may see different binary versions than your original Linux.
To simplify activating the SDK environment, create an alias (thanks to Connor, Spring 22). Update
~/.bashrc
:echo "alias setup-xarm='source ~/eslsdk/environment-setup-cortexa9t2hf-neon-esl-linux-gnueabi && PS1=\"(xarm) \$PS1\"'" >> ~/.bashrc
Then, in any new terminal, you can activate the SDK by:
setup-xarm
-
To start the QEMU environment, run the command
qemu-esl
when the SDK environment is activated.Upon first boot with QEMU, it will ask to download the Linux image to run within QEMU. If downloading fails with the following error:
ERROR: cannot verify www1.coe.neu.edu's certificate, issued by ‘CN=InCommon RSA Server CA 2,O=Internet2,C=US’: Unable to locally verify the issuer's authority. To connect to www1.coe.neu.edu insecurely, use `--no-check-certificate'. ERROR: Download from https://www1.coe.neu.edu/~esl/EECE4534/esl-image-zedboard-esl.wic had problems. Please download manually.
Then, manually download the with this command:
wget -q -O- --no-check-certificate https://www1.coe.neu.edu/~esl/images/esl-image-full-zedboard-esl.wic.tar.gz | tar -xvz ; mv esl-image-full-zedboard-esl.wic $OECORE_TARGET_SYSROOT/esl-image-zedboard-esl.wic
Background: COE is uing a certificate authority that is not accepted by many distributions. In result the certificate check fails, thus the download. The command above uses
--no-check-certificate
, extracts the tar archive through a pipe and moves the extracted file into the correct location.On the next start with
qemu-esl
it will boot our Linxu distribution. To stop QEMU use CTRL-A followed by x (see manual for more info). -
Once QEMU is started, the simulated guest SSH server is reachable (through port forwarding on the host) on localhost port 10022. You could log in through
ssh root@localhost -p 10022
. For easier access, use the following commands to add a profile to your local SSH client configuration:printf "\nHost qemu\n\tHostName localhost\n\tUser root\n\tPort 10022" >> ~/.ssh/config
With this setting connecting to the simulator becomes simpler (once ARM Linux on QEMU is booted ARMXCompSim):
ssh qemu
- Debugging an application on QEMU. TBD.
To uninstall the SDK, just remove the SDK folder with rm -rf <SDK folder>
, remove any modifications in ~/.bashrc
, remove non-needed packages.
Follow the next instructions (ARMXCompSim) on how use the SDK for cross-compilation and simulation.