DISCO-STM32L475VG-IOT01A WiFi Sensor Thingspeak

Dependencies:   LPS22HB LSM6DSL HTS221 LIS3MDL VL53L0X

Committer:
adustm
Date:
Tue Feb 27 10:59:23 2018 +0100
Revision:
57:c8c960b825f0
Parent:
55:23a0d1e8270a
Child:
58:8d4bde75ebb9
Remove ESP8266 from this example

Who changed what in which revision?

UserRevisionLine numberNew 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 adustm@gmail.com 55:23a0d1e8270a 18 "DISCO_L475VG_IOT01A": ["WIFI_ISM43362"]
mbed_official 43:45429aa163a0 19 ]
mbed_official 43:45429aa163a0 20
mbed_official 43:45429aa163a0 21 // Map toolchains to compilers
mbed_official 43:45429aa163a0 22 def toolchains = [
mbed_official 43:45429aa163a0 23 ARM: "armcc",
mbed_official 43:45429aa163a0 24 GCC_ARM: "arm-none-eabi-gcc",
mbed_official 43:45429aa163a0 25 IAR: "IAR-linux"
mbed_official 43:45429aa163a0 26 ]
mbed_official 43:45429aa163a0 27
mbed_official 43:45429aa163a0 28 // Supported RF shields
mbed_official 43:45429aa163a0 29 def radioshields = [
mbed_official 43:45429aa163a0 30 "builtin",
adustm 57:c8c960b825f0 31 "WIFI_IDW0XX1"
mbed_official 43:45429aa163a0 32 ]
mbed_official 43:45429aa163a0 33
mbed_official 43:45429aa163a0 34 def stepsForParallel = [:]
mbed_official 43:45429aa163a0 35
mbed_official 43:45429aa163a0 36 // Jenkins pipeline does not support map.each, we need to use oldschool for loop
mbed_official 43:45429aa163a0 37 for (int i = 0; i < targets.size(); i++) {
mbed_official 43:45429aa163a0 38 for(int j = 0; j < toolchains.size(); j++) {
mbed_official 43:45429aa163a0 39 for(int k = 0; k < radioshields.size(); k++) {
mbed_official 43:45429aa163a0 40 def target = targets.keySet().asList().get(i)
mbed_official 43:45429aa163a0 41 def allowed_shields = targets.get(target)
mbed_official 43:45429aa163a0 42 def toolchain = toolchains.keySet().asList().get(j)
mbed_official 43:45429aa163a0 43 def compilerLabel = toolchains.get(toolchain)
mbed_official 43:45429aa163a0 44 def radioshield = radioshields.get(k)
mbed_official 43:45429aa163a0 45
mbed_official 43:45429aa163a0 46 def stepName = "${target} ${toolchain} ${radioshield}"
mbed_official 43:45429aa163a0 47 if(allowed_shields.contains(radioshield)) {
mbed_official 43:45429aa163a0 48 stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield)
mbed_official 43:45429aa163a0 49 }
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 timestamps {
mbed_official 43:45429aa163a0 55 parallel stepsForParallel
mbed_official 43:45429aa163a0 56 }
mbed_official 43:45429aa163a0 57
mbed_official 43:45429aa163a0 58 def buildStep(target, compilerLabel, toolchain, radioShield) {
mbed_official 43:45429aa163a0 59 return {
mbed_official 43:45429aa163a0 60 stage ("${target}_${compilerLabel}_${radioShield}") {
mbed_official 43:45429aa163a0 61 node ("${compilerLabel}") {
mbed_official 43:45429aa163a0 62 deleteDir()
mbed_official 43:45429aa163a0 63 dir("mbed-os-example-wifi") {
mbed_official 43:45429aa163a0 64 checkout scm
mbed_official 43:45429aa163a0 65 def config_file = "mbed_app.json"
mbed_official 43:45429aa163a0 66
mbed_official 43:45429aa163a0 67 if ("${radioShield}" != "internal") {
mbed_official 43:45429aa163a0 68 // Replace default rf shield
mbed_official 43:45429aa163a0 69 execute("sed -i 's/\"value\": \"internal\"/\"value\": \"${radioShield}\"/' ${config_file}")
mbed_official 43:45429aa163a0 70 }
mbed_official 43:45429aa163a0 71
mbed_official 43:45429aa163a0 72 // Set mbed-os to revision received as parameter
mbed_official 43:45429aa163a0 73 execute ("mbed deploy --protocol ssh")
mbed_official 43:45429aa163a0 74 if (params.mbed_os_revision != '') {
mbed_official 43:45429aa163a0 75 dir ("mbed-os") {
mbed_official 43:45429aa163a0 76 if (params.mbed_os_revision.matches('pull/\\d+/head')) {
mbed_official 43:45429aa163a0 77 execute("git fetch origin ${params.mbed_os_revision}:PR")
mbed_official 43:45429aa163a0 78 execute("git checkout PR")
mbed_official 43:45429aa163a0 79 } else {
mbed_official 43:45429aa163a0 80 execute ("git checkout ${params.mbed_os_revision}")
mbed_official 43:45429aa163a0 81 }
mbed_official 43:45429aa163a0 82 }
mbed_official 43:45429aa163a0 83 }
mbed_official 46:9282f93cd1ce 84 execute("mbed new .")
mbed_official 43:45429aa163a0 85 execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}")
mbed_official 43:45429aa163a0 86 }
mbed_official 43:45429aa163a0 87 stash name: "${target}_${toolchain}_${radioShield}", includes: '**/mbed-os-example-wifi.bin'
mbed_official 43:45429aa163a0 88 archive '**/mbed-os-example-wifi.bin'
mbed_official 43:45429aa163a0 89 step([$class: 'WsCleanup'])
mbed_official 43:45429aa163a0 90 }
mbed_official 43:45429aa163a0 91 }
mbed_official 43:45429aa163a0 92 }
mbed_official 43:45429aa163a0 93 }