@ -1,93 +1,202 @@
---
author: Penguin
date: 06/19/23
title: PolarFire SoC FPGA
---
# Table of Contents
# About the Board
1. [About the Board ](#orgd72d6fe )
< img src = "./doc/img/PolarFire-Board.png"
2. [Creating a Bootable Yocto Linux Image ](#org320b6b1 )
style="width:50.0%;height:50.0%" />
1. [Create a workspace (OPTIONAL) ](#org3ac88ae )
2. [Update the repo workspace ](#orgf613432 )
3. [Set up the Bitbake environment ](#org5551fb8 )
4. [Building Board Disk Image ](#orge48b62d )
1. [Building a Linux Image with a root file system (RootFS) ](#org260c449 )
2. [Building a RAM-based Root Filestystem ](#org920972e )
3. [Building a Linux Image for an external QSPI flash memory ](#org31f047f )
4. [Flashing an SD Card ](#org0ce15e7 )
3. [References ](#org47ba498 )
# Installing Libero (via portage)
# Installing Libero (MANUAL)
< a id = "orgd72d6fe" > < / a >
## Prerequisites
# About the Board
## Installation Process
![img ](./doc/img/PolarFire-Board.png )
``` bash
sudo mkdir -p /opt/Microchip
sudo chown $USER:$USER /opt/Microchip
unzip
```
Installer Directions:
< a id = "org320b6b1" > < / a >
- Install Directory: /opt/Microchip/Libero_SoC_v2023.1
- Common Directory: /opt/Microchip/common
- Install Set: Everything
# Creating a Bootable Yocto Linux Image
## Post-Install
We have two options: Create a new workspace, or we can use this repo as a workspace because this repo is my working workspace.
``` bash
sudo /opt/Microchip/Libero_SoC_v2023.1/Logs/req_to_install.sh
```
### Installing FlashPro Drivers
< a id = "org3ac88ae" > < / a >
You need to have the FlashPro device to install these, so ignore this if
you don't have a FlashPro device.
## Create a workspace (OPTIONAL)
1. FlashPro 5
mkdir yocto-dev & & cd yocto-dev
``` bash
repo init -u https://github.com/polarfire-soc/polarfire-soc-yocto-manifests.git -b main -m default.xml
sudo /opt/Microchip/Libero_SoC_v2023.1/Libero/bin/udev_install
```
2. FlashPro 6
``` bash
sudo /opt/Microchip/Libero_SoC_v2023.1/Libero/bin/fp6_env_install
```
### Installing Your License
You can register for a Microchip and request a year-long evaluation
license here:
< https: / / www . microchipdirect . com / login ? redirectTo = %2Ffpga-software-products >
You'll want to get the **LIB-PL-MACID-F-EVAL** license, which is a
floating linux license. If you're on windows, just get whatever license
works for you.
``` bash
mkdir -p /opt/Microchip/Libero_SoC_v2023.1/license
cp /path/to/license /opt/Microchip/Libero_SoC_v2023/license
```
### Installing the Licensing Daemon
< a id = "orgf613432" > < / a >
``` bash
# install lsb-core
sudo apt install lsb-core
sudo cp scripts/libero-license.service /etc/systemd/user
```
# Install Yocto Ecosystem
## Prerequisites
``` bash
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat libsdl1.2-dev xterm bmap-utils python3-distutils repo
```
## Create the Yocto Workspace
``` bash
mkdir yocto-dev & & cd yocto-dev
repo init -u https://github.com/polarfire-soc/polarfire-soc-yocto-manifests.git -b main -m default.xml
```
## Update the repo workspace
## Update the repo workspace
``` bash
repo sync
repo sync
repo rebase
repo rebase
```
< a id = "org5551fb8" > < / a >
## Setup the Bitbake environment
## Setup the Bitbake environment
``` bash
. ./meta-polarfire-soc-yocto-bsp/polarfire-soc_yocto_setup.sh
. ./meta-polarfire-soc-yocto-bsp/polarfire-soc_yocto_setup.sh
```
## Optimize your build environment
Yocto builds take a very long time. We can optimize this.
``` bash
mkdir -p ${HOME}/.local/share/yocto/downloads
mkdir -p ${HOME}/.local/share/yocto/sstate-cache
mkdir -p ${HOME}/.local/share/yocto/persistent
cd < project_root > /build/conf/
echo '
BB_NUMBER_THREADS ?= "${@oe.utils.cpu_count()}"
PARALLEL_MAKE ?= "-j ${@oe.utils.cpu_count() - 1}"
DL_DIR = "${HOME}/.local/share/yocto/downloads"
SSTATE_DIR = "${HOME}/.local/share/yocto/sstate-cache"
PERSISTENT_DIR=${HOME/.local/share/yocto/persistent
SOURCE_MIRROR_URL ?= "file://${HOME}/.local/share/yocto/downloads"
INHERIT += "own-mirrors"
BB_GENERATE_MIRROR_TARBALLS = "1"
# uncomment to test sources
# BB_NO_NETWORK = "1"
# remove static deps
STATICLIBCONF = "--disable-static"
DISABLE_STATIC:pn-openssl = ""
DISABLE_STATIC:pn-openssl-native = ""
DISABLE_STATIC:pn-nativesdk-openssl = ""
DISABLE_STATIC:pn-libtalloc = ""
EXTRA_OECONF += "${STATICLIBCONF}"
' >> local.conf
```
## Build the Disk Image
``` bash
cd $PROOT
bitbake mpfs-dev-cli
```
# References
< a id = "orge48b62d" > < / a >
[PolarFire Yocto
Github](https://github.com/polarfire-soc/meta-polarfire-soc-yocto-bsp)
## Building Board Disk Image
# Creating a Bootable Yocto Linux Image
We have two options: Create a new workspace, or we can use this repo as
a workspace because this repo is my working workspace.
< a id = "org260c449" > < / a >
## Create a workspace (OPTIONAL)
### Building a Linux Image with a root file system (RootFS)
mkdir yocto-dev & & cd yocto-dev
repo init -u https://github.com/polarfire-soc/polarfire-soc-yocto-manifests.git -b main -m default.xml
MACHINE=icicle-kit-es bitbake mpfs-dev-cli
## Update the repo workspace
``` bash
repo sync
repo rebase
```
< a id = "org920972e" > < / a >
## Set up the Bitbake environment
### Building a RAM-based Root Filestystem
``` bash
. ./meta-polarfire-soc-yocto-bsp/polarfire-soc_yocto_setup.sh
```
MACHINE=icicle-kit-es bitbake -R conf/initramfs.conf mpfs-initramfs-image
## Building Board Disk I mage
### Building a Linux Image with a root file system (RootFS)
< a id = "org31f047f" > < / a >
``` bash
MACHINE=icicle-kit-es bitbake mpfs-dev-cli
```
### Building a Linux Image for an external QSPI flash memory
### Building a RAM-based Root Filestystem
``` bash
MACHINE=icicle-kit-es bitbake -R conf/initramfs.conf mpfs-initramfs-image
```
< a id = "org0ce15e7" > < / a >
### Building a Linux Image for an external QSPI flash memory
### Flashing an SD Card
### Flashing an SD Card
``` bash
zcat build/tmp-glibc/deploy/images/icicle-kit-es/mpfs-dev-cli-icicle-kit-es.wic.gz | sudo dd of=/dev/sdX bs=4096 iflag=fullblock oflag=direct conv=fsync status=progress
zcat build/tmp-glibc/deploy/images/icicle-kit-es/mpfs-dev-cli-icicle-kit-es.wic.gz | sudo dd of=/dev/sdX bs=4096 iflag=fullblock oflag=direct conv=fsync status=progress
```
< a id = "org47ba498" > < / a >
# References
# References
1. [PolarFire SoC Yocto ](https://github.com/polarfire-soc/meta-polarfire-soc-yocto-bsp )
[PolarFire SoC
Yocto](https://github.com/polarfire-soc/meta-polarfire-soc-yocto-bsp)
**\*\***
**\*\***