Peng Jing Xuan
/
mbed-os-example-wifi-DISCO_IOTBOARD_MQTT_copy
0527
Jenkinsfile@58:8d4bde75ebb9, 2018-02-27 (annotated)
- Committer:
- adustm
- Date:
- Tue Feb 27 14:07:49 2018 +0100
- Revision:
- 58:8d4bde75ebb9
- Parent:
- 57:c8c960b825f0
Add DISCO_F413ZH (using ism43362 driver)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 43:45429aa163a0 | 1 | properties ([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [ |
mbed_official | 43:45429aa163a0 | 2 | [$class: 'StringParameterDefinition', name: 'mbed_os_revision', defaultValue: '', description: 'Revision of mbed-os to build. Use format "pull/PR-NUMBER/head" to access mbed-os PR'] |
mbed_official | 43:45429aa163a0 | 3 | ]]]) |
mbed_official | 43:45429aa163a0 | 4 | |
mbed_official | 43:45429aa163a0 | 5 | if (params.mbed_os_revision == '') { |
mbed_official | 43:45429aa163a0 | 6 | echo 'Use mbed OS revision from mbed-os.lib' |
mbed_official | 43:45429aa163a0 | 7 | } else { |
mbed_official | 43:45429aa163a0 | 8 | echo "Use mbed OS revisiong ${params.mbed_os_revision}" |
mbed_official | 43:45429aa163a0 | 9 | if (params.mbed_os_revision.matches('pull/\\d+/head')) { |
mbed_official | 43:45429aa163a0 | 10 | echo "Revision is a Pull Request" |
mbed_official | 43:45429aa163a0 | 11 | } |
mbed_official | 43:45429aa163a0 | 12 | } |
mbed_official | 43:45429aa163a0 | 13 | |
mbed_official | 43:45429aa163a0 | 14 | // List of targets with supported RF shields to compile |
mbed_official | 43:45429aa163a0 | 15 | def targets = [ |
mbed_official | 43:45429aa163a0 | 16 | "UBLOX_EVK_ODIN_W2": ["builtin"], |
mbed_official | 46:9282f93cd1ce | 17 | "NUCLEO_F401RE": ["WIFI_IDW0XX1"], |
adustm | 58:8d4bde75ebb9 | 18 | "DISCO_L475VG_IOT01A": ["WIFI_ISM43362"], |
adustm | 58:8d4bde75ebb9 | 19 | "DISCO_F413ZH": ["WIFI_ISM43362"] |
mbed_official | 43:45429aa163a0 | 20 | ] |
mbed_official | 43:45429aa163a0 | 21 | |
mbed_official | 43:45429aa163a0 | 22 | // Map toolchains to compilers |
mbed_official | 43:45429aa163a0 | 23 | def toolchains = [ |
mbed_official | 43:45429aa163a0 | 24 | ARM: "armcc", |
mbed_official | 43:45429aa163a0 | 25 | GCC_ARM: "arm-none-eabi-gcc", |
mbed_official | 43:45429aa163a0 | 26 | IAR: "IAR-linux" |
mbed_official | 43:45429aa163a0 | 27 | ] |
mbed_official | 43:45429aa163a0 | 28 | |
mbed_official | 43:45429aa163a0 | 29 | // Supported RF shields |
mbed_official | 43:45429aa163a0 | 30 | def radioshields = [ |
mbed_official | 43:45429aa163a0 | 31 | "builtin", |
adustm | 57:c8c960b825f0 | 32 | "WIFI_IDW0XX1" |
mbed_official | 43:45429aa163a0 | 33 | ] |
mbed_official | 43:45429aa163a0 | 34 | |
mbed_official | 43:45429aa163a0 | 35 | def stepsForParallel = [:] |
mbed_official | 43:45429aa163a0 | 36 | |
mbed_official | 43:45429aa163a0 | 37 | // Jenkins pipeline does not support map.each, we need to use oldschool for loop |
mbed_official | 43:45429aa163a0 | 38 | for (int i = 0; i < targets.size(); i++) { |
mbed_official | 43:45429aa163a0 | 39 | for(int j = 0; j < toolchains.size(); j++) { |
mbed_official | 43:45429aa163a0 | 40 | for(int k = 0; k < radioshields.size(); k++) { |
mbed_official | 43:45429aa163a0 | 41 | def target = targets.keySet().asList().get(i) |
mbed_official | 43:45429aa163a0 | 42 | def allowed_shields = targets.get(target) |
mbed_official | 43:45429aa163a0 | 43 | def toolchain = toolchains.keySet().asList().get(j) |
mbed_official | 43:45429aa163a0 | 44 | def compilerLabel = toolchains.get(toolchain) |
mbed_official | 43:45429aa163a0 | 45 | def radioshield = radioshields.get(k) |
mbed_official | 43:45429aa163a0 | 46 | |
mbed_official | 43:45429aa163a0 | 47 | def stepName = "${target} ${toolchain} ${radioshield}" |
mbed_official | 43:45429aa163a0 | 48 | if(allowed_shields.contains(radioshield)) { |
mbed_official | 43:45429aa163a0 | 49 | stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield) |
mbed_official | 43:45429aa163a0 | 50 | } |
mbed_official | 43:45429aa163a0 | 51 | } |
mbed_official | 43:45429aa163a0 | 52 | } |
mbed_official | 43:45429aa163a0 | 53 | } |
mbed_official | 43:45429aa163a0 | 54 | |
mbed_official | 43:45429aa163a0 | 55 | timestamps { |
mbed_official | 43:45429aa163a0 | 56 | parallel stepsForParallel |
mbed_official | 43:45429aa163a0 | 57 | } |
mbed_official | 43:45429aa163a0 | 58 | |
mbed_official | 43:45429aa163a0 | 59 | def buildStep(target, compilerLabel, toolchain, radioShield) { |
mbed_official | 43:45429aa163a0 | 60 | return { |
mbed_official | 43:45429aa163a0 | 61 | stage ("${target}_${compilerLabel}_${radioShield}") { |
mbed_official | 43:45429aa163a0 | 62 | node ("${compilerLabel}") { |
mbed_official | 43:45429aa163a0 | 63 | deleteDir() |
mbed_official | 43:45429aa163a0 | 64 | dir("mbed-os-example-wifi") { |
mbed_official | 43:45429aa163a0 | 65 | checkout scm |
mbed_official | 43:45429aa163a0 | 66 | def config_file = "mbed_app.json" |
mbed_official | 43:45429aa163a0 | 67 | |
mbed_official | 43:45429aa163a0 | 68 | if ("${radioShield}" != "internal") { |
mbed_official | 43:45429aa163a0 | 69 | // Replace default rf shield |
mbed_official | 43:45429aa163a0 | 70 | execute("sed -i 's/\"value\": \"internal\"/\"value\": \"${radioShield}\"/' ${config_file}") |
mbed_official | 43:45429aa163a0 | 71 | } |
mbed_official | 43:45429aa163a0 | 72 | |
mbed_official | 43:45429aa163a0 | 73 | // Set mbed-os to revision received as parameter |
mbed_official | 43:45429aa163a0 | 74 | execute ("mbed deploy --protocol ssh") |
mbed_official | 43:45429aa163a0 | 75 | if (params.mbed_os_revision != '') { |
mbed_official | 43:45429aa163a0 | 76 | dir ("mbed-os") { |
mbed_official | 43:45429aa163a0 | 77 | if (params.mbed_os_revision.matches('pull/\\d+/head')) { |
mbed_official | 43:45429aa163a0 | 78 | execute("git fetch origin ${params.mbed_os_revision}:PR") |
mbed_official | 43:45429aa163a0 | 79 | execute("git checkout PR") |
mbed_official | 43:45429aa163a0 | 80 | } else { |
mbed_official | 43:45429aa163a0 | 81 | execute ("git checkout ${params.mbed_os_revision}") |
mbed_official | 43:45429aa163a0 | 82 | } |
mbed_official | 43:45429aa163a0 | 83 | } |
mbed_official | 43:45429aa163a0 | 84 | } |
mbed_official | 46:9282f93cd1ce | 85 | execute("mbed new .") |
mbed_official | 43:45429aa163a0 | 86 | execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}") |
mbed_official | 43:45429aa163a0 | 87 | } |
mbed_official | 43:45429aa163a0 | 88 | stash name: "${target}_${toolchain}_${radioShield}", includes: '**/mbed-os-example-wifi.bin' |
mbed_official | 43:45429aa163a0 | 89 | archive '**/mbed-os-example-wifi.bin' |
mbed_official | 43:45429aa163a0 | 90 | step([$class: 'WsCleanup']) |
mbed_official | 43:45429aa163a0 | 91 | } |
mbed_official | 43:45429aa163a0 | 92 | } |
mbed_official | 43:45429aa163a0 | 93 | } |
mbed_official | 43:45429aa163a0 | 94 | } |