summaryrefslogtreecommitdiff
path: root/python/openvino/runtime/coredla_device/stream_controller/build.sh
blob: 2d22c5e3f08bb40bb35eb1bc30ba641241318cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /bin/bash
# Run in Nios V Command Shell, Quartus Prime 22.4 or later

quartus_project=$1
qsys_file=$2
hex_file=$3

usage()
{
    echo "Usage:"
    echo "    build.sh <quartus_project_file> <qsys_file> <destination_hex_file>"
}

if [ -z "$quartus_project" ]; then
    usage
    exit 1
fi

if [ -z "$qsys_file" ]; then
    usage
    exit 1
fi

if [ -z "$hex_file" ]; then
    usage
    exit 1
fi

if [ ! -f "$quartus_project" ]; then
    echo Quartus project file not found "$quartus_project"
    usage
    exit 1
fi

if [ ! -f "$qsys_file" ]; then
    echo qsys file not found "$qsys_file"
    usage
    exit 1
fi

# Export the bsp folder from the Quartus project, create the
# CMakeFiles.txt for the application, build the app, then
# build the stream_controller.hex binary, in the 'build' folder

niosv-bsp -c --quartus-project=$quartus_project --qsys=$qsys_file --type=hal bsp/settings.bsp
niosv-app --bsp-dir=bsp --app-dir=app --srcs=app --elf-name=stream_controller.elf

# cmake dependency, version 3.14.10 or later. https://cmake.org/download/
cmake -B build -DCMAKE_BUILD_TYPE=Release app
cmake --build build
elf2hex build/stream_controller.elf -b 0x0 -w 32 -e 0x1ffff -r 4 -o build/stream_controller.hex
cp build/stream_controller.hex $hex_file

exit 0