tfsd

Dependencies:   Servo GroveGPS Cayenne-LPP driver_mbed_TH02

Committer:
mbed_official
Date:
Tue Apr 10 16:30:22 2018 +0100
Revision:
10:b6d8d4e1cc57
Child:
14:b25fefabb634
Merge pull request #56 from ARMmbed/add_jenkinsfile

Jenkinsfile for Lora example
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-lorawan

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 10:b6d8d4e1cc57 1 properties ([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [
mbed_official 10:b6d8d4e1cc57 2 [$class: 'StringParameterDefinition', name: 'mbed_os_revision', defaultValue: '', description: 'Revision of mbed-os to build. To access mbed-os PR use format "pull/PR number/head"']
mbed_official 10:b6d8d4e1cc57 3 ]]])
mbed_official 10:b6d8d4e1cc57 4
mbed_official 10:b6d8d4e1cc57 5 if (env.MBED_OS_REVISION == null) {
mbed_official 10:b6d8d4e1cc57 6 echo 'First run in this branch, using default parameter values'
mbed_official 10:b6d8d4e1cc57 7 env.MBED_OS_REVISION = ''
mbed_official 10:b6d8d4e1cc57 8 }
mbed_official 10:b6d8d4e1cc57 9 if (env.MBED_OS_REVISION == '') {
mbed_official 10:b6d8d4e1cc57 10 echo 'Using mbed OS revision from mbed-os.lib'
mbed_official 10:b6d8d4e1cc57 11 } else {
mbed_official 10:b6d8d4e1cc57 12 echo "Using given mbed OS revision: ${env.MBED_OS_REVISION}"
mbed_official 10:b6d8d4e1cc57 13 if (env.MBED_OS_REVISION.matches('pull/\\d+/head')) {
mbed_official 10:b6d8d4e1cc57 14 echo "Revision is a Pull Request"
mbed_official 10:b6d8d4e1cc57 15 }
mbed_official 10:b6d8d4e1cc57 16 }
mbed_official 10:b6d8d4e1cc57 17
mbed_official 10:b6d8d4e1cc57 18 // Supported targets
mbed_official 10:b6d8d4e1cc57 19 def targets = [
mbed_official 10:b6d8d4e1cc57 20 "K64F",
mbed_official 10:b6d8d4e1cc57 21 "MTB_MTS_XDOT",
mbed_official 10:b6d8d4e1cc57 22 "MTB_MURATA_ABZ",
mbed_official 10:b6d8d4e1cc57 23 "MTS_MDOT_F411RE",
mbed_official 10:b6d8d4e1cc57 24 "DISCO_L072CZ_LRWAN1",
mbed_official 10:b6d8d4e1cc57 25 "MTB_ADV_WISE_1510"
mbed_official 10:b6d8d4e1cc57 26 ]
mbed_official 10:b6d8d4e1cc57 27
mbed_official 10:b6d8d4e1cc57 28 // Map toolchains to compilers
mbed_official 10:b6d8d4e1cc57 29 def toolchains = [
mbed_official 10:b6d8d4e1cc57 30 ARM: "armcc",
mbed_official 10:b6d8d4e1cc57 31 GCC_ARM: "arm-none-eabi-gcc",
mbed_official 10:b6d8d4e1cc57 32 IAR: "iar_arm",
mbed_official 10:b6d8d4e1cc57 33 ARMC6: "arm6"
mbed_official 10:b6d8d4e1cc57 34 ]
mbed_official 10:b6d8d4e1cc57 35
mbed_official 10:b6d8d4e1cc57 36 def stepsForParallel = [:]
mbed_official 10:b6d8d4e1cc57 37
mbed_official 10:b6d8d4e1cc57 38 // Jenkins pipeline does not support map.each, we need to use oldschool for loop
mbed_official 10:b6d8d4e1cc57 39 for (int i = 0; i < targets.size(); i++) {
mbed_official 10:b6d8d4e1cc57 40 for(int j = 0; j < toolchains.size(); j++) {
mbed_official 10:b6d8d4e1cc57 41 def target = targets.get(i)
mbed_official 10:b6d8d4e1cc57 42 def toolchain = toolchains.keySet().asList().get(j)
mbed_official 10:b6d8d4e1cc57 43 def compilerLabel = toolchains.get(toolchain)
mbed_official 10:b6d8d4e1cc57 44
mbed_official 10:b6d8d4e1cc57 45 // Skip unwanted combination
mbed_official 10:b6d8d4e1cc57 46 if (target == "MTB_MURATA_ABZ" && toolchain == "GCC_ARM") {
mbed_official 10:b6d8d4e1cc57 47 continue
mbed_official 10:b6d8d4e1cc57 48 }
mbed_official 10:b6d8d4e1cc57 49 if (target == "DISCO_L072CZ_LRWAN1" && toolchain == "GCC_ARM") {
mbed_official 10:b6d8d4e1cc57 50 continue
mbed_official 10:b6d8d4e1cc57 51 }
mbed_official 10:b6d8d4e1cc57 52
mbed_official 10:b6d8d4e1cc57 53 def stepName = "${target} ${toolchain}"
mbed_official 10:b6d8d4e1cc57 54
mbed_official 10:b6d8d4e1cc57 55 stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain)
mbed_official 10:b6d8d4e1cc57 56 }
mbed_official 10:b6d8d4e1cc57 57 }
mbed_official 10:b6d8d4e1cc57 58
mbed_official 10:b6d8d4e1cc57 59 timestamps {
mbed_official 10:b6d8d4e1cc57 60 parallel stepsForParallel
mbed_official 10:b6d8d4e1cc57 61 }
mbed_official 10:b6d8d4e1cc57 62
mbed_official 10:b6d8d4e1cc57 63 def buildStep(target, compilerLabel, toolchain) {
mbed_official 10:b6d8d4e1cc57 64 return {
mbed_official 10:b6d8d4e1cc57 65 stage ("${target}_${compilerLabel}") {
mbed_official 10:b6d8d4e1cc57 66 node ("${compilerLabel}") {
mbed_official 10:b6d8d4e1cc57 67 deleteDir()
mbed_official 10:b6d8d4e1cc57 68 dir("mbed-os-example-lorawan") {
mbed_official 10:b6d8d4e1cc57 69 checkout scm
mbed_official 10:b6d8d4e1cc57 70
mbed_official 10:b6d8d4e1cc57 71 if (isUnix()) {
mbed_official 10:b6d8d4e1cc57 72 sh "mbed deploy --protocol ssh"
mbed_official 10:b6d8d4e1cc57 73 } else {
mbed_official 10:b6d8d4e1cc57 74 bat "mbed deploy --protocol ssh"
mbed_official 10:b6d8d4e1cc57 75 }
mbed_official 10:b6d8d4e1cc57 76 // Set mbed-os to revision received as parameter
mbed_official 10:b6d8d4e1cc57 77 if (env.MBED_OS_REVISION != '') {
mbed_official 10:b6d8d4e1cc57 78 dir("mbed-os") {
mbed_official 10:b6d8d4e1cc57 79 if (env.MBED_OS_REVISION.matches('pull/\\d+/head')) {
mbed_official 10:b6d8d4e1cc57 80 // Use mbed-os PR and switch to branch created
mbed_official 10:b6d8d4e1cc57 81 if (isUnix()) {
mbed_official 10:b6d8d4e1cc57 82 sh "git fetch origin ${env.MBED_OS_REVISION}:_PR_"
mbed_official 10:b6d8d4e1cc57 83 sh "git checkout _PR_"
mbed_official 10:b6d8d4e1cc57 84 } else {
mbed_official 10:b6d8d4e1cc57 85 bat "git fetch origin ${env.MBED_OS_REVISION}:_PR_"
mbed_official 10:b6d8d4e1cc57 86 bat "git checkout _PR_"
mbed_official 10:b6d8d4e1cc57 87 }
mbed_official 10:b6d8d4e1cc57 88
mbed_official 10:b6d8d4e1cc57 89 } else {
mbed_official 10:b6d8d4e1cc57 90 if (isUnix()) {
mbed_official 10:b6d8d4e1cc57 91 sh "git checkout ${env.MBED_OS_REVISION}"
mbed_official 10:b6d8d4e1cc57 92 } else {
mbed_official 10:b6d8d4e1cc57 93 bat "git checkout ${env.MBED_OS_REVISION}"
mbed_official 10:b6d8d4e1cc57 94 }
mbed_official 10:b6d8d4e1cc57 95 }
mbed_official 10:b6d8d4e1cc57 96 }
mbed_official 10:b6d8d4e1cc57 97 }
mbed_official 10:b6d8d4e1cc57 98
mbed_official 10:b6d8d4e1cc57 99 // Adjust stack size and crystal values
mbed_official 10:b6d8d4e1cc57 100 if ("${target}" == "DISCO_L072CZ_LRWAN1") {
mbed_official 10:b6d8d4e1cc57 101 if (isUnix()) {
mbed_official 10:b6d8d4e1cc57 102 sh "sed -i 's/#define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x10U)/#define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x13U)/' \
mbed_official 10:b6d8d4e1cc57 103 mbed-os/targets/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_hal_rcc.h"
mbed_official 10:b6d8d4e1cc57 104 } else {
mbed_official 10:b6d8d4e1cc57 105 bat "sed -i 's/#define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x10U)/#define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x13U)/' \
mbed_official 10:b6d8d4e1cc57 106 mbed-os/targets/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_hal_rcc.h"
mbed_official 10:b6d8d4e1cc57 107 }
mbed_official 10:b6d8d4e1cc57 108 }
mbed_official 10:b6d8d4e1cc57 109
mbed_official 10:b6d8d4e1cc57 110 if ("${target}" == "MTB_MURATA_ABZ") {
mbed_official 10:b6d8d4e1cc57 111 if (isUnix()) {
mbed_official 10:b6d8d4e1cc57 112 sh "sed -i 's/define symbol __size_heap__ = 0x800;/define symbol __size_heap__ = 0x1000;/' \
mbed_official 10:b6d8d4e1cc57 113 mbed-os/targets/TARGET_STM/TARGET_STM32L0/TARGET_STM32L0x2xZ/device/TOOLCHAIN_IAR/stm32l082xZ.icf"
mbed_official 10:b6d8d4e1cc57 114 sh "sed -i 's/#define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x10U)/#define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x16U)/' \
mbed_official 10:b6d8d4e1cc57 115 mbed-os/targets/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_hal_rcc.h"
mbed_official 10:b6d8d4e1cc57 116 } else {
mbed_official 10:b6d8d4e1cc57 117 bat "sed -i 's/define symbol __size_heap__ = 0x800;/define symbol __size_heap__ = 0x1000;/' \
mbed_official 10:b6d8d4e1cc57 118 mbed-os/targets/TARGET_STM/TARGET_STM32L0/TARGET_STM32L0x2xZ/device/TOOLCHAIN_IAR/stm32l082xZ.icf"
mbed_official 10:b6d8d4e1cc57 119 bat "sed -i 's/#define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x10U)/#define RCC_HSICALIBRATION_DEFAULT ((uint32_t)0x16U)/' \
mbed_official 10:b6d8d4e1cc57 120 mbed-os/targets/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_hal_rcc.h"
mbed_official 10:b6d8d4e1cc57 121 }
mbed_official 10:b6d8d4e1cc57 122 }
mbed_official 10:b6d8d4e1cc57 123
mbed_official 10:b6d8d4e1cc57 124 if ("${target}" == "MTB_MTS_XDOT") {
mbed_official 10:b6d8d4e1cc57 125 if (isUnix()) {
mbed_official 10:b6d8d4e1cc57 126 sh "sed -i 's/define symbol __size_heap__ = 0x800;/define symbol __size_heap__ = 0x1800;/' \
mbed_official 10:b6d8d4e1cc57 127 mbed-os/targets/TARGET_STM/TARGET_STM32L1/TARGET_MTB_MTS_XDOT/device/TOOLCHAIN_IAR/stm32l152xc.icf"
mbed_official 10:b6d8d4e1cc57 128 } else {
mbed_official 10:b6d8d4e1cc57 129 bat "sed -i 's/define symbol __size_heap__ = 0x800;/define symbol __size_heap__ = 0x1800;/' \
mbed_official 10:b6d8d4e1cc57 130 mbed-os/targets/TARGET_STM/TARGET_STM32L1/TARGET_MTB_MTS_XDOT/device/TOOLCHAIN_IAR/stm32l152xc.icf"
mbed_official 10:b6d8d4e1cc57 131 }
mbed_official 10:b6d8d4e1cc57 132 }
mbed_official 10:b6d8d4e1cc57 133
mbed_official 10:b6d8d4e1cc57 134 if (isUnix()) {
mbed_official 10:b6d8d4e1cc57 135 sh "mbed compile --build out/${target}_${toolchain}/ -m ${target} -t ${toolchain} -c"
mbed_official 10:b6d8d4e1cc57 136 } else {
mbed_official 10:b6d8d4e1cc57 137 bat "mbed compile --build out/${target}_${toolchain}/ -m ${target} -t ${toolchain} -c"
mbed_official 10:b6d8d4e1cc57 138 }
mbed_official 10:b6d8d4e1cc57 139 }
mbed_official 10:b6d8d4e1cc57 140 stash name: "${target}_${toolchain}", includes: '**/mbed-os-example-lorawan.bin'
mbed_official 10:b6d8d4e1cc57 141 archive '**/mbed-os-example-lorawan.bin'
mbed_official 10:b6d8d4e1cc57 142 step([$class: 'WsCleanup'])
mbed_official 10:b6d8d4e1cc57 143 }
mbed_official 10:b6d8d4e1cc57 144 }
mbed_official 10:b6d8d4e1cc57 145 }
mbed_official 10:b6d8d4e1cc57 146 }