|
| 1 | +// List of targets to compile |
| 2 | +def targets = [ |
| 3 | + "K64F" |
| 4 | + ] |
| 5 | + |
| 6 | +// Map toolchains to compilers |
| 7 | +def toolchains = [ |
| 8 | + ARM: "armcc", |
| 9 | + GCC_ARM: "arm-none-eabi-gcc", |
| 10 | + IAR: "iar_arm" |
| 11 | + ] |
| 12 | + |
| 13 | +def configurations = [ |
| 14 | + "default", |
| 15 | + "thread" |
| 16 | + ] |
| 17 | + |
| 18 | +def stepsForParallel = [:] |
| 19 | + |
| 20 | +// Jenkins pipeline does not support map.each, we need to use oldschool for loop |
| 21 | +for (int i = 0; i < targets.size(); i++) { |
| 22 | + for(int j = 0; j < toolchains.size(); j++) { |
| 23 | + for(int k = 0; k < configurations.size(); k++) { |
| 24 | + def target = targets.get(i) |
| 25 | + def toolchain = toolchains.keySet().asList().get(j) |
| 26 | + def compilerLabel = toolchains.get(toolchain) |
| 27 | + def config = configurations.get(k) |
| 28 | + |
| 29 | + def stepName = "${target} ${toolchain} ${config}" |
| 30 | + stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, config) |
| 31 | + } |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +timestamps { |
| 36 | + parallel stepsForParallel |
| 37 | +} |
| 38 | + |
| 39 | +def buildStep(target, compilerLabel, toolchain, configName) { |
| 40 | + return { |
| 41 | + stage ("${target}_${compilerLabel}_${configName}") { |
| 42 | + node ("${compilerLabel}") { |
| 43 | + deleteDir() |
| 44 | + dir("mbed-os-example-client") { |
| 45 | + checkout scm |
| 46 | + |
| 47 | + if ("${configName}" == "thread") { |
| 48 | + // Add IPV6 feature |
| 49 | + execute("sed -i 's/\"CLIENT\", \"COMMON_PAL\"/\"CLIENT\", \"IPV6\", \"COMMON_PAL\"/' mbed_app.json") |
| 50 | + // Change connection type to thread |
| 51 | + execute ("sed -i 's/\"value\": \"ETHERNET\"/\"value\": \"MESH_THREAD\"/' mbed_app.json") |
| 52 | + // Add atmel-rf-driver |
| 53 | + execute ("mbed add https://github.com/ARMmbed/atmel-rf-driver") |
| 54 | + } |
| 55 | + |
| 56 | + // Copy security.h to build |
| 57 | + mbed.getSecurityFile() |
| 58 | + |
| 59 | + execute ("mbed deploy --protocol ssh") |
| 60 | + execute ("mbed compile --build .build/${target}_${compilerLabel}_${configName}/ -m ${target} -t ${toolchain} -c") |
| 61 | + archive '**/mbed-os-example-client.bin' |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | + } |
| 66 | +} |
0 commit comments