Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Jenkinsfile
- Committer:
- mbed_official
- Date:
- 2016-11-23
- Revision:
- 24:671ef092f6ca
- Parent:
- 21:6c1e9147037c
- Child:
- 26:b28ab71ff595
File content as of revision 24:671ef092f6ca:
// List of targets with supported RF shields to compile
def targets = [
  "K64F": ["ATMEL", "MCR20"],
  //"NUCLEO_F401RE": ["ATMEL", "MCR20"],
  "NUCLEO_F429ZI": ["ATMEL", "MCR20"],
  //"NCS36510": ["NCS36510"],
  "UBLOX_EVK_ODIN_W2": ["ATMEL", "MCR20"]
  ]
  
// Map toolchains to compilers
def toolchains = [
  ARM: "armcc",
  GCC_ARM: "arm-none-eabi-gcc",
  IAR: "iar_arm"
  ]
// Supported RF shields
def radioshields = [
  "ATMEL",
  "MCR20",
  "NCS36510"
  ]
// Mesh interfaces: 6LoWPAN and Thread
def meshinterfaces = [
  "6lp",
  "thd"
  ]
  
def stepsForParallel = [:]
// Jenkins pipeline does not support map.each, we need to use oldschool for loop
for (int i = 0; i < targets.size(); i++) {
  for(int j = 0; j < toolchains.size(); j++) {
    for(int k = 0; k < radioshields.size(); k++) {
      for(int l = 0; l < meshinterfaces.size(); l++) {
        def target = targets.keySet().asList().get(i)
        def allowed_shields = targets.get(target)
        def toolchain = toolchains.keySet().asList().get(j)
        def compilerLabel = toolchains.get(toolchain)
        def radioshield = radioshields.get(k)
        def meshInterface = meshinterfaces.get(l)
        def stepName = "${target} ${toolchain} ${radioshield} ${meshInterface}"
        if(allowed_shields.contains(radioshield)) {
          stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield, meshInterface)
        }
      }
    }
  }
}
timestamps {
  parallel stepsForParallel
}
def buildStep(target, compilerLabel, toolchain, radioShield, meshInterface) {
  return {
    stage ("${target}_${compilerLabel}_${radioShield}_${meshInterface}") {
      node ("${compilerLabel}") {
        deleteDir()
        dir("mbed-os-example-mesh-minimal") {
          checkout scm
          if ("${radioShield}" == "MCR20") {
            // Replace default rf shield
            execute("sed -i 's/\"value\": \"ATMEL\"/\"value\": \"MCR20\"/' mbed_app.json")
          }
          if ("${radioShield}" == "NCS36510") {
            // Replace default rf shield
            execute("sed -i 's/\"value\": \"ATMEL\"/\"value\": \"NCS36510\"/' mbed_app.json")
          }
          if ("${meshInterface}" == "thd") {
            // Change mesh interface to thread
            execute("sed -i 's/\"value\": \"MESH_LOWPAN\"/\"value\": \"MESH_THREAD\"/' mbed_app.json")
            // Change operation mode to Thread router
            execute("sed -i 's/\"NANOSTACK\", \"LOWPAN_ROUTER\", \"COMMON_PAL\"/\"NANOSTACK\", \"THREAD_ROUTER\", \"COMMON_PAL\"/' mbed_app.json")
            // Increase HEAP size
            execute("sed -i 's/\"mbed-mesh-api.heap-size\": 10000/\"mbed-mesh-api.heap-size\": 32000/' mbed_app.json")
            // Use systest Thread border router for testing (CH=18, PANID=BAAB)
            execute("sed -i 's/\"mbed-mesh-api.thread-config-channel\": 12/\"mbed-mesh-api.thread-config-channel\": 18/' mbed_app.json")
            execute("sed -i 's/\"mbed-mesh-api.thread-config-panid\": \"0xDEFA\"/\"mbed-mesh-api.thread-config-panid\": \"0xBAAB\"/' mbed_app.json")
            // Activate traces
            execute("sed -i 's/\"mbed-trace.enable\": false/\"mbed-trace.enable\": true/' mbed_app.json")
          }
          if ("${meshInterface}" == "6lp") {
          // Use systest border router for testing
            execute("sed -i 's/\"mbed-mesh-api.6lowpan-nd-channel\": 12/\"mbed-mesh-api.6lowpan-nd-channel\": 18/' mbed_app.json")
          }
  
          execute ("mbed deploy --protocol ssh")
          // Checkout latest mbed-os master
          dir("mbed-os") {
            execute ("git fetch origin master")
            execute ("git checkout FETCH_HEAD")
          }
          execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}_${meshInterface}/ -m ${target} -t ${toolchain} -c")
        }
        archive '**/mbed-os-example-mesh-minimal.bin'
      }
    }
  }
}