Skip to content

Commit 3ed8693

Browse files
author
Seppo Takalo
committed
Temporary change Jenkinsfile to build example app
1 parent c71abfe commit 3ed8693

File tree

1 file changed

+88
-21
lines changed

1 file changed

+88
-21
lines changed

Jenkinsfile

Lines changed: 88 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,99 @@
1-
2-
// List of targets to compile
1+
// List of targets with supported RF shields to compile
32
def targets = [
4-
//"LPC1768",
5-
//"NUCLEO_F401RE",
6-
//"NRF51822",
7-
"K64F"
3+
"K64F": ["ATMEL", "MCR20"],
4+
//"NUCLEO_F401RE": ["ATMEL", "MCR20"],
5+
"NUCLEO_F429ZI": ["ATMEL", "MCR20"],
6+
//"NCS36510": ["NCS36510"],
7+
"UBLOX_EVK_ODIN_W2": ["ATMEL", "MCR20"]
88
]
99

10-
// Map toolchains to compiler labels on Jenkins
10+
// Map toolchains to compilers
1111
def toolchains = [
1212
ARM: "armcc",
13-
//IAR: "iar_arm",
14-
GCC_ARM: "arm-none-eabi-gcc"
13+
GCC_ARM: "arm-none-eabi-gcc",
14+
IAR: "iar_arm"
15+
]
16+
17+
// Supported RF shields
18+
def radioshields = [
19+
"ATMEL",
20+
"MCR20",
21+
"NCS36510"
1522
]
1623

17-
// mbed.getCurrentBranch returns either local branch name or reference to pull request
18-
def currentBranch = mbed.getCurrentBranch()
24+
// Mesh interfaces: 6LoWPAN and Thread
25+
def meshinterfaces = [
26+
"6lp",
27+
"thd"
28+
]
1929

20-
// Create a map of predefined build steps
21-
def parallelSteps = mbed.createParalleSteps("mbed-os", targets, toolchains)
30+
def stepsForParallel = [:]
2231

23-
// Run build steps parallel, map as paramater
24-
mbed.compile(parallelSteps)
32+
// Jenkins pipeline does not support map.each, we need to use oldschool for loop
33+
for (int i = 0; i < targets.size(); i++) {
34+
for(int j = 0; j < toolchains.size(); j++) {
35+
for(int k = 0; k < radioshields.size(); k++) {
36+
for(int l = 0; l < meshinterfaces.size(); l++) {
37+
def target = targets.keySet().asList().get(i)
38+
def allowed_shields = targets.get(target)
39+
def toolchain = toolchains.keySet().asList().get(j)
40+
def compilerLabel = toolchains.get(toolchain)
41+
def radioshield = radioshields.get(k)
42+
def meshInterface = meshinterfaces.get(l)
43+
def stepName = "${target} ${toolchain} ${radioshield} ${meshInterface}"
44+
if(allowed_shields.contains(radioshield)) {
45+
stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield, meshInterface)
46+
}
47+
}
48+
}
49+
}
50+
}
2551

26-
def testApps = [
27-
"mbed-os-cliapp",
28-
"mbed-client-testapp"
29-
]
52+
timestamps {
53+
parallel stepsForParallel
54+
}
55+
56+
def buildStep(target, compilerLabel, toolchain, radioShield, meshInterface) {
57+
return {
58+
stage ("${target}_${compilerLabel}_${radioShield}_${meshInterface}") {
59+
node ("${compilerLabel}") {
60+
deleteDir()
61+
execute ("git clone [email protected]:ARMmbed/mbed-os-example-mesh-minimal.git")
62+
dir("mbed-os-example-mesh-minimal") {
63+
64+
if ("${radioShield}" == "MCR20") {
65+
// Replace default rf shield
66+
execute("sed -i 's/\"value\": \"ATMEL\"/\"value\": \"MCR20\"/' mbed_app.json")
67+
}
68+
69+
if ("${radioShield}" == "NCS36510") {
70+
// Replace default rf shield
71+
execute("sed -i 's/\"value\": \"ATMEL\"/\"value\": \"NCS36510\"/' mbed_app.json")
72+
}
73+
74+
if ("${meshInterface}" == "thd") {
75+
// Change mesh interface to thread
76+
execute("sed -i 's/\"value\": \"MESH_LOWPAN\"/\"value\": \"MESH_THREAD\"/' mbed_app.json")
77+
78+
//Change operation mode to Thread router
79+
execute("sed -i 's/\"NANOSTACK\", \"LOWPAN_ROUTER\", \"COMMON_PAL\"/\"NANOSTACK\", \"THREAD_ROUTER\", \"COMMON_PAL\"/' mbed_app.json")
80+
}
81+
82+
if ("${meshInterface}" == "6lp") {
83+
// Use systest border router for testing
84+
execute("sed -i 's/\"mbed-mesh-api.6lowpan-nd-channel\": 12/\"mbed-mesh-api.6lowpan-nd-channel\": 18/' mbed_app.json")
85+
}
3086

31-
// buildTestApps accepts array of test application names and a mbed-os branch or PR reference as parameters
32-
mbed.buildTestApps(testApps, "${currentBranch}")
87+
execute ("mbed deploy --protocol ssh")
88+
// Checkout latest mbed-os master
89+
dir("mbed-os") {
90+
deleteDir()
91+
checkout scm
92+
}
93+
execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}_${meshInterface}/ -m ${target} -t ${toolchain} -c")
94+
}
95+
archive '**/mbed-os-example-mesh-minimal.bin'
96+
}
97+
}
98+
}
99+
}

0 commit comments

Comments
 (0)