Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 55 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
trigger:
branches:
exclude:
# master branch publishes releases - avoid merges triggering a new release
- master

schedules:
- cron: "0 4 * * *"
displayName: Nightly build at 0400 UTC
Expand Down Expand Up @@ -26,6 +32,7 @@ stages:
jobs:
- job: build_toolchain
displayName: Build toolchain
timeoutInMinutes: 0
strategy:
matrix:
linux_x86_64:
Expand All @@ -34,9 +41,6 @@ stages:
osx:
ARCH: darwin
vm_image: macOS-10.15
# win64:
# ARCH: windows_amd64
# vm_image: vs2017-win2016
pool:
vmImage: '$(vm_image)'
steps:
Expand All @@ -53,6 +57,54 @@ stages:
name: build_toolchain
- publish: _packages/build_$(ARCH)/fpga-toolchain-$(ARCH)-$(RELEASE_TAG).tar.gz
artifact: fpga-toolchain-$(ARCH)-$(RELEASE_TAG)
- job: build_toolchain_windows_amd64
displayName: Build toolchain windows_amd64
timeoutInMinutes: 0
pool:
vmImage: vs2017-win2016
variables:
ARCH: windows_amd64
MINGW_ARCH: x86_64
steps:
- powershell: |
Set-MpPreference -DisableArchiveScanning $true
Set-MpPreference -DisableRealtimeMonitoring $true
Set-MpPreference -DisableBehaviorMonitoring $true
- download: current
artifact: ecp5-bba
- bash: |
RELEASE_TAG=nightly-$(date +'%Y%m%d')
# create pipeline variable
echo "##vso[task.setvariable variable=RELEASE_TAG]$RELEASE_TAG"
- script: copy $(Pipeline.Workspace)\ecp5-bba\ecp5-bba-linux_x86_64-nightly.tar.gz $(Build.Repository.LocalPath)\chipdb.tar.gz
displayName: Copy BBA artifact
- script: |
set MSYS_ROOT=%CD:~0,2%\msys64
echo ##vso[task.setvariable variable=MSYS_ROOT]%MSYS_ROOT%
git clone https://github.com/msys2/msys2-ci-base.git %MSYS_ROOT%
%MSYS_ROOT%\usr\bin\rm -rf %MSYS_ROOT%\.git
displayName: Install MSYS2
- script: |
set PATH=%MSYS_ROOT%\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
%MSYS_ROOT%\usr\bin\pacman --noconfirm -Syyuu
displayName: Update MSYS2
- script: |
set PATH=%MSYS_ROOT%\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
%MSYS_ROOT%\usr\bin\pacman --noconfirm --needed -S git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
%MSYS_ROOT%\usr\bin\pacman --noconfirm -Scc
displayName: Install Toolchain
- script: |
set PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
%MSYS_ROOT%\usr\bin\sed -i "s|#CacheDir.*|CacheDir=/c/Users/%USERNAME%/AppData/Local/Temp|g" /etc/pacman.conf
set MSYS=winsymlinks:nativestrict
%MSYS_ROOT%\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "./build.sh windows_amd64"
displayName: CI-Build
env:
MSYSTEM: MINGW64
CHERE_INVOKING: yes
MINGW_INSTALLS: mingw64
- publish: _packages/build_$(ARCH)/fpga-toolchain-$(ARCH)-$(RELEASE_TAG).zip
artifact: fpga-toolchain-$(ARCH)-$(RELEASE_TAG)

- stage: publish_release
displayName: publish release
Expand Down
11 changes: 7 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export NAME=fpga-toolchain
# -- Debug flags
INSTALL_DEPS=1
COMPILE_DFU_UTIL=1
COMPILE_ICESTORM=1
COMPILE_YOSYS=1
COMPILE_ICESTORM=1
COMPILE_NEXTPNR_ICE40=1
COMPILE_NEXTPNR_ECP5=1
COMPILE_ECPPROG=1
Expand Down Expand Up @@ -60,12 +60,15 @@ mkdir -p $PACKAGE_DIR/$NAME/share

# -- Test script function
function test_bin {
. $WORK_DIR/test/test_bin.sh $1
if [ $? != "0" ]; then
exit 1
if [[ ${ARCH:0:7} != "windows" ]]; then
. $WORK_DIR/test/test_bin.sh $1
if [ $? != "0" ]; then
exit 1
fi
fi
}


# -- Print function
function print {
echo ""
Expand Down
12 changes: 12 additions & 0 deletions scripts/build_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

set -e

export MAKE="make"

if [ $ARCH == "linux_x86_64" ]; then
export CC="gcc"
export CXX="g++"
Expand Down Expand Up @@ -46,6 +48,14 @@ if [ $ARCH == "windows_amd64" ]; then
export CXX="x86_64-w64-mingw32-g++"
export HOST_FLAGS="--host=x86_64-w64-mingw32"
export ABC_ARCHFLAGS="-DSIZEOF_VOID_P=8 -DSIZEOF_LONG=4 -DSIZEOF_INT=4 -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -D_POSIX_SOURCE -fpermissive -w"
export MAKE="mingw32-make"

export EMBEDDED_PY_VER=$(python.exe -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')
mkdir -p $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER
cp -L -R /mingw64/lib/python$EMBEDDED_PY_VER $PACKAGE_DIR/$NAME/lib
# this isn't necessary and takes up ~half the size
rm -rf $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER/test
cp /mingw64/bin/{libgcc_s_seh-1.dll,libstdc++-6.dll,libwinpthread-1.dll,libpython$EMBEDDED_PY_VER.dll} $PACKAGE_DIR/$NAME/bin
fi

if [ $ARCH == "darwin" ]; then
Expand All @@ -70,3 +80,5 @@ fi
if [ $J -gt 1 ]; then
J=$(($J-1))
fi

echo Running with J=$J
53 changes: 37 additions & 16 deletions scripts/compile-nextpnr-ecp5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fi
rm -f $nextpnr_dir/CMakeCache.txt $prjtrellis_dir/CMakeCache.txt

cd $BUILD_DIR
mkdir chipdb
mkdir -p chipdb
cd chipdb
tar -xvf $WORK_DIR/chipdb.tar.gz

Expand Down Expand Up @@ -91,20 +91,39 @@ then
cd ..
elif [ ${ARCH:0:7} = "windows" ]
then
echo "Build not functioning on Windows"
exit 1
else
cd $BUILD_DIR/$prjtrellis_dir/libtrellis
cmake \
-G "MinGW Makefiles" \
-DBUILD_SHARED=OFF \
-DSTATIC_BUILD=ON \
-DBUILD_PYTHON=OFF \
-DCMAKE_INSTALL_PREFIX=$PACKAGE_DIR/$NAME \
-DCURRENT_GIT_VERSION=$prjtrellis_commit \
-DBoost_USE_STATIC_LIBS=ON \
.
mingw32-make -j$J CXX="$CXX" LIBS="-lm"
mingw32-make install

# # The first run of the build produces the Python shared library
# # (Disabled since we now use PREGENERATED_BBA_PATH)
# cmake \
# -DBUILD_SHARED=ON \
# -DSTATIC_BUILD=OFF \
# -DBUILD_PYTHON=ON \
# .
# make -j$J CXX="$CXX"
# rm -rf CMakeCache.txt
cd $BUILD_DIR/$nextpnr_dir
cp $WORK_DIR/scripts/nextpnr-CMakeLists.txt CMakeLists.txt

cmake \
-G "MinGW Makefiles" \
-DARCH=ecp5 \
-DTRELLIS_ROOT=$BUILD_DIR/$prjtrellis_dir \
-DPYTRELLIS_LIBDIR=$BUILD_DIR/$prjtrellis_dir/libtrellis \
-DPREGENERATED_BBA_PATH=$BUILD_DIR/chipdb/ecp5-bba/bba \
-DBoost_USE_STATIC_LIBS=ON \
-DBUILD_GUI=OFF \
-DBUILD_PYTHON=ON \
-DBUILD_HEAP=ON \
-DSTATIC_BUILD=ON \
.

mingw32-make -j$J CXX="$CXX" LIBS="-static -lstdc++ -lm" VERBOSE=1
cd ..
else
cd $BUILD_DIR/$prjtrellis_dir/libtrellis

# The second run builds the static libraries we'll use in the final release
cmake \
Expand All @@ -131,7 +150,7 @@ else
-DSTATIC_BUILD=ON \
-DBoost_USE_STATIC_LIBS=ON \
.
make -j$J CXX="$CXX"
make -j$J CXX="$CXX" LIBS="-static -lstdc++ -lm"

# Install a copy of Python, since Python libraries are not compatible
# across minor versions.
Expand All @@ -149,13 +168,15 @@ fi || exit 1

# -- Copy the executables to the bin dir
mkdir -p $PACKAGE_DIR/$NAME/bin
$WORK_DIR/scripts/test_bin.sh $BUILD_DIR/$nextpnr_dir/nextpnr-ecp5$EXE
# $WORK_DIR/scripts/test_bin.sh $BUILD_DIR/$nextpnr_dir/nextpnr-ecp5$EXE
cp $BUILD_DIR/$nextpnr_dir/nextpnr-ecp5$EXE $PACKAGE_DIR/$NAME/bin/nextpnr-ecp5$EXE
for i in ecpmulti ecppack ecppll ecpunpack ecpbram
do
$WORK_DIR/scripts/test_bin.sh $BUILD_DIR/$prjtrellis_dir/libtrellis/$i$EXE
# $WORK_DIR/scripts/test_bin.sh $BUILD_DIR/$prjtrellis_dir/libtrellis/$i$EXE
cp $BUILD_DIR/$prjtrellis_dir/libtrellis/$i$EXE $PACKAGE_DIR/$NAME/bin/$i$EXE
done

# Do a test run of the new binary
$PACKAGE_DIR/$NAME/bin/nextpnr-ecp5$EXE --help
echo 'print("hello from python!")' > hello.py
$PACKAGE_DIR/$NAME/bin/nextpnr-ecp5$EXE --run hello.py
8 changes: 6 additions & 2 deletions scripts/compile_dfu_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ if [ $ARCH == "darwin" ]; then
--includedir=/opt/local/include \
USB_CFLAGS="-I$LIBUSB_ROOT/include/libusb-1.0" \
USB_LIBS="$LIBUSB_ROOT/lib/libusb-1.0.a -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
make
$MAKE
elif [ ${ARCH:0:7} = "windows" ]
then
./configure USB_LIBS="-static -lpthread -lusb-1.0"
$MAKE
else
./configure USB_CFLAGS="-I$WORK_DIR/build-data/include/libusb-1.0" USB_LIBS="-static $WORK_DIR/build-data/lib/$ARCH/libusb-1.0.a -lpthread"
make
$MAKE
fi

TOOLS="dfu-util dfu-prefix dfu-suffix"
Expand Down
9 changes: 7 additions & 2 deletions scripts/compile_ecpprog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ if [ $ARCH == "darwin" ]; then
sed -i "" "s/-ggdb //;" Makefile
# pkg-config is used to set LDLIBS in this Makefile and doesn't quite do what we want
sed -i "" "s/\$^ \$(LDLIBS)/\$^ \$(LDSTATICLIBS)/g" Makefile
make -j$J CC="$CC" \
$MAKE -j$J CC="$CC" \
PKG_CONFIG=":" \
LDSTATICLIBS="$LIBFTDI_ROOT/lib/libftdi1.a $LIBUSB_ROOT/lib/libusb-1.0.a -Wl,-framework,IOKit -Wl,-framework,CoreFoundation" \
CFLAGS="-MD -O0 -Wall -std=c99 -I$LIBFTDI_ROOT/include/libftdi1 $CFLAGS"
elif [ ${ARCH:0:7} = "windows" ]
then
sed -i "s/-ggdb //;" Makefile
$MAKE -j$J CC="$CC" \
LDFLAGS="-static -pthread"
else
sed -i "s/-ggdb //;" Makefile
sed -i "s/\$^ \$(LDLIBS)/\$^ \$(LDLIBS) \$(LDUSBSTATIC)/g" Makefile
make -j$J CC="$CC" \
$MAKE -j$J CC="$CC" \
LDFLAGS="-static -pthread -L$WORK_DIR/build-data/lib/$ARCH " \
LDUSBSTATIC="-lusb-1.0"\
CFLAGS="-MD -O0 -Wall -std=c99 -I$WORK_DIR/build-data/include/libftdi1 -I$WORK_DIR/build-data/include/libusb-1.0"
Expand Down
13 changes: 6 additions & 7 deletions scripts/compile_icestorm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ if [ $ARCH == "darwin" ]; then
make -j$J CXX="$CXX" \
CXXFLAGS="-std=c++11 $CXXFLAGS" \
SUBDIRS="icebox icepack icemulti icepll icetime icebram"
elif [ ${ARCH:0:7} = "windows" ]
then
sed -i "s/-ggdb //;" Makefile
$MAKE -j$J CC="$CC" STATIC=1
else
sed -i "s/-ggdb //;" config.mk
sed -i "s/\$^ \$(LDLIBS)/\$^ \$(LDLIBS) \$(LDUSBSTATIC)/g" iceprog/Makefile
Expand All @@ -47,19 +51,14 @@ fi

TOOLS="iceprog icepack icemulti icepll icetime icebram"

EXE_O=
if [ -f icepack/icepack.exe ]; then
EXE_O=.exe
fi

# -- Test the generated executables
for dir in $TOOLS; do
test_bin $dir/$dir$EXE_O
test_bin $dir/$dir$EXE
done

# -- Copy the executables to the bin dir
for dir in $TOOLS; do
cp $dir/$dir$EXE_O $PACKAGE_DIR/$NAME/bin/$dir$EXE
cp $dir/$dir$EXE $PACKAGE_DIR/$NAME/bin/$dir$EXE
done

# -- Copy the chipdb*.txt data files
Expand Down
14 changes: 10 additions & 4 deletions scripts/compile_iverilog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,21 @@ if [ $ARCH == "darwin" ]; then
./configure --prefix=$PACKAGE_DIR/$NAME \
--exec-prefix=$PACKAGE_DIR/$NAME \

make
$MAKE

export PATH=$OLDPATH
elif [ ${ARCH:0:7} = "windows" ]
then
./configure --prefix=$PACKAGE_DIR/$NAME \
--exec-prefix=$PACKAGE_DIR/$NAME \
LDFLAGS="-static -lstdc++ -lm" \

$MAKE
else
./configure --prefix=$PACKAGE_DIR/$NAME \
--exec-prefix=$PACKAGE_DIR/$NAME \

make
$MAKE
fi

make install

$MAKE install
22 changes: 13 additions & 9 deletions scripts/compile_nextpnr-ice40.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,20 @@ if [ $ARCH == "darwin" ]; then
.
make -j$J CXX="$CXX" LIBS="-lm -fno-lto -ldl -lutil"
elif [ ${ARCH:0:7} == "windows" ]; then
cp $WORK_DIR/scripts/nextpnr-CMakeLists.txt CMakeLists.txt

cmake \
-DARCH=ice40 \
-DBUILD_HEAP=ON \
-DCMAKE_SYSTEM_NAME=Windows \
-DBUILD_GUI=OFF \
-DSTATIC_BUILD=ON \
-DICEBOX_ROOT=$PACKAGE_DIR/$NAME/share/icebox \
-DBoost_USE_STATIC_LIBS=ON \
.
make -j$J CXX="$CXX" LIBS="-static -static-libstdc++ -static-libgcc -lm"
-G "MinGW Makefiles" \
-DARCH=ice40 \
-DBUILD_HEAP=ON \
-DBUILD_GUI=OFF \
-DBUILD_PYTHON=ON \
-DSTATIC_BUILD=ON \
-DICEBOX_ROOT=$PACKAGE_DIR/$NAME/share/icebox \
-DBoost_USE_STATIC_LIBS=ON \
.

$MAKE -j$J CXX="$CXX" VERBOSE=1
else
cmake \
-DARCH=ice40 \
Expand Down
Loading