Skip to content

Commit

Permalink
Merge pull request #180 from moragb96/busyweek2022
Browse files Browse the repository at this point in the history
Doc updates
  • Loading branch information
jkocz authored Sep 27, 2022
2 parents 39ec090 + 31cadb1 commit d212082
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 135 deletions.
24 changes: 12 additions & 12 deletions docs/src/Configuring-the-Toolflow.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Configuring the Toolflow

If you have successully installed the toolflow and its dependencies, it is now time to configure the flow to suit your specific environment.
The toolflow needs to know where dependencies like MATLAB and Xilinx tools have been installed. Other site-dependent parameters may also need to be defined.
The toolflow needs to know where dependencies like Matlab and Xilinx tools have been installed. Other site-dependent parameters may also need to be defined.

## The `startsg` script

A startup script -- `startsg` -- is provided as part of the toolflow repository. This script can be used in two ways:

- If _executed_ (i.e. `/path/to/mlib_devel/startsg`): start MATLAB with the correctly defined library paths.
- If _sourced_ (i.e. `source /path/to/mlib_devel/startsg`): configure software paths without starting MATLAB.
- If _executed_ (i.e. `/path/to/mlib_devel/startsg`): start Matlab with the correctly defined library paths.
- If _sourced_ (i.e. `source /path/to/mlib_devel/startsg`): configure software paths without starting Matlab.

The former method is what you should do if you want to start a Simulink design, or open an existing one.

The latter method is useful if you want to run parts of the toolflow outside of MATLAB (eg. `exec_flow.py`) or run Xilinx tools (eg. `vivado`) directly from the command line.
The latter method is useful if you want to run parts of the toolflow outside of Matlab (eg. `exec_flow.py`) or run Xilinx tools (eg. `vivado`) directly from the command line.

### Specifying local details

The `startsg` script is generic. You should not need to modify it.
The script does not require that the Matlab and Xilinx tools be installed in specific locations, but it does require that you provide it with a few details about your local installation. This is done by creating a `startsg.local` file that defines a few key variables needed by `startsg`.
Two essential variables are:

- `MATLAB_PATH` - the path to the directory where MATLAB was installed
- `MATLAB_PATH` - the path to the directory where Matlab was installed
- `XILINX_PATH` - the path to the directory where Xilinx Vivado is installed
- `COMPOSER_PATH` - the path to the directory where the Xilinx Model Compose is installed

Expand All @@ -32,18 +32,18 @@ Optional variables:
- `CASPER_PYTHON_VENV_ON_START` - The path to your Python virtual environment (if one is being used). This will activate the virtual environment on load.

Other variables:
Depending on your operating system, and MATLAB / Xilinx quirks, you may need to specify other generic OS variables. For example, with MATLAB 2018a and Ubuntu 16.04, it is necessary to over-ride the default MATLAB libexpat library to a newer version. To do this you can set the `LD_PRELOAD` variable.
Depending on your operating system, and Matlab / Xilinx quirks, you may need to specify other generic OS variables. For example, with Matlab 2018a and Ubuntu 16.04, it is necessary to over-ride the default Matlab libexpat library to a newer version. To do this you can set the `LD_PRELOAD` variable.

Here is a sample `startsg.local` file:

```bash
export XILINX_PATH=/opt/Xilinx/Vivado/2021.1
export COMPOSER_PATH=/opt/Xilinx/Model_Composer/2021.1
export MATLAB_PATH=/usr/local/MATLAB/R2021a
export MATLAB_PATH=/usr/local/Matlab/R2021a
export PLATFORM=lin64
export JASPER_BACKEND=vivado

# over-ride the MATLAB libexpat version with the OS's one.
# over-ride the Matlab libexpat version with the OS's one.
# Using LD_PRELOAD=${LD_PRELOAD}:"..." rather than just LD_PRELOAD="..."
# ensures that we preserve any other settings already configured
export LD_PRELOAD=${LD_PRELOAD}:"/usr/lib/x86_64-linux-gnu/libexpat.so"
Expand All @@ -58,7 +58,7 @@ If you really want to commit your local configuration file, you can do this, but
### Using `startsg`
By default, executing (or sourcing) the `startsg` script will use variables defined in the configuration file `startsg.local` residing in the same directory as `startsg`.
However, you can use a specific configuration by specifying one as an argument to `startsg`.
This can be useful if you want to store configurations for multiple versions of MATLAB / Xilinx tools.
This can be useful if you want to store configurations for multiple versions of Matlab / Xilinx tools.

For example:
```bash
Expand All @@ -71,9 +71,9 @@ For example:

### Symlink for convenience

Running `startsg` from the `mlib_devel` directory (where it lives) will start MATLAB with `mlib_devel` as the current directory.
Hopefully you store your models somewhere outside `mlib_devel` (which should contain only the CASPER _libraries_), in which case after running `startsg` you will need to navigate within MATLAB to the directory where your model files live.
To avoid this minor annoyance, you can create a symbolic link to `startsg` in your application directory (i.e. where your model file lives). When running `startsg` via this symlink, MATLAB will start up with your application directory as the current directory and also run the optional `casper_startup.m` file if one exists.
Running `startsg` from the `mlib_devel` directory (where it lives) will start Matlab with `mlib_devel` as the current directory.
Hopefully you store your models somewhere outside `mlib_devel` (which should contain only the CASPER _libraries_), in which case after running `startsg` you will need to navigate within Matlab to the directory where your model files live.
To avoid this minor annoyance, you can create a symbolic link to `startsg` in your application directory (i.e. where your model file lives). When running `startsg` via this symlink, Matlab will start up with your application directory as the current directory and also run the optional `casper_startup.m` file if one exists.

To configure such a symlink you should run

Expand Down
35 changes: 17 additions & 18 deletions docs/src/How-to-install-Matlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This section explains How To install Matlab R2013b and R2016b.
4. Terminal: You will now need to backup file “libstdc++.so.6” and link to file “libstdc++.so.6.0.13”. Type in `​cd ~/Installs/Matlab2013b/bin/glnxa64` and press enter.
5. Terminal: Type `sudo mv libstdc++.so.6 libstdc++.so.6_bu` and enter. The file should now be backed up.
6. Terminal: Type `sudo ln -s libstdc++.so.6.0.13 libstdc++.so.6` and press enter. The file should now be linked.
7. Terminal: set the matlab environment variable to call java 7. Type `​export MATLAB_JAVA=”/usr/lib/jvm/java-7-openjdk-amd64/jre` and press enter. Type `​echo $MATLAB_JAVA` to make sure the new path is set.
7. Terminal: set the matlab environment variable to call java 7. Type `​export Matlab_JAVA=”/usr/lib/jvm/java-7-openjdk-amd64/jre` and press enter. Type `​echo $Matlab_JAVA` to make sure the new path is set.
8. Terminal: Make sure the java is executable. Type `​cd ~/Installs/Matlab2013b` and press enter. Type `​chmod +x sys/java/jre/glnxa64/jre/bin/java` and press enter.
9. Terminal: You will now need to invoke the installer. Type `​sudo ./install -javadir /usr/lib/jvm/java-7-openjdk-amd64/jre` at the prompt and press enter.
10. The MathWorks Installer GUI should pop up. Select “Install without using the Internet” and select “Next”.
Expand All @@ -26,35 +26,34 @@ This section explains How To install Matlab R2013b and R2016b.
20. Open another terminal and navigate to the “opt” folder and remember to change user and group to your username with the following command: `sudo chown <username>:<username> Matlab -R`
21. Terminal: Navigate to the “home” folder and remember to change user and group to your username with the following command: `sudo chown <username>:<username> .matlab -R`
22. It will be a good idea to create an Matlab R2013b startup script file on your Desktop with the following lines:
```bash
#!/bin/bash
cd /opt/Matlab/R2013b/bin/
./matlab
```
NB: Make sure the file is executable and that the nautilius documentation
navigator is set to run the script.
```bash
#!/bin/bash
cd /opt/Matlab/R2013b/bin/
./matlab
```
NB: Make sure the file is executable and that the nautilius documentation navigator is set to run the script.

23. Run the script and the Matlab IDE will launch. You can now select the required Matlab m files (*.m) and continue.
24. In order to run the ISE-flow of the CASPER tools, please see [here](https://casper.berkeley.edu/wiki/MSSGE_Setup_with_Xilinx_14.x_and_Matlab_2012b)

## [Current Vivado flow] How To install R2021a

1. Required OS: Ubuntu 20.04 LTS.
2. Download the MATLAB installer [here](https://www.mathworks.com/downloads/). Select the `2021a` install, and the `Download for Linux` option.
2. Download the Matlab installer [here](https://www.mathworks.com/downloads/). Select the `2021a` install, and the `Download for Linux` option.
3. Run the following in the terminal:
```bash
cd /path/to/matlab/download/matlab_R2021a_glnxa64.zip
mkdir matlab_R2021a
unzip matlab_R2021a_glnxa64.zip -d matlab_R2021a
cd matlab_R2021a
sudo ./install
```
4. The above will launch the MathWorks product installer and you will be prompted to sign into your MathWorks account. Sign in, accept the licensing agreement, link your MATLAB license and select your installation path in the prompts that follow.
```bash
cd /path/to/matlab/download/matlab_R2021a_glnxa64.zip
mkdir matlab_R2021a
unzip matlab_R2021a_glnxa64.zip -d matlab_R2021a
cd matlab_R2021a
sudo ./install
```
4. The above will launch the MathWorks product installer and you will be prompted to sign into your MathWorks account. Sign in, accept the licensing agreement, link your Matlab license and select your installation path in the prompts that follow.
5. Select the following toolboxes for installation:

![toolboxes.png](../_static/img/toolboxes.png)

*[Note: issues have been encountered where the Xilinx System Generator MATLAB tool may sit indefinitely while generating sysgen IP. This has tentatively been narrowed down to issues in some MATLAB toolboxes, so if your work requires any toolboxes other than the above, please check against the list further down in [this](https://support.xilinx.com/s/question/0D52E00006vF6FOSA0/model-composer-v20212-matlab-r2021a-gets-stuck-at-initialization-stage-on-ubuntu-20041?language=en_US) for any potential conflicts.]*
*[Note: issues have been encountered where the Xilinx System Generator Matlab tool may sit indefinitely while generating sysgen IP. This has tentatively been narrowed down to issues in some Matlab toolboxes, so if your work requires any toolboxes other than the above, please check against the list further down in [this](https://support.xilinx.com/s/question/0D52E00006vF6FOSA0/model-composer-v20212-matlab-r2021a-gets-stuck-at-initialization-stage-on-ubuntu-20041?language=en_US) for any potential conflicts.]*

6. Click through the rest of the installation, confirm your selections and begin the install.
7. In order to run the Vivado flow of the CASPER tools, please see [here](https://casper-toolflow.readthedocs.io/en/latest/src/Configuring-the-Toolflow.html).
6 changes: 3 additions & 3 deletions docs/src/Installing-the-Toolflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ The main toolflow branches are usually updated once a year. Between updates, cod

## Pre-requisites

1. MATLAB
1. Matlab

MATLAB installation instructions are available [here](https://casper-toolflow.readthedocs.io/en/latest/src/How-to-install-Matlab.html), or, contact whoever manages your software installations.
You will need to install both MATLAB and Simulink.
Matlab installation instructions are available [here](https://casper-toolflow.readthedocs.io/en/latest/src/How-to-install-Matlab.html), or, contact whoever manages your software installations.
You will need to install both Matlab and Simulink.

2. Xilinx Vivado

Expand Down
Loading

0 comments on commit d212082

Please sign in to comment.