Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • beaglev-fire/gateware
  • jkridner/gateware
  • blavin3/gateware
  • cyril-jean/my-lovely-gateware
  • RobertCNelson/gateware
  • Aven/aven-gateware
  • coaic/gateware
  • aloveday/tdogg-gateware
  • cshegedus/my-lovely-gateware
  • Seth/fire-gate
  • Platima/snakeyware
  • lorforlinux/gpio-leds-gateware
  • jonsmc/test-gateware
  • johnnyw66/gateware
  • jkridner/gateware-serv-on-fire
  • NachtSpyder04/gateware
  • jkridner/snakeyware
  • cyril-jean/gateware-ci-tests-rework
  • malkowkiorg/mppgateware
  • gsoc/2024/riscv-io-core
  • cyril-jean/gateware-custom-test
  • cyril-jean/gateware-ci-deploy-fix
  • turaib/gateware
  • bustedwing1/gateware-fork
  • fred27/fred-gateware
  • rexxar/beaglevfire-gateway
  • cyril-jean/gateware-overlays-fix
  • Lianghao/my-lovely-gateware
  • himanshuk/gateware
  • ahmedf/my-lovely-gateware
  • Pronadeep2024/my-new-gateware
  • venkatmakam/gateware-test
  • jcm/my-cute-gateware
  • AdrianHerCoss/adrian-s-gateware
  • cyril-jean/gateware-maintenance
  • mariaukanwa/exampleware
  • trottpb/camera-display-gateware
  • cdsteinkuehler/gateware
  • kikuhobby/beagle-v-fire-gateware
  • cyril-jean/gateware-hub-75
  • jennifermah76/gateware
  • DarrenWenn/hub-75
  • AndyCap/gateware-test-1
  • vauban-xyz/gateware-xyz-uav
  • sbss1/my-lovely-gateware
  • Ninicoco/snakeyware
  • epenguin/e-penguins-gateware
  • MikeJames2024/gateware
  • superchamp234/pwm-demo-gateware
  • Roger18/riscv-io-core
  • superchamp234/comms-cape-gateware
  • CLappin/gateware
  • superchamp234/mem-access-gateware
  • superchamp234/miv-gateware
  • superchamp234/lsram-application
  • j-a-s-22/my-lovely-gateware
  • samjeffery/sam-jeffery-snakey
  • prabritb/blinkled
  • TestOLab/blinky-test
  • KG/gateware-tutorial
  • lranders/lsram-application
  • lranders/gateware
  • usernamenaijan/my-gateware
  • superchamp234/simple-lsram
  • patsv99/patsv-99-can-gateware
  • liv_heaton/my-lovely-gateware
  • wcookiii/misc-polar1
  • burkeb543/gateware
  • kubeks57/risc
  • DmitriLyalikov/beagle-v-gateware-odin
  • devadatta/gatewaretest
  • foxof/gateware
  • prajnark/gateware
  • jfkfhhfj/gateware-at
  • prauby/gateware-beagle-v-fire
  • lranders/gateware-tutorial
  • ashuk-cloudsci/amass-1
  • msaldana/gateware
  • crispc85/pam-gateware-test
  • marco_ferreira/my-lovely-gateware
  • iriszero/gateware
  • flxzt/socfpga-course-beaglev-fire-gateware
  • willlu/gateware-willlu
  • spmishra/gateware
  • amitra/gateware
  • codechaser/lsram-dma-gateware
  • Luciana.lm11/testing-gateware
  • lranders/riscv-io-core
  • mars17/goldenware
  • inigoexai/gateware
  • hardi8/gatewaregalvo
91 results
Show changes
Commits on Source (77)
Showing
with 1030 additions and 12 deletions
stages: # List of stages for jobs, and their order of execution
- build
- deploy
build-job: # This job runs in the build stage, which runs first.
stage: build
tags:
- libero-soc-v2023.2
variables:
BUILD_OPTIONS_DIRECTORY: "custom-fpga-design"
BRANCH_UNDER_TEST: "develop"
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop")
variables:
BUILD_OPTIONS_DIRECTORY: "build-options"
REPO_UNDER_TEST: $CI_MERGE_REQUEST_SOURCE_PROJECT_URL
BRANCH_UNDER_TEST: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
- if: $CI_PIPELINE_SOURCE == "push"
variables:
BUILD_OPTIONS_DIRECTORY: "custom-fpga-design"
REPO_UNDER_TEST: $CI_PROJECT_URL
BRANCH_UNDER_TEST: $CI_COMMIT_BRANCH
script:
- echo "Compiling the code..."
- echo "Cloning the tester and gateware..."
- export
- source ~/Microchip/Microchip-FPGA-Tools-Setup/setup-microchip-tools.sh
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@git.beagleboard.org/beaglev-fire/gateware-builds-tester.git
- git clone https://git.beagleboard.org/beaglev-fire/gateware-builds-tester.git
- cd gateware-builds-tester
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@git.beagleboard.org/beaglev-fire/bitstream-builder.git -b develop
- python3 bitstream-builds-tester.py ci gateware "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
- git clone $REPO_UNDER_TEST -b $BRANCH_UNDER_TEST
- echo "Building the gateware..."
- python3 bitstream-builds-tester.py $REPO_UNDER_TEST $BUILD_OPTIONS_DIRECTORY
- echo "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME"
- echo "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
- echo "Compile complete."
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
artifacts:
when: always
when: on_success
paths:
- gateware-builds-tester/artifacts/tests_report.xml
- gateware-builds-tester/artifacts.zip
- gateware-builds-tester/artifacts/
- gateware-builds-tester/builds/*/work/libero/synthesis/
reports:
junit: gateware-builds-tester/artifacts/tests_report.xml
pages:
image: robertcnelson/beagle-devscripts-ubuntu-23.04-riscv64:latest
# https://git.beagleboard.org/beagleboard/ci-docker-images
stage: deploy
tags:
- docker-riscv64-ci
variables:
BUILD_OPTIONS_DIRECTORY: "custom-fpga-design"
BRANCH_UNDER_TEST: "develop"
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop")
variables:
BUILD_OPTIONS_DIRECTORY: "build-options"
REPO_UNDER_TEST: $CI_MERGE_REQUEST_SOURCE_PROJECT_URL
BRANCH_UNDER_TEST: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
DEBIAN_CHANGELOG_PKG: "bbb.io-gateware"
DEBIAN_SRC: "debian"
- if: $CI_PIPELINE_SOURCE == "push"
variables:
BUILD_OPTIONS_DIRECTORY: "custom-fpga-design"
REPO_UNDER_TEST: $CI_PROJECT_URL
BRANCH_UNDER_TEST: $CI_COMMIT_BRANCH
DEBIAN_CHANGELOG_PKG: "bbb.io-gateware-my-custom-fpga-design"
DEBIAN_SRC: "debian-custom"
script:
- rm -rf ./src/ || true
- mkdir -p ./src/debian/ || true
- rsync -av ./$DEBIAN_SRC/* ./src/debian/
- mkdir -p ./src/gateware-builds-tester || true
- rsync -av ./gateware-builds-tester/* ./src/gateware-builds-tester/
- echo "$DEBIAN_CHANGELOG_PKG (1.$(LANG=C date +%Y%m%d).0-0~lunar) lunar; urgency=low" > ./src/debian/changelog
- echo "" >> ./src/debian/changelog
- echo " * ci build of $CI_PROJECT_URL" >> ./src/debian/changelog
- echo "" >> ./src/debian/changelog
- echo " -- $GITLAB_USER_NAME <$GITLAB_USER_EMAIL> $(LANG=C date -R)" >> ./src/debian/changelog
- echo "" >> ./src/debian/changelog
- cat ./src/debian/changelog
- cd ./src/ ; debuild -b -us -uc ; cd ../
- mkdir -p ./public/dists/stable/main/binary-riscv64/
- mkdir -p ./public/pool
- cp -v *.deb ./public/pool/ || true
- cp -v *.build ./public/ || true
- cp -v *.buildinfo ./public/ || true
- cd ./public ; dpkg-scanpackages ./pool/ | gzip > ./dists/stable/main/binary-riscv64/Packages.gz || true ; cd ../
- apindex public
artifacts:
when: on_success
paths:
- public
MIT License
Copyright (c) 2022 vauban353
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# BeagleV Fire Gateware Builder
## Introduction
The BeagleV Fire gateware builder is a Python script that builds both the PolarFire SoC HSS bootloader and Libero FPGA project into a single programming bitstream. It uses a list of repositories/branches specifying the configuration of the BeagleV Fire to build.
## Prerequisites
### Python libraries
The following Python libraries are used:
- GitPython
- PyYAML
```
pip3 install gitpython
pip3 install pyyaml
```
### Microchip Tools
The SoftConsole and Libero tools from Microchip are required by the bitstream builder.
The following environment variables are required for the bitstream builder to use the Microchip tools:
- SC_INSTALL_DIR
- FPGENPROG
- LIBERO_INSTALL_DIR
- LM_LICENSE_FILE
An example script for setting up the environment is available [here](https://git.beagleboard.org/beaglev-fire/Microchip-FPGA-Tools-Setup).
## Usage
```
python3 build-bitstream.py <YAML Configuration File>
```
For example, the following command will be build the default beagleV Fire configuration:
```
python3 build-bitstream.py ./build-options/default.yaml
```
### YAML Configuration Files
The YAML configuration files are located in the "build-options" directory.
| Configuration File | Description |
| ------------------ | ---------------------------------------------------------- |
| default.yaml | Default gateware including default cape and M.2 interface. |
| minimal.yaml | Minimal Linux system including Ethernet. No FPGA gateware. |
| robotics.yaml | Similar to default but supporting the Robotics cape. |
## Supported Platforms
The BeagleV Fire gateware builder has been tested on Ubuntu 20.04.
## Microchip bitstream-builder
The BeagleV-Fire gateware builder is derived from [Microchip's bitstream-builder ](https://github.com/polarfire-soc/icicle-kit-minimal-bring-up-design-bitstream-builder). We recommend that you use either of these scripts as a starting point for your own PolarFire SoC FPGA designs as opposed to using Libero in isolation.
\ No newline at end of file
# The BeagleV Fire Bitstream Builder is released under the following software license:
# Copyright 2021 Microchip Corporation.
# SPDX-License-Identifier: MIT
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# The BeagleV Fire Bitstream Builder is an evolution of the Microchip
# Bitstream Builder available from:
# https://github.com/polarfire-soc/icicle-kit-minimal-bring-up-design-bitstream-builder
#
import argparse
import io
import os
import platform
import shutil
import zipfile
import git
import requests
import yaml
import sys
import subprocess
import datetime
from generate_gateware_overlays import generate_gateware_overlays
def check_native_platform():
if os.path.isfile('/.dockerenv'):
return ""
else:
return " --native"
# Parse command line arguments and set tool locations
def parse_arguments():
global libero
global mss_configurator
global softconsole_headless
global programming
global update
global yaml_input_file
# Initialize parser
parser = argparse.ArgumentParser()
parser.add_argument('Path',
metavar='path',
type=str,
help='Path to the YAML file describing the list of sources used to build the bitstream.')
# Read arguments from command line
args = parser.parse_args()
yaml_input_file_arg = args.Path
if not os.path.isfile(yaml_input_file_arg):
print("\r\n!!! The path specified for the YAML input file does not exist !!!\r\n")
parser.print_help()
sys.exit()
yaml_input_file = os.path.abspath(yaml_input_file_arg)
# Tool call variables - these are the names of the tools to run which will be called from os.system.
# Full paths could be used here instead of assuming tools are in PATH
libero = "libero"
mss_configurator = "pfsoc_mss"
softconsole_headless = "softconsole-headless"
update = False
programming = False
# Checks to see if all of the required tools are installed and present in path, if a needed tool isn't available the script will exit
def check_tool_status():
if shutil.which("libero") is None:
print("Error: libero not found in path")
exit()
if shutil.which("pfsoc_mss") is None:
print("Error: polarfire soc mss configurator not found in path")
exit()
if os.environ.get('SC_INSTALL_DIR') is None:
print(
"Error: SC_INSTALL_DIR environment variable not set, please set this variable and point it to the "
"appropriate SoftConsole installation directory to run this script")
exit()
if os.environ.get('FPGENPROG') is None:
print(
"Error: FPGENPROG environment variable not set, please set this variable and point it to the appropriate "
"FPGENPROG executable to run this script")
exit()
path = os.environ["PATH"]
if "riscv-unknown-elf-gcc" not in path:
print(
"The path to the RISC-V toolchain needs to be set in PATH to run this script")
exit()
if platform.system() == "Linux" or platform.system() == "Linux2":
if shutil.which("dtc") is None:
print("Error: dtc (device-tree-compiler) not found in path")
exit()
# Creates required folders and removes artifacts before beginning
def init_workspace():
print("================================================================================")
print(" Initialize workspace")
print("================================================================================\r\n", flush=True)
# Create the sources folder to clone into if it doesn't exist (any existing source folders are handled in the
# clone_sources function)
# if not os.path.exists("./sources"):
# os.mkdir("./sources")
# Delete the work folder and its content if it exists.
if os.path.exists("./work"):
shutil.rmtree('./work')
# Create each output subdirectory
os.mkdir("./work")
os.mkdir("./work/MSS")
os.mkdir("./work/HSS")
# Delete the bitstream folder if it exists to remove previously created bitstreams.
if os.path.exists("./bitstream"):
shutil.rmtree('./bitstream')
# Create the bitstream folder structure. This is where the created bitstreams will be generated. There might be
# multiple subdirectories there to provided different programming options.
os.mkdir("./bitstream")
os.mkdir("./bitstream/FlashProExpress")
os.mkdir("./bitstream/LinuxProgramming")
print(" The FlashPro Express bitstream programming job files will be stored in")
print(" directory: ./bitstream/FlashProExpress\r\n", flush=True)
# clones the sources specified in the sources.yaml file
def clone_sources(source_list):
print("================================================================================")
print(" Clone sources")
print("================================================================================\r\n", flush=True)
source_directories = {}
with open(source_list) as f: # open the yaml file passed as an arg
data = yaml.load(f, Loader=yaml.FullLoader)
keys = data.keys()
# each entry in the file is a source
for source in keys:
# Check if this is a git source
if "git" in data.get(source).get("type"):
# Check if we've already cloned the repo
if os.path.exists(os.path.join("./sources", source)):
repo = git.Repo.init(os.path.join("./sources", source)) # set up repo
repo.git.checkout(data.get(source).get("branch")) # checkout the branch from the yaml file
repo.remotes.origin.pull() # pull changes
# We don't already have the repo, clone it
else:
repo = git.Repo.clone_from(data.get(source).get("link"), os.path.join("./sources", source),
branch=data.get(source).get("branch"))
# check if a specific commit from this branch is required
if "commit" in data.get(source):
repo.git.checkout(data.get(source).get("commit")) # check out a specific commit
# Check if this is source is a url to a zip
elif "zip" in data.get(source).get("type"):
# if we already have a source of the same name delete it - can't check versions
if os.path.exists(os.path.join("./sources", source)):
shutil.rmtree(os.path.join("./sources", source))
r = requests.get(data.get(source).get("link")) # download zip
z = zipfile.ZipFile(io.BytesIO(r.content)) # extract zip
z.extractall(os.path.join("./sources", source)) # save contents
source_directories[source] = os.path.join("./sources",
source) # Generate a dictionary of all of the sources that were cloned
f.close()
# return the dictionary of sources
return source_directories
# Calls the MSS Configurator and generate an MSS configuration in a directory based on a cfg file
def make_mss_config(mss_configurator, config_file, output_dir):
print("================================================================================")
print(" Generating MSS configuration")
print("================================================================================\r\n", flush=True)
os.system(mss_configurator + ' -GENERATE -CONFIGURATION_FILE:' + config_file + ' -OUTPUT_DIR:' + output_dir)
# Builds the HSS using a pre-defined config file using SoftConsole in headless mode
def make_hss(hss_source, yaml_input_file):
print("================================================================================")
print(" Build Hart Software Services (HSS)")
print("================================================================================\r\n", flush=True)
# Retrieve build target info from YAML file
with open(yaml_input_file) as f: # open the yaml file passed as an arg
data = yaml.load(f, Loader=yaml.FullLoader)
try:
target_board = data.get("HSS").get("board")
except:
target_board = "bvf"
f.close()
print("Target board: " + target_board)
# Update XML in HSS project
XML_file = "boards/" + target_board + "/soc_fpga_design/xml/PF_SOC_MSS_mss_cfg.xml"
XML_file_abs_path = os.path.join(hss_source, XML_file)
try:
os.remove(XML_file_abs_path)
except:
print("HSS target board does not have a default MSS XML configuration - not a problem.", flush=True)
shutil.copyfile("./work/MSS/PF_SOC_MSS_mss_cfg.xml", XML_file_abs_path)
# Select HSS configuration to build
def_config_file = os.path.join(hss_source, "boards/" + target_board + "/def_config")
shutil.copyfile(def_config_file, os.path.join(hss_source, "./.config"))
# Call HSS makefile
initial_directory = os.getcwd()
os.chdir(hss_source)
make_command = "make BOARD=" + target_board
os.system(make_command)
os.chdir(initial_directory)
# Check build was successful and copy the build artifact to the output directory
generated_hex_file = "./sources/HSS/Default/bootmode1/hss-envm-wrapper-bm1-p0.hex"
if os.path.isfile(generated_hex_file):
shutil.copyfile(generated_hex_file, "./work/HSS/hss-envm-wrapper-bm1-p0.hex")
else:
print("!!! Error: Hart Soft Service build failed !!!", flush=True)
exit()
def get_libero_script_args(source_list):
libero_script_args = "NO_BUILD_ARGUMENT"
with open(source_list) as f: # open the yaml file passed as an arg
data = yaml.load(f, Loader=yaml.FullLoader)
# try:
libero_script_args = data.get("gateware").get("build-args")
# except:
# libero_script_args = "NO_BUILD_ARGUMENT"
f.close()
if libero_script_args is None:
libero_script_args = "NONE"
return libero_script_args
#
# Retrieve/generate the gateware's design version. This version number is stored in the PolarFire SoC device and used
# as part of programming the PolarFire SoC FPGA using IAP (gateware programming from Linux).
# Care must be taken to ensure this version number is different between programming attempts. Otherwise, the PolarFire
# SoC System Controller will not attempt to program the FPGA with the new gateware if it finds the design versions are
# identical.
# The approach to managing design version numbers is to use a unique design version number for release gateware. This
# unique design version number is specified as part of the yaml build option file. The version number is dd.vv.r where
# dd identifies the design, vv is an incremental features identifier and r is a revision number.
# For development, the design version number is generated based on the gateware generation date/time. This generated
# version number loops back every 45 days given the design version number stored in PolarFire SoC is 16 bit long.
#
def get_design_version(source_list):
with open(source_list) as f: # open the yaml file passed as an arg
data = yaml.load(f, Loader=yaml.FullLoader)
unique_design_version = data.get("gateware").get("unique-design-version")
f.close()
if unique_design_version is None:
now = datetime.datetime.now()
day_of_year = now.timetuple().tm_yday
design_version = ((day_of_year %45) * 1440) + (now.hour * 60) + now.minute
else:
try:
udv_sl = unique_design_version.split(".")
design_version = (int(udv_sl[0]) * 1000) + (int(udv_sl[1]) * 10) + int(udv_sl[2])
except (ValueError, AttributeError):
print("Error: Invalid value for unique-design-version in ", source_list )
print("unique-design-version must be in the form dd.vv.r")
exit()
# FPGA design version number stored in Polarfire SoC devices is 16 bits long.
design_version = design_version % 65536
print("Design version: ", design_version)
return str(design_version)
# The function below assumes the current working directory is the gateware's git repository.
def get_git_hash():
try:
git_hash = subprocess.check_output(['git', 'log', "--pretty=format:'%H'", '-n', '1'])
except subprocess.CalledProcessError as e:
git_hash = 0
return git_hash.decode('ascii').strip("'")
# Build the gateware's top level name from the build option directory name and the git hassh of the gateware's
# repository.
def get_top_level_name():
git_hash = get_git_hash()
top_level_name = str(os.path.splitext(os.path.basename(yaml_input_file))[0])
top_level_name = top_level_name.replace('-', '_')
top_level_name = top_level_name + '_' + git_hash
if len(top_level_name) > 30:
top_level_name = top_level_name[:30]
top_level_name = top_level_name.upper()
return top_level_name
# Calls Libero and runs a script
def call_libero(libero, script, script_args, project_location, hss_image_location, prog_export_path, top_level_name, design_version):
libero_cmd = libero + " SCRIPT:" + script + " \"SCRIPT_ARGS: " + script_args + " PROJECT_LOCATION:" + project_location + " TOP_LEVEL_NAME:" + top_level_name + " HSS_IMAGE_PATH:" + hss_image_location + " PROG_EXPORT_PATH:" + prog_export_path + " DESIGN_VERSION:" + design_version + "\""
print("Libero command: " + libero_cmd, flush=True)
os.system(libero_cmd)
def generate_libero_project(libero, yaml_input_file):
print("================================================================================")
print(" Generate Libero project")
print("================================================================================\r\n", flush=True)
# Execute the Libero TCL script used to create the Libero design
initial_directory = os.getcwd()
os.chdir("./sources/FPGA-design")
project_location = os.path.join("..", "..", "work", "libero")
script = os.path.join("..", "..", "sources", "FPGA-design", "BUILD_BVF_GATEWARE.tcl")
script_args = get_libero_script_args(yaml_input_file)
design_version = get_design_version(yaml_input_file)
hss_image_location = os.path.join("..", "..", "work", "HSS", "hss-envm-wrapper-bm1-p0.hex")
prog_export_path = os.path.join("..", "..")
top_level_name = get_top_level_name()
print("top level name: ", top_level_name)
call_libero(libero, script, script_args, project_location, hss_image_location, prog_export_path, top_level_name, design_version)
os.chdir(initial_directory)
def main():
global libero
global mss_configurator
global softconsole_headless
global programming
parse_arguments()
# This function will check if all of the required tools are present and quit if they aren't
check_tool_status()
sources = {}
# Bitstream building starts here - see individual functions for a description of their purpose
init_workspace()
sources = clone_sources(yaml_input_file)
build_options_list = get_libero_script_args(yaml_input_file)
generate_gateware_overlays(os.path.join(os.getcwd(), "bitstream", "LinuxProgramming"), build_options_list)
mss_config_file_path = os.path.join(".", "sources", "MSS_Configuration", "MSS_Configuration.cfg")
work_mss_dir = os.path.join("work", "MSS")
make_mss_config(mss_configurator, mss_config_file_path, os.path.join(os.getcwd(), work_mss_dir))
make_hss(sources["HSS"], yaml_input_file)
generate_libero_project(libero, yaml_input_file)
print("Finished", flush=True)
if __name__ == '__main__':
main()
---
HSS:
type: git
link: https://git.beagleboard.org/beaglev-fire/hart-software-services.git
branch: develop-beaglev-fire
board: bvf
gateware:
type: sources
build-args: "CAPE_OPTION:GPIOS MIPI_CSI_OPTION:NONE M2_OPTION:BOARD_TESTS SYZYGY_OPTION:BOARD_TESTS_SEEED_STUDIO"
unique-design-version: 0.0.2
---
HSS:
type: git
link: https://git.beagleboard.org/beaglev-fire/hart-software-services.git
branch: develop-beaglev-fire
board: bvf
gateware:
type: sources
unique-design-version: 2.0.2
---
HSS:
type: git
link: https://git.beagleboard.org/beaglev-fire/hart-software-services.git
branch: develop-beaglev-fire
board: bvf
gateware:
type: sources
build-args: "M2_OPTION:NONE CAPE_OPTION:NONE"
unique-design-version: 1.0.2
---
HSS:
type: git
link: https://git.beagleboard.org/beaglev-fire/hart-software-services.git
branch: develop-beaglev-fire
board: bvf
gateware:
type: sources
build-args: "CAPE_OPTION:ROBOTICS "
unique-design-version: 3.0.3
---
HSS:
type: git
link: https://git.beagleboard.org/beaglev-fire/hart-software-services.git
branch: develop-beaglev-fire
board: bvf
gateware:
type: sources
build-args: "M2_OPTION:NONE CAPE_OPTION:SNAKEYWARE"
gateware-builds-tester/artifacts/bitstreams/my_custom_fpga_design/DirectC/* /usr/share/beagleboard/gateware/my_custom_fpga_design/DirectC
gateware-builds-tester/artifacts/bitstreams/my_custom_fpga_design/FlashProExpress/* /usr/share/beagleboard/gateware/my_custom_fpga_design/FlashProExpress
gateware-builds-tester/artifacts/bitstreams/my_custom_fpga_design/LinuxProgramming/* /usr/share/beagleboard/gateware/my_custom_fpga_design/LinuxProgramming
\ No newline at end of file
bbb.io-gateware-my-custom-fpga-design (1.20231226.0-0~lunar) lunar; urgency=low
* ci build of https://git.beagleboard.org/beaglev-fire/gateware
-- Robert Nelson <robertcnelson@beagleboard.org> Tue, 26 Dec 2023 17:41:26 +0000
10
Source: bbb.io-gateware-my-custom-fpga-design
Section: misc
Priority: extra
Maintainer: Robert Nelson <robertcnelson@gmail.com>
Build-Depends:
debhelper (>= 10)
Standards-Version: 4.5.1
Package: bbb.io-gateware-my-custom-fpga-design
Architecture: all
Depends:
${shlibs:Depends}
, ${misc:Depends}
, bbb.io-gateware
, mtd-utils
Description: bbb.io-gateware-my-custom-fpga-design
bbb.io-gateware-my-custom-fpga-design
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
DH_VERBOSE = 1
%:
dh $@
override_dh_builddeb:
dh_builddeb -- -Zxz
debian/change-gateware.sh /usr/share/beagleboard/gateware
debian/update-gateware.sh /usr/share/microchip/gateware
debian/mcp356x_read.py /usr/share/microchip/gateware
gateware-builds-tester/artifacts/bitstreams/board-tests/DirectC/* /usr/share/beagleboard/gateware/board-tests/DirectC
gateware-builds-tester/artifacts/bitstreams/board-tests/FlashProExpress/* /usr/share/beagleboard/gateware/board-tests/FlashProExpress
gateware-builds-tester/artifacts/bitstreams/board-tests/LinuxProgramming/* /usr/share/beagleboard/gateware/board-tests/LinuxProgramming
gateware-builds-tester/artifacts/bitstreams/default/DirectC/* /usr/share/beagleboard/gateware/default/DirectC
gateware-builds-tester/artifacts/bitstreams/default/FlashProExpress/* /usr/share/beagleboard/gateware/default/FlashProExpress
gateware-builds-tester/artifacts/bitstreams/default/LinuxProgramming/* /usr/share/beagleboard/gateware/default/LinuxProgramming
gateware-builds-tester/artifacts/bitstreams/minimal/DirectC/* /usr/share/beagleboard/gateware/minimal/DirectC
gateware-builds-tester/artifacts/bitstreams/minimal/FlashProExpress/* /usr/share/beagleboard/gateware/minimal/FlashProExpress
gateware-builds-tester/artifacts/bitstreams/minimal/LinuxProgramming/* /usr/share/beagleboard/gateware/minimal/LinuxProgramming
gateware-builds-tester/artifacts/bitstreams/robotics/DirectC/* /usr/share/beagleboard/gateware/robotics/DirectC
gateware-builds-tester/artifacts/bitstreams/robotics/FlashProExpress/* /usr/share/beagleboard/gateware/robotics/FlashProExpress
gateware-builds-tester/artifacts/bitstreams/robotics/LinuxProgramming/* /usr/share/beagleboard/gateware/robotics/LinuxProgramming
#!/bin/bash
if ! id | grep -q root; then
echo "must be run as root"
exit
fi
if [ -d $1 ]
then
echo "Changing gateware."
if [ -e $1/LinuxProgramming/mpfs_bitstream.spi ]
then
if [ -e $1/LinuxProgramming/mpfs_dtbo.spi ]
then
cp -v $1/LinuxProgramming/mpfs_dtbo.spi /lib/firmware/mpfs_dtbo.spi
cp -v $1/LinuxProgramming/mpfs_bitstream.spi /lib/firmware/mpfs_bitstream.spi
sync
. /usr/share/microchip/gateware/update-gateware.sh
else
echo "No device tree overlay file found."
fi
else
echo "No gateware file found."
fi
else
echo "No directory found for this requested gateware."
fi
bbb.io-gateware (1.20231226.0-0~lunar) lunar; urgency=low
* ci build of https://git.beagleboard.org/beaglev-fire/gateware
-- Robert Nelson <robertcnelson@beagleboard.org> Tue, 26 Dec 2023 17:41:26 +0000
10
Source: bbb.io-gateware
Section: misc
Priority: extra
Maintainer: Robert Nelson <robertcnelson@gmail.com>
Build-Depends:
debhelper (>= 10)
Standards-Version: 4.5.1
Package: bbb.io-gateware
Architecture: all
Depends:
${shlibs:Depends}
, ${misc:Depends}
, mtd-utils
Description: bbb.io-gateware
bbb.io-gateware
#!/bin/env python3
#
# This script is intended to be run with python 3
#
import time
import os
import re
import subprocess
import functools
voltage_raws = []
voltage_differential_raws = []
voltage_scales = [ "in_voltage-voltage_scale" ]
hw_gain = [ "hardwaregain" ]
hw_gain_available = [ hw_gain[0] + "_available" ]
calib_bias = [ "calibbias" ]
calib_bias_available = [ calib_bias[0] + "_available" ]
calib_scale = [ "calibscale" ]
calib_scale_available = [ calib_scale[0] + "_available" ]
oversampling_ratio = [ "oversampling_ratio" ]
oversampling_ratio_available = [ oversampling_ratio[0] + "_available" ]
temperature_raws = [ "in_temp_raw" ]
temperature_scale = [ "in_temp_scale" ]
DIR_PATH="/sys/bus/iio/devices/"
device = []
mcp_devices = []
device2channels ={}
new_line = '\n'
def mult(file1_name, file2_name):
global ABS_PATH
file1 = open(ABS_PATH+file1_name,'r')
val1 = int(file1.read())
file1.close()
file2 = open(ABS_PATH+file2_name,'r')
val2 = float(file2.read())
file2.close()
return (val1 * val2)
def print_attribute(file_name):
global ABS_PATH
attr_file = open(ABS_PATH + file_name,'r')
string = attr_file.read()
attr_file.close()
# clean the string for printing
string = string.replace("0000000", "")
return string
def calculate_temperature(file1_name):
global ABS_PATH
name_file = open(ABS_PATH + "name",'r')
device_name_string = name_file.read()
name_file.close()
temperature = open(ABS_PATH+file1_name,'r')
temperature_val = int(temperature.read())
temperature.close()
if ( 'mcp3564\n' == device_name_string ):
return temperature_val * 4.0096 * 0.0001 * 2.4 - 269.13
else:
return 0
def write_attribute(file_name, value):
global ABS_PATH
attr_file = open(ABS_PATH + file_name,'w')
attr_file.write(value)
attr_file.close()
return 0
def get_name(file_name):
global ABS_PATH
attr_file = open(file_name,'r')
string = attr_file.read()
attr_file.close()
return string
if not os.path.isdir(DIR_PATH):
print('IIO is not enabled')
exit()
proc = subprocess.Popen("ls -1 " + DIR_PATH + "| grep device", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
lines = stdout.decode('utf-8').split('\n')
print('Search for devices:')
for line in lines:
path=DIR_PATH + line
if os.path.exists(path):
if os.path.exists(path + "/name"):
device_name= get_name(path + "/name")
print('------------->', device_name)
if re.search(r"mcp3[45]6[124][rR]", device_name):
device_index = re.findall(r'\d+', line)
if device_index:
mcp_devices.append(device_index[0])
# get voltage_raws*
proc_channels = subprocess.Popen("ls -1 " + path + "/ | grep in_voltage* | grep -v scale | grep -v \"-\"", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout_channels, stderr_channels = proc_channels.communicate()
voltage_raws = stdout_channels.decode('utf-8').split('\n')
voltage_raws = voltage_raws[:-1]
# get voltage_differential_raws
proc_channels = subprocess.Popen("ls -1 " + path + "/ | grep in_voltage* | grep -v scale | grep \"-\"", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout_channels, stderr_channels = proc_channels.communicate()
voltage_differential_raws = stdout_channels.decode('utf-8').split('\n')
voltage_differential_raws = voltage_differential_raws[:-1]
for mcp_device in mcp_devices:
ABS_PATH = f'{DIR_PATH}iio:device{mcp_device}/'
print('--------------------------------')
print('--------------------------------')
print('--------------------------------')
print(f'Device: {print_attribute("name")}')
print('--------------------------------')
print(f'Available Voltage Oversampling Ratio:')
oversampling_ratio_string = print_attribute(oversampling_ratio_available[0])
oversampling_ratio_list = oversampling_ratio_string.split()
print(f' {oversampling_ratio_string}')
print('--------------------------------')
print(f'Current Voltage Oversampling Ratio: %s' % (print_attribute(oversampling_ratio[0])))
print('--------------------------------')
print(f'Available Voltage Hardware Gain:')
hw_gain_string = print_attribute(hw_gain_available[0])
hw_gain_list = hw_gain_string.split()
print(f' {hw_gain_string}')
print('--------------------------------')
print(f'Current Voltage Hardware Gain: %s' % (print_attribute(hw_gain[0])))
print('--------------------------------')
print(f'Available Voltage Calibration Bias {new_line} [ Low, Step, High ] {new_line} %s' % (print_attribute(calib_bias_available[0]).replace(" ", " ")))
print('--------------------------------')
print(f'Current Voltage Calibration Bias: %s' % (print_attribute(calib_bias[0])))
print('--------------------------------')
print(f'Available Voltage Calibration Scale {new_line} [ Low, Step, High ] {new_line} %s' % (print_attribute(calib_scale_available[0]).replace(" ", " ")))
print('--------------------------------')
print(f'Current Voltage Calibration Scale: %s' % (print_attribute(calib_scale[0])))
print('--------------------------------')
print('--------------------------------')
# Measured voltage in millivolts
# U = in2_raw * in_scale
print('\n Voltage')
print('=========')
print(f' Channel V mV')
for raw in voltage_raws:
# Voltage Scale is in mV
voltage_mv = mult(raw,voltage_scales[0])
voltage = voltage_mv/1000
print('---------------------------------------------------------------------')
print(f' {raw}: %2.4f | %5.6f' % (voltage, voltage_mv))
print('\n\n--------------------------------')
print('\n Differential Voltage')
print('======================')
print(f' Channel V mV')
for raw in voltage_differential_raws:
# Voltage Scale is in mV
voltage_mv = mult(raw,voltage_scales[0])
voltage = voltage_mv/1000
print('---------------------------------------------------------------------')
print(f' {raw}: %8.4f | %15.6f' % (voltage, voltage_mv))
print('\n\n--------------------------------')
print('\n\n Temperature(',u'\xb0\x43','): %8.4f' % calculate_temperature(temperature_raws[0]))
print('\n\n--------------------------------')
if os.geteuid()==0:
print('\n\n================================')
print ('Running as root.')
print('================================\n\n')
# Testing Hardware Gain
current_hw_gain = print_attribute(hw_gain[0])
print(f' Current Voltage Hardware Gain: x{current_hw_gain}')
print('\n================================')
print(f' Testing Hardware gain settings: {hw_gain_string}')
print('================================\n')
print('--------------------------------')
for hw_gain_value in hw_gain_list:
print(f' {new_line} Set Voltage Hardware Gain: x{hw_gain_value}')
write_attribute(hw_gain[0], hw_gain_value)
print(f' Channel V mV')
voltage_mv = mult(voltage_differential_raws[0], voltage_scales[0])
voltage = voltage_mv/1000
print('---------------------------------------------------------------------')
print(f' {voltage_differential_raws[0]}: %2.4f | %5.6f -> Hw Gain: x%s' % (voltage, voltage_mv, print_attribute(hw_gain[0])))
print('---------------------------------------------------------------------------------------------------------------------')
# set back the Hardware Gain
write_attribute(hw_gain[0], current_hw_gain)
print('--------------------------------')
# Testing Oversampling Ratio
current_oversampling_ratio = print_attribute(oversampling_ratio[0])
print(f' Current Oversampling Ratio: x{current_oversampling_ratio}')
print(f' {new_line}')
print('\n================================')
print(f' Testing Oversampling Ratio settings: {oversampling_ratio_string}')
print('================================\n')
print('--------------------------------')
for oversampling_ratio_value in oversampling_ratio_list:
print(f' {new_line} Set Oversampling Ratio: x{oversampling_ratio_value}')
write_attribute(oversampling_ratio[0], oversampling_ratio_value)
print(f' Channel V mV')
voltage_mv = mult(voltage_differential_raws[0], voltage_scales[0])
voltage = voltage_mv/1000
print('---------------------------------------------------------------------')
print(f' {voltage_differential_raws[0]}: %2.4f | %5.6f -> Oversampling Ratio: x%s' % (voltage, voltage_mv, print_attribute(oversampling_ratio[0])))
print('---------------------------------------------------------------------------------------------------------------------')
# set back the Oversampling Ratio
write_attribute(oversampling_ratio[0], current_oversampling_ratio)
print('\n--------------------------------')
# Testing Calibration BIAS
current_calib_bias = print_attribute(calib_bias[0])
print(f'{new_line} Current Calibration BIAS: {current_calib_bias}')
print('\n\n================================')
print(f' Testing Calibration Bias settings')
print('================================\n')
print('--------------------------------\n')
calib_bias_value = "50000"
print(f' {new_line} Set Calibration BIAS: {calib_bias_value}')
write_attribute(calib_bias[0], calib_bias_value)
print(f' Channel V mV')
voltage_mv = mult(voltage_differential_raws[0], voltage_scales[0])
voltage = voltage_mv/1000
print('---------------------------------------------------------------------')
print(f' {voltage_differential_raws[0]}: %2.4f | %5.6f -> Calibration BIAS: %s' % (voltage, voltage_mv, print_attribute(calib_bias[0])))
print('---------------------------------------------------------------------------------------------------------------------')
# set back the Calibration Bias
write_attribute(calib_bias[0], "0")
print('\n--------------------------------')
# Testing Calibration Scale
calib_scale_x1_gain = 8388608
current_calib_scale = print_attribute(calib_scale[0])
print(f'{new_line} Current Calibration Scale: {int(current_calib_scale)/calib_scale_x1_gain}')
print('\n\n================================')
print(f' Testing Calibration Scale settings')
print('================================\n')
print('--------------------------------')
calib_scale_value = 4194304;
print(f' {new_line} Set Calibration Scale: {calib_scale_value/calib_scale_x1_gain}')
write_attribute(calib_scale[0], str(calib_scale_value))
print(f' Channel V mV')
voltage_mv = mult(voltage_differential_raws[0], voltage_scales[0])
voltage = voltage_mv/1000
print('---------------------------------------------------------------------')
calib_scale_string = print_attribute(calib_scale[0])
calib_scale_int = int(calib_scale_string)
print(f' {voltage_differential_raws[0]}: %2.4f | %5.6f -> Calibration Scale: x%2.6f' % (voltage, voltage_mv, calib_scale_int/calib_scale_x1_gain))
print('*********************************************************************************************************************')
print('*********************************************************************************************************************')
print('*********************************************************************************************************************')
# set back the Calibration Scale
write_attribute(calib_scale[0], str(calib_scale_x1_gain))
else:
print ('User is not root.\n')
print ('Changing the user configurable settings must by done by root user.\n')
\ No newline at end of file