blob: 3ce73a4cfcbd4fa1c83a84cc2ca56572129f62c7 [file] [log] [blame]
Fabio Utzig59bcb372019-03-07 13:20:02 -03001#!/bin/bash -x
2
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance
9# with the License. You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing,
14# software distributed under the License is distributed on an
15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16# KIND, either express or implied. See the License for the
17# specific language governing permissions and limitations
18# under the License.
19
20install_newt() {
21 pushd $HOME
22 git clone --depth=1 https://github.com/apache/mynewt-newt
23 [[ $? -ne 0 ]] && exit 1
24
25 pushd mynewt-newt && ./build.sh
26 [[ $? -ne 0 ]] && exit 1
27
28 cp newt/newt $HOME/bin
29 popd
30 popd
31}
32
33shallow_clone_mynewt() {
34 mkdir -p repos/apache-mynewt-core
35 git clone --depth=1 https://github.com/apache/mynewt-core repos/apache-mynewt-core
36 [[ $? -ne 0 ]] && exit 1
Jerzy Kasenberg7a4b1922023-05-09 10:58:06 +020037
38 # nrfx is now taken from original repository
Szymon Janc226e35b2024-02-23 15:30:26 +010039 git clone --depth=1 --branch v3.3.0 https://github.com/NordicSemiconductor/nrfx.git repos/nordic-nrfx
Jerzy Kasenberg7a4b1922023-05-09 10:58:06 +020040 [[ $? -ne 0 ]] && exit 1
Fabio Utzigb206b992023-08-09 14:55:53 -030041
42 # Mbed-TLS is now taken from original repository
Szymon Janc226e35b2024-02-23 15:30:26 +010043 git clone --depth=1 --branch v2.28.4 https://github.com/Mbed-TLS/mbedtls.git repos/mbedtls
44 [[ $? -ne 0 ]] && exit 1
45
46 # CMSIS is now taken from original repository
47 git clone --depth=1 --branch 5.4.0 https://github.com/ARM-software/CMSIS_5.git repos/arm-CMSIS_5
Fabio Utzigb206b992023-08-09 14:55:53 -030048 [[ $? -ne 0 ]] && exit 1
Fabio Utzig59bcb372019-03-07 13:20:02 -030049}
50
51arm_toolchain_install() {
52 TOOLCHAIN_PATH=$HOME/TOOLCHAIN
53
54 GCC_URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
55 GCC_BASE=gcc-arm-none-eabi-7-2017-q4-major
56
57 mkdir -p $TOOLCHAIN_PATH
58
59 if [ ! -s ${TOOLCHAIN_PATH}/$GCC_BASE/bin/arm-none-eabi-gcc ]; then
David Brown65643a62021-09-17 16:24:02 -060060 wget -O ${TOOLCHAIN_PATH}/${GCC_BASE}.tar.bz2 $GCC_URL
Fabio Utzig59bcb372019-03-07 13:20:02 -030061 [[ $? -ne 0 ]] && exit 1
62
63 tar xfj ${TOOLCHAIN_PATH}/${GCC_BASE}.tar.bz2 -C $TOOLCHAIN_PATH
64 fi
65
66 for i in ${TOOLCHAIN_PATH}/${GCC_BASE}/bin/arm-none-eabi-* ; do
67 rm -f $HOME/bin/${i##*/}
68 ln -s $i $HOME/bin/${i##*/}
69 done
70}
71
Szymon Janc22096882023-03-17 11:23:54 +010072native_test_setup() {
73 sudo apt-get update
74 sudo apt-get install -y gcc-multilib
75}
76
Fabio Utzig59bcb372019-03-07 13:20:02 -030077mkdir -p $HOME/bin
78export PATH=$HOME/bin:$PATH
79
80install_newt
81shallow_clone_mynewt
82arm_toolchain_install
Szymon Janc22096882023-03-17 11:23:54 +010083native_test_setup