Skip to content

Commit

Permalink
New crosstool-ng-based toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
lenary committed Jun 1, 2020
1 parent 1560e44 commit 66a7f8b
Show file tree
Hide file tree
Showing 16 changed files with 904 additions and 200 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ Head over to the
for pre-built toolchains.

* A GCC RV32IMC without hardfloat support, targeting [Ibex](https://github.com/lowRISC/ibex/)
* A GCC multilib toolchain
* A GCC elf multilib toolchain
* A GCC linux multilib toolchain, with linux user-space Qemu binaries

How to do a release
-------------------

1. Modify `RISCV_GNU_TOOLCHAIN_COMMIT_ID` in `azure-pipelines.yml` and
other build scripts and flags as needed.
1. Modify any of the following variables to configure the build:
- `CROSSTOOL_NG_VERSION` in `install-crosstool-ng.sh`
- `QEMU_VERSION` in `build-gcc-with-args.sh`

2. Push the changes or do a pull request, and wait for the pipeline to
2. Modify any of the `*.config` files to update the crosstool-ng configurations
for a particular toolchain.

3. Push the changes or do a pull request, and wait for the pipeline to
complete.

The build can be tested by downloading the Azure Pipeline artifacts.
Expand All @@ -27,14 +32,14 @@ How to do a release
3. Click on "Artifacts" (top right)
4. Download the desired artifact, and test it.

3. Tag a release
4. Tag a release

```bash
VERSION=$(date +%Y%m%d)-1
git tag -a -m "Release version $VERSION" $VERSION
```

4. Push the tag
5. Push the tag

```bash
git push origin $VERSION
Expand Down
15 changes: 15 additions & 0 deletions _build-deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This installs the build dependencies for:
# - using crosstool-ng to install a toolchain
# - building qemu
#
steps:
- bash: |
sudo apt-get install -y build-essential autoconf bison flex \
texinfo help2man gawk libtool-bin libncurses5-dev git libtool \
gettext wget curl libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev \
lld-9 clang-9 cmake
displayName: 'Install build dependencies'

- bash: |
./install-crosstool-ng.sh
displayName: 'Build and install crosstool-ng'
19 changes: 19 additions & 0 deletions _upload-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
steps:
- publish: $(Build.ArtifactStagingDirectory)
artifact: ${{ parameters.azure_name }}
displayName: "Upload Azure Artifact"

- task: GithubRelease@0
displayName: 'Upload GitHub Release (if tagged)'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: lowrisc-artifact-upload
repositoryName: lowrisc/lowrisc-toolchains
tagSource: manual
tag: "$(ReleaseTag)"
action: edit
addChangeLog: false
assetUploadMode: replace
isPreRelease: true
assets: |
$(Build.ArtifactStagingDirectory)/*.tar.xz
128 changes: 66 additions & 62 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Azure Pipelines CI build configuration
# Documentation at https://aka.ms/yaml

variables:
# commit reference in https://github.com/riscv/riscv-gnu-toolchain
RISCV_GNU_TOOLCHAIN_COMMIT_ID: 2e334e222d43bcde237c289385c977dcab81eda9

trigger:
batch: true
branches:
Expand All @@ -19,88 +15,96 @@ pr:
- '*'

jobs:
- job: "GCC_Ibex"
displayName: "RV32IMC GCC (Ibex)"
- job: "Toolchains_RV32IMC"
displayName: "GCC and Clang/LLVM toolchains targeting RV32IMC (Ibex)"
pool:
vmImage: "ubuntu-16.04"
timeoutInMinutes: 360
steps:
- template: "_build-deps.yml"

- bash: |
sudo apt-get install -y build-essential autoconf bison flex \
texinfo help2man gawk libtool-bin libncurses5-dev git libtool \
gettext wget curl
displayName: 'Install build dependencies'
./build-gcc-with-args.sh \
"lowrisc-toolchain-gcc-rv32imc" \
"riscv32-unknown-elf" \
"/tools/riscv" \
"-march=rv32imc" "-mabi=ilp32" "-mcmodel=medany"
displayName: 'Build GCC toolchain'
env:
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
- bash: |
./install-crosstool-ng.sh
displayName: 'Build and install crosstool-ng'
./build-clang-with-args.sh \
"lowrisc-toolchain-rv32imc" \
"riscv32-unknown-elf" \
"/tools/riscv" \
"-march=rv32imc" "-mabi=ilp32" "-mcmodel=medany"
displayName: "Build Clang toolchain"
env:
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
- template: "_upload-artifacts.yml"
parameters:
azure_name: rv32imc-toolchains

- job: "GCC_Multilib_Baremetal"
displayName: "RV64 GCC (Multilib Baremetal)"
condition: false
pool:
vmImage: "ubuntu-16.04"
timeoutInMinutes: 360
steps:
- template: "_build-deps.yml"

- bash: |
# crosstools-NG needs the ability to create and chmod the
# /tools/riscv directory.
sudo mkdir -p /tools \
&& sudo chmod 777 /tools \
&& mkdir -p /tools/riscv \
&& ./build-gcc-ibex.sh
./build-gcc-with-args.sh \
"lowrisc-toolchain-gcc-multilib-baremetal" \
"riscv64-unknown-elf" \
"/opt/riscv-baremetal-toolchain"
displayName: 'Build GCC toolchain'
env:
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
- publish: $(Build.ArtifactStagingDirectory)
artifact: gcc-ibex
displayName: "Upload GCC for Ibex as Azure artifact"
- bash: |
./build-clang-with-args.sh \
"lowrisc-toolchain-gcc-multilib-baremetal" \
"riscv64-unknown-elf" \
"/opt/riscv-baremetal-toolchain"
displayName: "Build Clang toolchain"
env:
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
- task: GithubRelease@0
displayName: 'Upload to GitHub releases'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: lowrisc-artifact-upload
repositoryName: lowrisc/lowrisc-toolchains
tagSource: manual
tag: "$(ReleaseTag)"
action: edit
addChangeLog: false
assetUploadMode: replace
assets: |
$(Build.ArtifactStagingDirectory)/*.tar.xz
- template: "_upload-artifacts.yml"
parameters:
azure_name: gcc-multilib-baremetal

- job: "GCC_Multilib"
displayName: "RV64 GCC (Multilib)"
- job: "GCC_Multilib_Linux"
displayName: "RV64 GCC (Multilib Linux)"
condition: false
pool:
vmImage: "ubuntu-16.04"
timeoutInMinutes: 360
steps:
- bash: |
# Dependencies as listed at
# https://github.com/riscv/riscv-gnu-toolchain
sudo apt-get install -y autoconf automake autotools-dev curl \
libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison \
flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
displayName: 'Install build dependencies'
- template: "_build-deps.yml"

- bash: |
sudo mkdir -p /tools/riscv \
&& sudo chmod 777 /tools/riscv \
&& ./build-gcc-multilib.sh
./build-gcc-with-args.sh \
"lowrisc-toolchain-gcc-multilib-linux" \
"riscv64-unknown-linux-gnu" \
"/opt/riscv-linux-toolchain"
displayName: 'Build GCC toolchain'
env:
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
- publish: $(Build.ArtifactStagingDirectory)
artifact: gcc-multilib
displayName: "Upload multilib GCC builds as Azure artifact"
- bash: |
./build-clang-with-args.sh \
"lowrisc-toolchain-gcc-multilib-linux" \
"riscv64-unknown-linux-gnu" \
"/opt/riscv-linux-toolchain"
displayName: "Build Clang toolchain"
env:
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
- task: GithubRelease@0
displayName: 'Upload to GitHub releases'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
gitHubConnection: lowrisc-artifact-upload
repositoryName: lowrisc/lowrisc-toolchains
tagSource: manual
tag: "$(ReleaseTag)"
action: edit
addChangeLog: false
assetUploadMode: replace
assets: |
$(Build.ArtifactStagingDirectory)/*.tar.xz
- template: "_upload-artifacts.yml"
parameters:
azure_name: gcc-multilib-linux
Loading

0 comments on commit 66a7f8b

Please sign in to comment.