From 795e82858f45ab2f53d250e62814d9d0c907cd11 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sat, 3 Mar 2018 16:19:47 -0800 Subject: [PATCH 1/6] Adding conda environment example. This is a very light weight way of doing something similar to the litex-buildenv. --- README | 19 ++++++++++++++++++- environment.yml | 13 +++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 environment.yml diff --git a/README b/README index 02fdb5f59..1f8e4ca42 100644 --- a/README +++ b/README @@ -64,6 +64,23 @@ very easily! Migen documentation can be found here: https://m-labs.hk/migen/manual +[> Medium Quick start guide with Conda +----------------------------------------- + +0. Get miniconda by following instructions at https://conda.io/miniconda.html + +1. Clone LiteX + git clone --recurse-submodules https://github.com/enjoy-digital/litex.git + +2. Create a LiteX environment from environment.yml + conda env create -f environment.yml + +3. Enter conda environment + conda activate litex + +4. Build the target of your board...: + Go to boards/targets and execute the target you want to build + [> Quick start guide (for advanced users) ----------------------------------------- @@ -103,4 +120,4 @@ Migen documentation can be found here: https://m-labs.hk/migen/manual [> Contact ---------- -E-mail: florent [AT] enjoy-digital.fr \ No newline at end of file +E-mail: florent [AT] enjoy-digital.fr diff --git a/environment.yml b/environment.yml new file mode 100644 index 000000000..262e56bde --- /dev/null +++ b/environment.yml @@ -0,0 +1,13 @@ +name: litex +channels: + - timvideos +dependencies: + - python=3.6 + - pip + - binutils-lm32-elf + - gcc-lm32-elf-nostdc + - pip: + - git+https://github.com/m-labs/migen.git#egg=migen + - -e . + - git+https://github.com/enjoy-digital/liteeth.git#egg=liteeth + - git+https://github.com/enjoy-digital/litedram.git#egg=litedram From e65c121adf1870a56cc083e87347884a6b7e4f2b Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sat, 3 Mar 2018 16:20:27 -0800 Subject: [PATCH 2/6] Adding a travis config which tests the conda environment still works. --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..822ff36b1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: python +python: + - "3.6" + +install: + - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + - bash miniconda.sh -b -p $HOME/miniconda + - export PATH="$HOME/miniconda/bin:$PATH" + - hash -r + - conda config --set always_yes yes --set changeps1 no + +script: + - conda env create -f environment.yml + - source activate litex From 12bb3ebf7c3a56b3868ae4d31c1655f7a087827a Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sat, 3 Mar 2018 16:41:53 -0800 Subject: [PATCH 3/6] travis: Build all the SoCs (without gateware). - TODO: Build the simulator SoC. --- .travis-build-socs.sh | 15 +++++++++++++++ .travis.yml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 .travis-build-socs.sh diff --git a/.travis-build-socs.sh b/.travis-build-socs.sh new file mode 100755 index 000000000..44f943b6a --- /dev/null +++ b/.travis-build-socs.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -x +set -e + +source activate litex + +SOC_FILES=$(find litex/boards/targets -name \*.py | grep -v sim | grep -v "__") + +for SOC_FILE in $SOC_FILES; do + SOC=$(echo $SOC_FILE | sed -e's/\.py$//' -e's-/-.-g') + python -m $SOC --no-compile-gateware +done + +find soc_* | sort diff --git a/.travis.yml b/.travis.yml index 822ff36b1..b05a4b566 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ install: script: - conda env create -f environment.yml - - source activate litex + - ./.travis-build-socs.sh From da3189c8b5c7bdbf4e47dbf2e511ba121f450e10 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sat, 3 Mar 2018 16:46:38 -0800 Subject: [PATCH 4/6] travis: Making the output more readable. --- .travis-build-socs.sh | 24 +++++++++++++++++++----- .travis.yml | 6 ++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.travis-build-socs.sh b/.travis-build-socs.sh index 44f943b6a..df1b71f35 100755 --- a/.travis-build-socs.sh +++ b/.travis-build-socs.sh @@ -1,15 +1,29 @@ -#!/bin/bash +#!/usr/bin/env bash -set -x set -e source activate litex SOC_FILES=$(find litex/boards/targets -name \*.py | grep -v sim | grep -v "__") +COUNT=4 + for SOC_FILE in $SOC_FILES; do SOC=$(echo $SOC_FILE | sed -e's/\.py$//' -e's-/-.-g') - python -m $SOC --no-compile-gateware -done + TARGET=$(echo $SOC | sed -e's/.*\.//') -find soc_* | sort + travis_fold start "$SOC.1" + travis_time_start + echo "Building $TARGET ($SOC)" + echo "-------------------------------------------------------------------" + python -m $SOC --no-compile-gateware + echo "-------------------------------------------------------------------" + travis_time_finish + travis_fold end "$SOC.1" + travis_fold start "$SOC.2" + echo "Output of building $SOC" + echo "-------------------------------------------------------------------" + find soc_*$TARGET* | sort + echo "-------------------------------------------------------------------" + travis_fold end "$SOC.2" +done diff --git a/.travis.yml b/.travis.yml index b05a4b566..63553c88e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,12 @@ install: - hash -r - conda config --set always_yes yes --set changeps1 no +before_script: + - export -f travis_nanoseconds + - export -f travis_fold + - export -f travis_time_start + - export -f travis_time_finish + script: - conda env create -f environment.yml - ./.travis-build-socs.sh From 083c261364cbece280c676be52fff09b8522283c Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sat, 3 Mar 2018 17:37:43 -0800 Subject: [PATCH 5/6] travis: Move the conda install into script so it can be folded. --- .travis-build-socs.sh | 10 ++++++++++ .travis.yml | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis-build-socs.sh b/.travis-build-socs.sh index df1b71f35..2e3c274bd 100755 --- a/.travis-build-socs.sh +++ b/.travis-build-socs.sh @@ -2,7 +2,16 @@ set -e +travis_fold start "environment.create" +travis_time_start +echo "Setting up basic conda environment" +echo "-------------------------------------------------------------------" +conda env create -f environment.yml source activate litex +echo "-------------------------------------------------------------------" +travis_time_finish +travis_fold end "environment.create" +echo "-" SOC_FILES=$(find litex/boards/targets -name \*.py | grep -v sim | grep -v "__") @@ -26,4 +35,5 @@ for SOC_FILE in $SOC_FILES; do find soc_*$TARGET* | sort echo "-------------------------------------------------------------------" travis_fold end "$SOC.2" + echo "-" done diff --git a/.travis.yml b/.travis.yml index 63553c88e..f870e95e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,4 @@ before_script: - export -f travis_time_finish script: - - conda env create -f environment.yml - ./.travis-build-socs.sh From 3bf50479542dd3de7d4933c8e610663ed242ce33 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sat, 3 Mar 2018 18:09:05 -0800 Subject: [PATCH 6/6] travis: Adding some color. --- .travis-build-socs.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.travis-build-socs.sh b/.travis-build-socs.sh index 2e3c274bd..54cd4301f 100755 --- a/.travis-build-socs.sh +++ b/.travis-build-socs.sh @@ -2,16 +2,27 @@ set -e +# Some colors, use it like following; +# echo -e "Hello ${YELLOW}yellow${NC}" +GRAY='\033[0;30m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +PURPLE='\033[0;35m' +NC='\033[0m' # No Color + +SPACER="echo -e ${GRAY} - ${NC}" + travis_fold start "environment.create" travis_time_start -echo "Setting up basic conda environment" +echo -e "Setting up basic ${YELLOW}conda environment${NC}" echo "-------------------------------------------------------------------" conda env create -f environment.yml source activate litex echo "-------------------------------------------------------------------" travis_time_finish travis_fold end "environment.create" -echo "-" + +$SPACER SOC_FILES=$(find litex/boards/targets -name \*.py | grep -v sim | grep -v "__") @@ -23,17 +34,18 @@ for SOC_FILE in $SOC_FILES; do travis_fold start "$SOC.1" travis_time_start - echo "Building $TARGET ($SOC)" + echo -e "Building ${GREEN}${TARGET}${NC} (${PURPLE}${SOC}${NC})" echo "-------------------------------------------------------------------" python -m $SOC --no-compile-gateware echo "-------------------------------------------------------------------" travis_time_finish travis_fold end "$SOC.1" travis_fold start "$SOC.2" - echo "Output of building $SOC" + echo -e "Output of building ${GREEN}${TARGET}${NC} (${PURPLE}${SOC}${NC})" echo "-------------------------------------------------------------------" find soc_*$TARGET* | sort echo "-------------------------------------------------------------------" travis_fold end "$SOC.2" - echo "-" + + $SPACER done