8000 tools/autobuild: Automatically build all mimxrt, rp2 and samd boards. · salewski/micropython@1bd47db · GitHub
[go: up one dir, main page]

Skip to content

Commit 1bd47db

Browse files
committed
tools/autobuild: Automatically build all mimxrt, rp2 and samd boards.
Any board with a board.json file will be automatically built. Signed-off-by: Damien George <damien@micropython.org>
1 parent fa873ce commit 1bd47db

File tree

4 files changed

+62
-73
lines changed

4 files changed

+62
-73
lines changed

tools/autobuild/autobuild.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ fi
3939
# get directory of this script for access to other build scripts
4040
AUTODIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
4141

42+
# source additional functions
43+
source ${AUTODIR}/build-boards.sh
44+
4245
# make local directory to put firmware
4346
LOCAL_FIRMWARE=/tmp/autobuild-firmware-$$
4447
mkdir -p ${LOCAL_FIRMWARE}
@@ -71,10 +74,13 @@ ${AUTODIR}/build-esp8266-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
7174
cd ../esp32
7275
${AUTODIR}/build-esp32-latest.sh ${IDF_PATH_V42} ${FW_TAG} ${LOCAL_FIRMWARE}
7376
${AUTODIR}/build-esp32-latest.sh ${IDF_PATH_V43} ${FW_TAG} ${LOCAL_FIRMWARE}
74-
cd ../rp2
75-
${AUTODIR}/build-rp2-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
77+
7678
cd ../mimxrt
77-
${AUTODIR}/build-mimxrt-latest.sh ${FW_TAG} ${LOCAL_FIRMWARE}
79+
build_mimxrt_boards ${FW_TAG} ${LOCAL_FIRMWARE}
80+
cd ../rp2
81+
build_rp2_boards ${FW_TAG} ${LOCAL_FIRMWARE}
82+
cd ../samd
83+
build_samd_boards ${FW_TAG} ${LOCAL_FIRMWARE}
7884

7985
popd
8086

tools/autobuild/build-boards.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
#
3+
# The functions in this file can be run independently to build boards.
4+
# For example:
5+
#
6+
# $ source build-boards.sh
7+
# $ MICROPY_AUTOBUILD_MAKE=make build_rp2_boards -latest /tmp
8+
9+
function build_boards {
10+
# check/get parameters
11+
if [ $# -lt 4 ]; then
12+
echo "usage: $0 <fw-tag> <dest-dir> <check-file> <exts...>"
13+
return 1
14+
fi
15+
16+
fw_tag=$1
17+
dest_dir=$2
18+
check_file=$3
19+
shift
20+
shift
21+
shift
22+
23+
# check we are in the correct directory
24+
if [ ! -r $check_file ]; then
25+
echo "must be in directory containing $check_file"
26+
return 1
27+
fi
28+
29+
for board_json in $(find boards/ -name board.json); do
30+
board=$(echo $board_json | awk -F '/' '{ print $2 }')
31+
descr=$(cat $board_json | python3 -c "import json,sys; print(json.load(sys.stdin).get('id', '$board'))")
32+
build_dir=/tmp/micropython-build-$board
33+
34+
echo "building $descr $board"
35+
$MICROPY_AUTOBUILD_MAKE BOARD=$board BUILD=$build_dir || return 1
36+
for ext in $@; do
37+
mv $build_dir/firmware.$ext $dest_dir/$descr$fw_tag.$ext
38+
done
39+
rm -rf $build_dir
40+
done
41+
}
42+
43+
function build_mimxrt_boards {
44+
build_boards $1 $2 modmimxrt.c bin hex
45+
}
46+
47+
function build_rp2_boards {
48+
build_boards $1 $2 modrp2.c uf2
49+
}
50+
51+
function build_samd_boards {
52+
build_boards $1 $2 samd_soc.c uf2
53+
}

tools/autobuild/build-mimxrt-latest.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

tools/autobuild/build-rp2-latest.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0