Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update download scripts and corresponding docs #203

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
20 changes: 19 additions & 1 deletion docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The best way is to first [fork](https://github.com/crownstone/bluenet/fork) the

Create a workspace folder where all the necessary files and folders will be stored, e.g.

mkdir -p ~/workspace
mkdir -p ~/workspace && cd ~/workspace

and download the code:

Expand All @@ -34,6 +34,24 @@ and set the correct upstream:
cd bluenet
git remote add upstream git@github.com:crownstone/bluenet.git

## Install additional needed packages

In order to build Bluenet a cross compiler is needed. Download and install `gcc-arm-none-eabi` using the download script:

./scripts/download/download-ubuntu-gcc-arm-none-eabi.sh ~/workspace

If you want to flash the build binaries to an nRF chip, you'll also need `nrfjprog` and `J-Link`. Otherwise set `REQUIRE_NRFJPROG` and `REQUIRE_JLINK` to `NO` in `CMakeLists.txt`.

Download and install the `nRF Command Line Tools` containing nrfjprog using the download script:

./scripts/download/download-ubuntu-nrf-cli-tools.sh ~/workspace

Install J-Link as well afterwards:

sudo apt install /opt/nrf-command-line-tools/share/JLink_Linux_*.deb

Now everything should be ready to start a build.

## Setup

The installation uses CMake. To start, you can simply use:
Expand Down
23 changes: 17 additions & 6 deletions scripts/download/download-ubuntu-gcc-arm-none-eabi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@ usage="$0 <workspace path>"

WORKSPACE_DIR=${1:? "Usage: $usage"}

ARCH=$(dpkg --print-architecture)
if [ "$ARCH" == "arm64" ]; then
ARCH="aarch64"
fi

if [[ "$ARCH" != "aarch64" && "$ARCH" != "x86_64" ]]; then
echo "Architecture not supported by download script. Maybe you'll find a fit at https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/tag/v10.3.1-2.2"
exit 1
fi

# After extraction
DOWNLOAD_DIR="gcc-arm-none-eabi-10.3-2021.10"

DOWNLOAD_FILE="gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2"
DOWNLOAD_FILE="gcc-arm-none-eabi-10.3-2021.10-${ARCH}-linux.tar.bz2"
DOWNLOAD_URL="https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/$DOWNLOAD_FILE"
MD5="2383e4eb4ea23f248d33adc70dc3227e"
declare -A MD5
MD5=( ["aarch64"]="3fe3d8bb693bd0a6e4615b6569443d0d" ["x86_64"]="2383e4eb4ea23f248d33adc70dc3227e" )

TOOLS_DIR="$WORKSPACE_DIR/tools"
mkdir -p "$TOOLS_DIR"
Expand All @@ -18,7 +29,7 @@ cd "$TOOLS_DIR"
SKIP_DOWNLOAD=0
if [ -e "$DOWNLOAD_FILE" ]; then
md5=($(md5sum "$DOWNLOAD_FILE"))
if [ "$md5" = "$MD5" ]; then
if [ "$md5" = "${MD5[$ARCH]}" ]; then
SKIP_DOWNLOAD=1
fi
fi
Expand All @@ -28,12 +39,12 @@ if [ $SKIP_DOWNLOAD -eq 1 ]; then
else
wget --no-verbose --show-progress --progress=dot:giga --timestamping "$DOWNLOAD_URL"
md5=($(md5sum "$DOWNLOAD_FILE"))
if [ "$md5" != "$MD5" ]; then
echo "Checksum incorrect: $md5 != $MD5"
if [ "$md5" != "${MD5[$ARCH]}" ]; then
echo "Checksum incorrect: $md5 != ${MD5[$ARCH]}"
exit 1
fi
echo "Extract file"
tar -xf $DOWNLOAD_FILE
tar -xf $DOWNLOAD_FILE --checkpoint=.100
echo "Create symlink"
rm -f gcc_arm_none_eabi
ln -s "$DOWNLOAD_DIR" gcc_arm_none_eabi
Expand Down
16 changes: 11 additions & 5 deletions scripts/download/download-ubuntu-jlink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ usage="$0 <workspace path>"

WORKSPACE_DIR=${1:? "Usage: $usage"}

ARCH=$(dpkg --print-architecture)
if [ "$ARCH" == "armhf" ]; then
ARCH="arm"
fi

SEGGER_DOWNLOAD_URL=https://www.segger.com/downloads/jlink

DEB_FILE=JLink_Linux_V760b_x86_64.deb
MD5=4b0e24a040a74117a041807536372846
DEB_FILE="JLink_Linux_V794k_${ARCH}.deb"
declare -A MD5
MD5=( ["arm"]="4c2ccd326cae510b0798c525e705577b" ["arm64"]="1f895a0ea4aeba658d1247ce335b4d9e" ["i386"]="c39f3e1f581da2e712709163d5fa6b76" ["x86_64"]="e001bf6e53f1bab1c44438dc5fefb38a" )

DOWNLOAD_URL="$SEGGER_DOWNLOAD_URL/$DEB_FILE"

Expand All @@ -18,7 +24,7 @@ cd "$DOWNLOAD_DIR"
SKIP_DOWNLOAD=0
if [ -e "$DEB_FILE" ]; then
md5=($(md5sum "$DEB_FILE"))
if [ "$md5" = "$MD5" ]; then
if [ "$md5" = "${MD5[$ARCH]}" ]; then
SKIP_DOWNLOAD=1
fi
fi
Expand All @@ -28,8 +34,8 @@ if [ $SKIP_DOWNLOAD -eq 1 ]; then
else
wget --no-verbose --show-progress --progress=dot:giga --timestamping --post-data "accept_license_agreement=accepted&non_emb_ctr=confirmed" "$DOWNLOAD_URL"
md5=($(md5sum "$DEB_FILE"))
if [ "$md5" != "$MD5" ]; then
echo "Checksum incorrect: $md5 != $MD5"
if [ "$md5" != "${MD5[$ARCH]}" ]; then
echo "Checksum incorrect: $md5 != ${MD5[$ARCH]}"
exit 1
fi
fi
Expand Down
46 changes: 46 additions & 0 deletions scripts/download/download-ubuntu-nrf-cli-tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

usage="$0 <workspace path>"

WORKSPACE_DIR=${1:? "Usage: $usage"}

ARCH=$(dpkg --print-architecture)

NORDIC_DOWNLOAD_URL="https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x/10-24-0"

DEB_FILE="nrf-command-line-tools_10.24.0_${ARCH}.deb"
declare -A MD5
MD5=( ["armhf"]="8d52a5fb10e7ed7d93aefb2a143f9571" ["arm64"]="c218aad31c324aaea0ea535f0b844efd" ["amd64"]="426f5550963e57b0f897c3ae7f4136fb" )

DOWNLOAD_URL="$NORDIC_DOWNLOAD_URL/$DEB_FILE"

DOWNLOAD_DIR="$WORKSPACE_DIR/downloads"
mkdir -p "$DOWNLOAD_DIR"
cd "$DOWNLOAD_DIR"

SKIP_DOWNLOAD=0
if [ -e "$DEB_FILE" ]; then
md5=($(md5sum "$DEB_FILE"))
if [ "$md5" = "${MD5[$ARCH]}" ]; then
SKIP_DOWNLOAD=1
fi
fi

if [ $SKIP_DOWNLOAD -eq 1 ]; then
echo "Skip download. Already file with proper checksum downloaded."
else
wget --no-verbose --show-progress --progress=dot:giga --timestamping "$DOWNLOAD_URL"
md5=($(md5sum "$DEB_FILE"))
if [ "$md5" != "${MD5[$ARCH]}" ]; then
echo "Checksum incorrect: $md5 != ${MD5[$ARCH]}"
exit 1
fi
fi

# Allow for prefix 'SUPERUSER_SWITCH= ' (empty) or 'SUPERUSER_SWITCH=su for systems without sudo
if [ -z ${SUPERUSER_SWITCH+set} ]; then
SUPERUSER_SWITCH=sudo
fi

echo "Install $DEB_FILE file using apt"
$SUPERUSER_SWITCH apt -y install "./$DEB_FILE"
46 changes: 0 additions & 46 deletions scripts/download/download-ubuntu-nrfjprog.sh

This file was deleted.