Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 0f099e1

Browse files
XykonIslam Wahdan
authored andcommitted
Integration MacMini (#5)
* Update Jenkinsfile, update version for first 1.20.0 RC New device name on MacMini New version 1.20.0.rc0 * Updated Jenkinsfile, application.mk Build IDF libraries in esp-idf/examples/wifi/scan Copy libraries from esp-idf/examples/wifi/scan during MPY build * Update Jenkinsfile Set IDF path before building libraries Reduce MPY build to 2 parallel tasks Use -C <dir> parameter with make * Update Jenkinsfile Build both Base and Pybytes revision Build IDF libs in it's own task, same with git-tag * Update Jenkinsfile Set PATH for python3 executable Fix missing space for VARIANT * Update Jenkinsfile Build BASE variant only for now Fix parallel build for variants * Updated Makefile, Jenkinsfile, makepkg.sh Allow specifying BUILD_DIR in Makefile rather than using VARIANT specific build directory Use BUILD_DIR in Jenkinsfile to build different variants Pass BUILD_DIR to makepkg.sh as optional parameter * Updated gitignore, application.mk Pass build directory to makepkg.sh script * Update Jenkinsfile Fix missing forward slashes * Update Jenkinsfile Build both BASE and PYBYTES * Update makepkg.sh Fix build directory check * Update makepkg.sh Disable debug output
1 parent 4c35148 commit 0f099e1

File tree

6 files changed

+78
-64
lines changed

6 files changed

+78
-64
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Build directory
2424
######################
2525
build/
26-
build-variant/
26+
build-*/
2727

2828
# Test failure outputs
2929
######################

Jenkinsfile

Lines changed: 59 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
11
def buildVersion
22
def boards_to_build = ["WiPy", "LoPy", "SiPy", "GPy", "FiPy", "LoPy4"]
3-
def boards_to_test = ["Pycom_Expansion3_Py00ec5f", "Pycom_Expansion3_Py9f8bf5"]
3+
def variants_to_build = [ "BASE", "PYBYTES"]
4+
def boards_to_test = ["1b6fa1"]
45

56
node {
67
// get pycom-esp-idf source
78
stage('Checkout') {
89
checkout scm
910
sh 'rm -rf esp-idf'
10-
sh 'git clone --depth=1 --recursive -b idf_dev https://github.com/pycom/pycom-esp-idf.git esp-idf'
11+
sh 'git clone --depth=1 --recursive -b idf_v3.1 https://github.com/pycom/pycom-esp-idf.git esp-idf'
1112
}
1213

13-
PYCOM_VERSION=get_version()
14-
GIT_TAG = sh (script: 'git rev-parse --short HEAD', returnStdout: true).trim()
14+
stage('git-tag') {
15+
PYCOM_VERSION=get_version()
16+
GIT_TAG = sh (script: 'git rev-parse --short HEAD', returnStdout: true).trim()
17+
sh 'git tag -fa v1.9.4-' + GIT_TAG + ' -m \\"v1.9.4-' + GIT_TAG + '\\"'
18+
}
19+
20+
stage('wifi_scan') {
21+
sh '''export PATH=$PATH:/opt/xtensa-esp32-elf/bin;
22+
export IDF_PATH=${WORKSPACE}/esp-idf;
23+
make -C esp-idf/examples/wifi/scan bootloader all'''
24+
}
1525

1626
stage('mpy-cross') {
1727
// build the cross compiler first
18-
sh 'git tag -fa v1.9.4-' + GIT_TAG + ' -m \\"v1.9.4-' + GIT_TAG + '''\\";
19-
cd mpy-cross;
20-
make clean;
21-
make all'''
28+
sh 'make -C mpy-cross clean all'
2229
}
2330

2431
for (board in boards_to_build) {
25-
stage(board) {
26-
def parallelSteps = [:]
27-
parallelSteps[board] = boardBuild(board)
28-
parallel parallelSteps
29-
}
30-
}
32+
stage(board) {
33+
def parallelSteps = [:]
34+
for (variant in variants_to_build) {
35+
board_variant = board + "_" + variant
36+
parallelSteps[board_variant] = boardBuild(board, variant)
37+
}
38+
parallel parallelSteps
39+
}
40+
}
3141

3242
stash includes: '**/*.bin', name: 'binary'
3343
stash includes: 'tests/**', name: 'tests'
@@ -36,44 +46,44 @@ node {
3646
stash includes: 'esp32/tools/**', name: 'esp32Tools'
3747
}
3848

39-
stage ('Flash') {
40-
def parallelFlash = [:]
41-
for (board in boards_to_test) {
42-
parallelFlash[board] = flashBuild(board)
43-
}
44-
parallel parallelFlash
45-
}
49+
for (variant in variants_to_build) {
4650

47-
stage ('Test'){
48-
def parallelTests = [:]
49-
for (board in boards_to_test) {
50-
parallelTests[board] = testBuild(board)
51-
}
52-
parallel parallelTests
53-
}
51+
stage ('Flash-' + variant) {
52+
def parallelFlash = [:]
53+
for (board in boards_to_test) {
54+
parallelFlash[board] = flashBuild(board, variant)
55+
}
56+
parallel parallelFlash
57+
}
5458

59+
stage ('Test-' + variant){
60+
def parallelTests = [:]
61+
for (board in boards_to_test) {
62+
parallelTests[board] = testBuild(board)
63+
}
64+
parallel parallelTests
65+
}
66+
}
5567

56-
def boardBuild(name) {
68+
def boardBuild(name, variant) {
5769
def name_u = name.toUpperCase()
5870
def name_short = name_u.split('_')[0]
5971
def app_bin = name.toLowerCase() + '.bin'
6072
return {
61-
release_dir = "${JENKINS_HOME}/release/${JOB_NAME}/" + PYCOM_VERSION + "/" + GIT_TAG + "/"
73+
release_dir = "${JENKINS_HOME}/release/${JOB_NAME}/" + PYCOM_VERSION + "/" + GIT_TAG + "/"
6274
sh '''export PATH=$PATH:/opt/xtensa-esp32-elf/bin;
6375
export IDF_PATH=${WORKSPACE}/esp-idf;
64-
cd esp32;
65-
make clean BOARD=''' + name_short
76+
make -C esp32 clean BOARD=''' + name_short + ' VARIANT=' + variant
6677

6778
sh '''export PATH=$PATH:/opt/xtensa-esp32-elf/bin;
6879
export IDF_PATH=${WORKSPACE}/esp-idf;
69-
cd esp32;
70-
make -j3 release BOARD=''' + name_short + ' RELEASE_DIR=' + release_dir
80+
make -C esp32 -j2 release BOARD=''' + name_short + ' BUILD_DIR=build-' + variant + ' RELEASE_DIR=' + release_dir + variant + '/' + ' VARIANT=' + variant
7181

72-
sh 'mv esp32/build/'+ name_u + '/release/application.elf ' + release_dir + name + "-" + PYCOM_VERSION + '-application.elf'
82+
sh 'mv esp32/build-' + variant + '/'+ name_u + '/release/application.elf ' + release_dir + variant + '/' + name + "-" + PYCOM_VERSION + '-application.elf'
7383
}
7484
}
7585

76-
def flashBuild(short_name) {
86+
def flashBuild(short_name, variant) {
7787
return {
7888
String device_name = get_device_name(short_name)
7989
String board_name_u = get_firmware_name(short_name)
@@ -87,7 +97,7 @@ def flashBuild(short_name) {
8797
sh 'python esp32/tools/pypic.py --port ' + device_name +' --enter'
8898
sh 'esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port ' + device_name +' --baud 921600 --before no_reset --after no_reset erase_flash'
8999
sh 'python esp32/tools/pypic.py --port ' + device_name +' --enter'
90-
sh 'esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port ' + device_name +' --baud 921600 --before no_reset --after no_reset write_flash -pz --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 esp32/build/'+ board_name_u +'/release/bootloader/bootloader.bin 0x8000 esp32/build/'+ board_name_u +'/release/lib/partitions.bin 0x10000 esp32/build/'+ board_name_u +'/release/' + board_name_u.toLowerCase() + '.bin'
100+
sh 'esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port ' + device_name +' --baud 921600 --before no_reset --after no_reset write_flash -pz --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 esp32/build-' + variant + '/' + board_name_u +'/release/bootloader/bootloader.bin 0x8000 esp32/build-' + variant + '/' + board_name_u +'/release/lib/partitions.bin 0x10000 esp32/build-' + variant + '/' + board_name_u +'/release/' + board_name_u.toLowerCase() + '.bin'
91101
sh 'python esp32/tools/pypic.py --port ' + device_name +' --exit'
92102
}
93103
}
@@ -97,16 +107,17 @@ def testBuild(short_name) {
97107
return {
98108
String device_name = get_device_name(short_name)
99109
String board_name_u = get_firmware_name(short_name)
100-
node(get_remote_name(short_name)) {
101-
sleep(5) //Delay to skip all bootlog
102-
dir('tests') {
103-
timeout(30) {
104-
// As some tests are randomly failing... enforce script always returns 0 (OK)
105-
sh './run-tests --target=esp32-' + board_name_u + ' --device ' + device_name + ' || exit 0'
106-
}
107-
}
108-
sh 'python esp32/tools/pypic.py --port ' + device_name +' --enter'
109-
sh 'python esp32/tools/pypic.py --port ' + device_name +' --exit'
110+
node(get_remote_name(short_name)) {
111+
sleep(5) //Delay to skip all bootlog
112+
dir('tests') {
113+
timeout(30) {
114+
// As some tests are randomly failing... enforce script always returns 0 (OK)
115+
sh '''export PATH=$PATH:/usr/local/bin;
116+
./run-tests --target=esp32-''' + board_name_u + ' --device ' + device_name + ' || exit 0'
117+
}
118+
}
119+
sh 'python esp32/tools/pypic.py --port ' + device_name +' --enter'
120+
sh 'python esp32/tools/pypic.py --port ' + device_name +' --exit'
110121
}
111122
}
112123
}
@@ -133,6 +144,6 @@ def get_remote_name(short_name) {
133144
}
134145

135146
def get_device_name(short_name) {
136-
return "/dev/serial/by-id/usb-" + short_name + "-if00"
147+
return "/dev/tty.usbmodemPy" + short_name + " "
137148
}
138149

esp32/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ BTYPE ?= release
2323

2424
# make Non-Pybytes firmware default
2525
VARIANT ?=BASE
26+
BUILD_DIR ?=build
2627

27-
ifeq ($(VARIANT), BASE)
28-
BUILD = build/$(BOARD)/$(BTYPE)
29-
else
30-
BUILD = build-variant/$(BOARD)/$(BTYPE)
31-
endif
28+
BUILD = $(BUILD_DIR)/$(BOARD)/$(BTYPE)
3229

3330
RELEASE_DIR ?= build/
3431

esp32/application.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,8 @@ $(BUILD)/bootloader/bootloader.a: $(BOOT_OBJ) sdkconfig.h
524524
$(Q) $(AR) cru $@ $^
525525

526526
$(BUILD)/bootloader/bootloader.elf: $(BUILD)/bootloader/bootloader.a $(SECURE_BOOT_VERIFICATION_KEY)
527-
# $(ECHO) "COPY IDF LIBRARIES $@"
528-
# $(Q) $(PYTHON) get_idf_libs.py --idflibs $(IDF_PATH)/examples/wifi/scan/build
527+
$(ECHO) "COPY IDF LIBRARIES $@"
528+
$(Q) $(PYTHON) get_idf_libs.py --idflibs $(IDF_PATH)/examples/wifi/scan/build
529529
ifeq ($(SECURE), on)
530530
# unpack libbootloader_support.a, and archive again using the right key for verifying signatures
531531
$(ECHO) "Inserting verification key $(SECURE_BOOT_VERIFICATION_KEY) in $@"
@@ -593,8 +593,8 @@ $(BUILD)/application.elf: $(BUILD)/application.a $(BUILD)/esp32_out.ld
593593
$(Q) $(SIZE) $@
594594
else
595595
$(BUILD)/application.elf: $(BUILD)/application.a $(BUILD)/esp32_out.ld $(SECURE_BOOT_VERIFICATION_KEY)
596-
# $(ECHO) "COPY IDF LIBRARIES $@"
597-
# $(Q) $(PYTHON) get_idf_libs.py --idflibs $(IDF_PATH)/examples/wifi/scan/build
596+
$(ECHO) "COPY IDF LIBRARIES $@"
597+
$(Q) $(PYTHON) get_idf_libs.py --idflibs $(IDF_PATH)/examples/wifi/scan/build
598598
ifeq ($(SECURE), on)
599599
# unpack libbootloader_support.a, and archive again using the right key for verifying signatures
600600
$(ECHO) "Inserting verification key $(SECURE_BOOT_VERIFICATION_KEY) in $@"
@@ -656,7 +656,7 @@ $(BUILD)/esp32_out.ld: $(ESP_IDF_COMP_PATH)/esp32/ld/esp32.ld sdkconfig.h
656656
endif #ifeq ($(TARGET), $(filter $(TARGET), app boot_app))
657657

658658
release: $(APP_BIN) $(BOOT_BIN)
659-
$(Q) tools/makepkg.sh $(BOARD) $(RELEASE_DIR)
659+
$(Q) tools/makepkg.sh $(BOARD) $(RELEASE_DIR) $(BUILD)
660660

661661
flash: $(APP_BIN) $(BOOT_BIN)
662662
$(ECHO) "checking size of image"

esp32/pycom_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef VERSION_H_
1111
#define VERSION_H_
1212

13-
#define SW_VERSION_NUMBER "1.18.1.r1"
13+
#define SW_VERSION_NUMBER "1.20.0.rc0"
1414

1515
#define LORAWAN_VERSION_NUMBER "1.0.2"
1616

esp32/tools/makepkg.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
#!/bin/bash
22
set -e
33
#set -x
4+
if [ -z $3 ]; then
5+
BUILD_DIR="$(pwd)/build/$1/release"
6+
else
7+
BUILD_DIR="$(pwd)/$3"
8+
fi
49
if [ -z $1 ]; then echo >&2 "Invalid board name!"; exit 1; fi
510
if ! [ $0 = "tools/makepkg.sh" ]; then echo >&2 "Need to run as tools/makepkg.sh!"; exit 1; fi
611
if ! [ -d boards/$1 ]; then echo >&2 "Unknown board type!"; exit 1; fi
7-
if ! [ -d build/$1 ]; then echo >&2 "Build directory for $1 not found! Run make BOARD=$1 first!"; exit 1; fi
12+
if ! [ -d ${BUILD_DIR} ]; then echo >&2 "Build directory for $1 not found! Run make BOARD=$1 first!"; exit 1; fi
813
if ! [ -r "pycom_version.h" ]; then echo >&2 "Cannot read pycom_version.h! Aborting."; exit 1; fi
914
if ! [ -r "tools/script2" ]; then echo >&2 "Cannot read tools/script2! Aborting."; exit 1; fi
1015
if ! [ -r "tools/script" ]; then echo >&2 "Cannot read legacy tools/script! Aborting."; exit 1; fi
16+
1117
if [ -z $2 ]; then
12-
RELEASE_DIR="$(pwd)/build"
18+
RELEASE_DIR="$(pwd)/${BUILD_DIR}"
1319
else
1420
RELEASE_DIR=$(realpath $2 2>/dev/null || echo $2)
15-
if ! [ -d $RELEASE_DIR ]; then
21+
if ! [ -d $RELEASE_DIR ]; then
1622
mkdir -p $RELEASE_DIR >/dev/null 2>&1 || { echo >&2 "Cannot create release directory! Aborting."; exit 1; }
1723
RELEASE_DIR=$(realpath $2 || echo $2)
1824
fi
@@ -21,12 +27,12 @@ else
2127
exit 1
2228
fi
2329
fi
30+
2431
echo "Creating release package in ${RELEASE_DIR}"
2532
BOARD_NAME=$(echo $1 | tr '[IOY]' '[ioy]')
2633
BOARD_NAME_L=$(echo ${BOARD_NAME} | tr '[A-Z]' '[a-z]')
2734
VERSION=$(cat pycom_version.h |grep SW_VERSION_NUMBER | cut -d'"' -f2)
2835
FILE_NAME="$BOARD_NAME-$VERSION.tar.gz"
29-
BUILD_DIR="build/$1/release"
3036
PKG_TMP_DIR="${BUILD_DIR}/firmware_package"
3137
mkdir -p ${PKG_TMP_DIR}
3238
cp ${BUILD_DIR}/bootloader/bootloader.bin ${PKG_TMP_DIR}

0 commit comments

Comments
 (0)