ADFWQEF

Committer:
rishat
Date:
Thu Nov 17 11:07:36 2022 +0000
Revision:
100:7c75f1700889
Parent:
98:ea4e2f0eadde
WEFDE

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 77:b74ac6641a3e 16 "UBLOX_EVK_ODIN_W2": ["internal"],
mbed_official 98:ea4e2f0eadde 17 //"REALTEK_RTL8195AM": ["internal"], // Disabled from Mbed OS after ArmCC6
mbed_official 77:b74ac6641a3e 18 "K64F": ["esp8266-driver"],
mbed_official 77:b74ac6641a3e 19 "NUCLEO_F429ZI": ["esp8266-driver"]
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 77:b74ac6641a3e 31 "internal",
mbed_official 77:b74ac6641a3e 32 "esp8266-driver"
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 // Set mbed-os to revision received as parameter
mbed_official 43:45429aa163a0 69 execute ("mbed deploy --protocol ssh")
mbed_official 43:45429aa163a0 70 if (params.mbed_os_revision != '') {
mbed_official 43:45429aa163a0 71 dir ("mbed-os") {
mbed_official 43:45429aa163a0 72 if (params.mbed_os_revision.matches('pull/\\d+/head')) {
mbed_official 43:45429aa163a0 73 execute("git fetch origin ${params.mbed_os_revision}:PR")
mbed_official 43:45429aa163a0 74 execute("git checkout PR")
mbed_official 43:45429aa163a0 75 } else {
mbed_official 43:45429aa163a0 76 execute ("git checkout ${params.mbed_os_revision}")
mbed_official 43:45429aa163a0 77 }
mbed_official 43:45429aa163a0 78 }
mbed_official 43:45429aa163a0 79 }
mbed_official 46:9282f93cd1ce 80 execute("mbed new .")
mbed_official 77:b74ac6641a3e 81
mbed_official 43:45429aa163a0 82 execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}")
mbed_official 43:45429aa163a0 83 }
mbed_official 43:45429aa163a0 84 stash name: "${target}_${toolchain}_${radioShield}", includes: '**/mbed-os-example-wifi.bin'
mbed_official 43:45429aa163a0 85 archive '**/mbed-os-example-wifi.bin'
mbed_official 43:45429aa163a0 86 step([$class: 'WsCleanup'])
mbed_official 43:45429aa163a0 87 }
mbed_official 43:45429aa163a0 88 }
mbed_official 43:45429aa163a0 89 }
mbed_official 43:45429aa163a0 90 }