From c021d372b16dfcfae91196324f334b46ee39c68b Mon Sep 17 00:00:00 2001 From: BillyNate Date: Thu, 22 Feb 2024 15:21:44 +0000 Subject: [PATCH 1/5] Replaced the nrfjprog download script for nRF Command Line Tools download script which contains nrfjprog --- .../download/download-ubuntu-nrf-cli-tools.sh | 46 +++++++++++++++++++ scripts/download/download-ubuntu-nrfjprog.sh | 46 ------------------- 2 files changed, 46 insertions(+), 46 deletions(-) create mode 100755 scripts/download/download-ubuntu-nrf-cli-tools.sh delete mode 100755 scripts/download/download-ubuntu-nrfjprog.sh diff --git a/scripts/download/download-ubuntu-nrf-cli-tools.sh b/scripts/download/download-ubuntu-nrf-cli-tools.sh new file mode 100755 index 000000000..eb7ae8327 --- /dev/null +++ b/scripts/download/download-ubuntu-nrf-cli-tools.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +usage="$0 " + +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" diff --git a/scripts/download/download-ubuntu-nrfjprog.sh b/scripts/download/download-ubuntu-nrfjprog.sh deleted file mode 100755 index bd7066c72..000000000 --- a/scripts/download/download-ubuntu-nrfjprog.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -usage="$0 " - -WORKSPACE_DIR=${1:? "Usage: $usage"} - -NORDIC_DOWNLOAD_URL="https://www.nordicsemi.com/-/media/Software-and-other-downloads" - -DOWNLOAD_FILE="nRF-Command-Line-Tools_10_14_0_Linux64.zip" -DOWNLOAD_URL="${NORDIC_DOWNLOAD_URL}/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/10-14-0/$DOWNLOAD_FILE" -DEB_FILE="nrf-command-line-tools_10.14.0_amd64.deb" -MD5="8a049bacc67519561b77e014b652d5df" - -ZIP_FOLDER=./nRF-Command-Line-Tools_10_14_0_Linux64 - -DOWNLOAD_DIR="$WORKSPACE_DIR/downloads" -mkdir -p "$DOWNLOAD_DIR" -cd "$DOWNLOAD_DIR" - -SKIP_DOWNLOAD=0 -if [ -e "$DOWNLOAD_FILE" ]; then - md5=($(md5sum "$DOWNLOAD_FILE")) - if [ "$md5" = "$MD5" ]; 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 "$DOWNLOAD_FILE")) - if [ "$md5" != "$MD5" ]; then - echo "Checksum incorrect: $md5 != $MD5" - exit 1 - fi - unzip -n $DOWNLOAD_FILE -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 $ZIP_FOLDER/$DEB_FILE file using apt" -$SUPERUSER_SWITCH apt -y install "$ZIP_FOLDER/$DEB_FILE" From b4cddabac1d5aa99aa6d137ff64ab1ac84a3662a Mon Sep 17 00:00:00 2001 From: BillyNate Date: Thu, 22 Feb 2024 14:54:33 +0000 Subject: [PATCH 2/5] Updated the JLink download script to JLink version v7.94k and added support for different architectures --- scripts/download/download-ubuntu-jlink.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/download/download-ubuntu-jlink.sh b/scripts/download/download-ubuntu-jlink.sh index f033f1c87..1d57e1cd3 100755 --- a/scripts/download/download-ubuntu-jlink.sh +++ b/scripts/download/download-ubuntu-jlink.sh @@ -4,10 +4,16 @@ usage="$0 " 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" @@ -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 @@ -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 From f1cce476e373afd0c683422ec378135eadf609b9 Mon Sep 17 00:00:00 2001 From: BillyNate Date: Fri, 23 Feb 2024 14:40:05 +0100 Subject: [PATCH 3/5] Added support for different architectures to gcc-arm-none-eabi download script --- .../download-ubuntu-gcc-arm-none-eabi.sh | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/download/download-ubuntu-gcc-arm-none-eabi.sh b/scripts/download/download-ubuntu-gcc-arm-none-eabi.sh index 43e49b387..6ef0b5ca7 100755 --- a/scripts/download/download-ubuntu-gcc-arm-none-eabi.sh +++ b/scripts/download/download-ubuntu-gcc-arm-none-eabi.sh @@ -4,12 +4,23 @@ usage="$0 " 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" @@ -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 @@ -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 From fffdd042107480713afd7b2918d281e0e1d624fa Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 22 Feb 2024 16:39:24 +0100 Subject: [PATCH 4/5] Added instructions for downloading and installing gcc-arm-none-eabi, nrfjprog & j-link --- docs/INSTALL.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index e18d3a6e6..fdc909993 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -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: From 3c652475a6533b0b79b6bdff3e243c02417d8efb Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 19 Feb 2024 10:37:09 +0100 Subject: [PATCH 5/5] Corrected a missing `cd` --- docs/INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index fdc909993..42c49f8fd 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -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: