Post Installation

Important

This documentation is not recommended for new RISC-V projects. New RISC-V projects should reference the newest version of the documentation. Users targeting Arm devices can still use this documentation as their reference.

The newest version of the documentation can be found here: https://mi-v-ecosystem.github.io/SoftConsole-Documentation/

Windows

PolarFire SoC boot mode programming

When using PolarFire SoC boot mode programming tool from within SoftConsole then Program and debug, or Libero has to be installed:

https://www.microsemi.com/product-directory/dev-tools/4970-programming

https://www.microsemi.com/product-directory/design-resources/1750-libero-soc

Renode dependencies

The Renode emulation platform is not a crucial sub-module of SoftConsole and users who are intending to connect to hardware targets only do not need satisfy the Renode’s dependencies.

Note

A administrative account is required to install the .NET framework.

The Renode emulation platform can be used out of the box on many Windows 10 machines. However in a rare case when the .NET Framework is not already installed with Windows 10 then it can be changed easily from within Windows features menu.

digraph {
         graph [rankdir="LR", ranksep=.01, bgcolor=transparent];
         node [fontname="Verdana", fontsize="9", shape="rectangle", width=.1, height=.2, margin=".04,.01", style=filled, fillcolor=white];
         edge [arrowsize=.7];
         "Start button" -> "Type 'Turn Windows features on or off'" -> "Select '.NET Framework 4.8'" -> "Click OK"
     }

On Windows 7 the Microsoft .NET Framework v4.7.2 must be installed first:

https://www.microsoft.com/net/download/dotnet-framework-runtime

Windows firewall

On Windows if there is a firewall in use then the first time that a debug session is run the firewall may prompt that it is blocking OpenOCD, fpServer.exe and/or renode.exe. Allow the firewall to unblock these and save this as the default setting if necessary.

Linux

Many of the commands below require root privileges using su, sudo or by logging in as root.

  1. Many platforms have gcc and make packages installed by default, but it is advisable to make sure that these are installed.

    Note

    Renode is using gcc for compiling just in time models. While make is used by Eclipse CDT to compile projects.

    sudo apt-get install build-essential
    sudo apt-get install libwebkit2gtk-4.0-37 # To enable SoftConsole embedded web-browser
    
    sudo yum groupinstall 'Development Tools'
    
    sudo zypper install -t pattern devel_basis
    
  2. It is recommended that the Linux platform used to run SoftConsole has all available updates installed.

    Note

    It may be possible to install and run SoftConsole on other Linux distributions or versions once the required packages are installed. However, some earlier distributions (for example, CentOS/RHEL 5.x and 6.x) may not work and are not recommended or supported.

Program and Debug PolarFire SoC

If you want to use mpfs programmer you need to install Program and debug, or Libero:

https://www.microsemi.com/product-directory/dev-tools/4970-programming

https://www.microsemi.com/product-directory/design-resources/1750-libero-soc

Renode dependencies

Renode requires Mono framework to run and is provided by mono-project, add its package repository running the following:

sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

sudo apt install mono-devel mono-full
sudo apt install apt-transport-https dirmngr gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/debian stable-buster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update

sudo apt install mono-devel mono-full

Warning

These commands have to be run from root account.

rpmkeys --import "http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x3fa7e0328081bff6a14da29aa6a19b38d3d831ef"
su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'

yum install mono-devel mono-full

Note

For users who wish to use Renode on a unsupported platform, they can on their own risk visit mono project website and follow the instructions.

Writting models for Renode

Users, wishing to write Renode models can use Mono Develop IDE as their C# editor. Renode is made as a Mono Develop project, therefore it should be able to open Renode’s sources without any extra manual steps.

Hardware targets (FlashPro)

Note

When accessing FlashPro devices then native Windows/Linux host machines are recommended as there might be issues with Virtual Machines accessing the FlashPro.

Check that FlashPro can be used without root privileges

Connect a FlashPro5/6 JTAG programmer to a native Linux host machine (this might not work on a VM) and check that it is visible to the operating system:

lsusb
Bus 001 Device 004: ID 1514:2008 Actel
Bus 001 Device 004: ID 1514:2009 Actel
Bus 002 Device 002: ID 1514:200b Actel

If the FlashPro5 (VID=1514 PID=2008) or FlashPro6 (VID=1514 PID=2009) or embedded FlashPro6 Rev B (VID=1514 PID=200b) does not appear then double check that the previous steps were carried out correctly.

Warning

If you will see VID=1514 PID=200a then that is embedded FlashPro6 Rev A and to use it with SoftConsole or Libero, it needs to be upgraded to Rev B.

  • To the JTAG end of the FlashPro connect a suitable board containing a Cortex-M1, SmartFusion or SmartFusion2 Cortex-M3, or RISC-V CPU based SoC design.

    • Make sure you are connecting to the right JTAG connector (in case of Icicle board it’s J23 and not J10, the J10 is used only to reprogram the embedded JTAG)

  • Power the board on.

  • Make sure that the board is configured for FlashPro JTAG debugging of the target CPU (depending on the board and CPU/SoC in use some board switches/jumpers configuration may be required).

  • Make sure that it has correct and matching Libero design (if you are going to connect to Mi-V RV-32 then you need working Mi-V design on the device)

  • Run OpenOCD from the command line to ensure that the debug connection can be established to the target CPU/SoC:

First go to the correct directory (replace <SoftConsole-install-dir> with your installation path):

cd <SoftConsole-install-dir>/openocd/bin

And then execute the following:

./openocd -c "set DEVICE MPFS" -f board/microsemi-riscv.cfg
./openocd -f board/microsemi-riscv.cfg
./openocd -f board/microsemi-cortex-m1.cfg
./openocd -c "set DEVICE M2S090" -f board/microsemi-cortex-m3.cfg

Note

A M2S090 target is needed in the example above.

For example: When using Trenz SMF2000 board, it needs to be changed to M2S010.

The command set DEVICE M2S090 needs to be changed to match the target.

The output should be similar to the following:

Open On-Chip Debugger
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter speed: 6000 kHz
microsemi_flashpro tunnel_jtag_via_ujtag off
trst_only separate trst_push_pull
do_board_reset_init
Info : FlashPro ports available: S201Z7LB20, E200X3ID7
Info : FlashPro port used: S201Z7LB20
Info : clock speed 6000 kHz
Info : JTAG tap: FPGA.tap tap/device found: 0x1f8071cf (mfg: 0x0e7
(GateField), part: 0xf807, ver: 0x1)
microsemi_flashpro tunnel_jtag_via_ujtag on
Info : JTAG tap: FPGA.tap disabled
Info : JTAG tap: FPGA.dap enabled
Info : RISC-V IDCODE = 0x10e31913
Info : Examined RISCV core; XLEN=32, misa=0x40902223
halted at 0x80000b60 due to debug interrupt

Note

Notice from the log above, the following was recognized correctly

  • The FlashPro ports

  • The ID code of the JTAG tap

  • And the RISC-V IDCODE

Open On-Chip Debugger
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter speed: 6000 kHz
microsemi_flashpro tunnel_jtag_via_ujtag off
cortex_m reset_config sysresetreq
trst_only separate trst_push_pull
do_board_reset_init
Info : FlashPro ports available: usb50266
Info : FlashPro port used: usb50266
Info : clock speed 6000 kHz
Info : JTAG tap: FPGA.tap tap/device found: 0x2353a1cf (mfg: 0x0e7
(GateField), part: 0x353a, ver: 0x2)
microsemi_flashpro tunnel_jtag_via_ujtag on
Info : JTAG tap: FPGA.tap disabled
Info : JTAG tap: FPGA.dap enabled
Info : Cortex-M1 IDCODE = 0x4ba00477
Info : FPGA.cpu: hardware has 2 breakpoints, 1 watchpoints
cortex_m auto_bp_type off

Note

Notice from the log above, the following was recognized correctly

  • The FlashPro ports

  • The ID code of the JTAG tap

  • And the Cortex-M1 IDCODE

Open On-Chip Debugger
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
M2S090
Info : only one transport option; autoselect 'jtag'
adapter speed: 6000 kHz
cortex_m reset_config sysresetreq
trst_only separate trst_push_pull
do_board_reset_init
Info : FlashPro ports available: S201Z7LB20, E200X3ID7
Info : FlashPro port used: S201Z7LB20
Info : clock speed 6000 kHz
Info : JTAG tap: M2S090.tap tap/device found: 0x1f8071cf (mfg: 0x0e7
(GateField), part: 0xf807, ver: 0x1)
Info : JTAG tap: M2S090.tap disabled
Info : JTAG tap: M2S090.dap enabled
Info : Cortex-M3 IDCODE = 0x4ba00477
Info : M2S090.cpu: hardware has 6 breakpoints, 4 watchpoints

Note

Notice from the log above, the following was recognized correctly

  • The FlashPro ports

  • The ID code of the JTAG tap

  • And the Cortex-M3 IDCODE

Warning

If seeing output similar to the snippet below (or any other errors excluding documented issues) then that indicates a problem. In that case double check that all the post installation steps have been carried out correctly and that the target hardware/board is correctly configured for debugging of the target CPU/SoC.

Info: FlashPro ports available: none
Info: FlashPro port used: usb
Error: InitializeProgrammer(usb) failed: Can not connect to the programmer

Enabling non-root user to access FlashPro

By default, USB devices are only accessible to users with root privileges. To debug using SoftConsole and FlashPro5/6 as a non-root user some additional steps must be taken.

  • Copy the OpenOCD udev rules file and tell the udev subsystem to load it. This rules file describes all USB JTAG devices supported by OpenOCD to the system and makes them accessible by non-root users (replace <SoftConsole-install-dir> with your installation path):

    cd <SoftConsole-install-dir>/openocd/share/openocd/contrib
    sudo cp 60-openocd.rules /etc/udev/rules.d
    sudo udevadm trigger # Or reboot the PC for the changes to take effect
    

    If /etc/udev/rules.d/60-openocd.rules already exists then make sure to overwrite it with the new version in this release as it contains additional rules that are not included in the earlier version.

    Note

    If SoftConsole is installed alongside other tools which affect the udev rules (for example Libero, Program and Debug), then make sure their rules/scripts do not override the rules from the 60-openocd.rules file.

    In some cases it may be necessary to reboot for the changes to take effect. Some distributions do not create the plugdev group and/or may not add users to it automatically. In that case the plugdev group must be created manually and the user added to the plugdev group.

    sudo groupadd plugdev
    sudo usermod -a -G plugdev <username>
    

    Log out and then log in (or reboot the PC) for the usermod changes to be applied.

Note

If you previously used SoftConsole v4.x or 5.0 and installed the 99-openocd.rules file into /etc/udev/rules.d then you can delete that file as it is now redundant and superseded by 60-openocd.rules. Then run again:

sudo udevadm trigger # Or reboot the PC for the changes to take effect

For all other common issues read the troubleshooting section. Or at least search for the error messages.

Crypto Application Library

The Crypto Application Library (CAL) provides the software API to access User Crypto block on the PolarFire and PolarFire SoC device families.

If license was agreed on installation, then the library is installed in <SC_INSTALL_DIR>/extras/CAL/ path and contains these following folders/files:

  • cal-src crypto sources in an as-is form, user can use these for reference, but they are not a SoftConsole project

  • mpfs-user-crypto-lib a SoftConsole project which after compilation will produce the following files:

    • mpfs-rv64g-user-crypto-lib.a (U54)

    • mpfs-rv64imac-user-crypto-lib.a (E51)

    These files can be used with PolarFire SoC crypto examples located on the GitHub

  • miv-rv32-user-crypto-lib a SoftConsole project which after compilation will produce the following files:

    • miv-rv32imc-user-crypto-lib.a

    • miv-rv32i-user-crypto-lib.a

    These files can be used with Mi-V Soft processor crypto examples located on the GitHub

  • user_guide.pdf Documentation for the CAL API

Note

The crypto-lib projects can be imported as any other generic/regular SoftConsole projects. Users who know how to import projects can skip the rest of the section.

To import in into the workspace do the following:

digraph {
         graph [rankdir="LR", ranksep=.01, bgcolor=transparent];
         node [fontname="Verdana", fontsize="9", shape="rectangle", width=.1, height=.2, margin=".04,.01", style=filled, fillcolor=white];
         edge [arrowsize=.7];
         "SoftConsole Menu toolbar" -> "File" -> "Import" -> "Existing Projects into Workspace"
     }

After Import dialog is showed do following:

digraph {
         graph [rankdir="LR", ranksep=.01, bgcolor=transparent];
         node [fontname="Verdana", fontsize="9", shape="rectangle", width=.1, height=.2, margin=".04,.01", style=filled, fillcolor=white];
         edge [arrowsize=.7];
         "Select root directory" -> "Browse..." -> "find and select the 'miv-rv32-user-crypto-lib' folder" -> "Open"
     }

If the dialog was left in the default state (as provided from a fresh workspace) and the project was not imported already into the workspace, then clicking the Finish button will import it correctly into the workspace.