simple wifi test program. Will connect to an HTTP server for testing.

Fork of mbed-os-example-wifi-adv-wise-1530 by Alan Chuang

Committer:
chuanga
Date:
Fri Feb 22 13:13:10 2019 +0800
Revision:
0:3c5e2cc8251b
adding wifi example program for wise-1530 wifi module

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chuanga 0:3c5e2cc8251b 1 properties ([[$class: 'ParametersDefinitionProperty', parameterDefinitions: [
chuanga 0:3c5e2cc8251b 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']
chuanga 0:3c5e2cc8251b 3 ]]])
chuanga 0:3c5e2cc8251b 4
chuanga 0:3c5e2cc8251b 5 if (params.mbed_os_revision == '') {
chuanga 0:3c5e2cc8251b 6 echo 'Use mbed OS revision from mbed-os.lib'
chuanga 0:3c5e2cc8251b 7 } else {
chuanga 0:3c5e2cc8251b 8 echo "Use mbed OS revisiong ${params.mbed_os_revision}"
chuanga 0:3c5e2cc8251b 9 if (params.mbed_os_revision.matches('pull/\\d+/head')) {
chuanga 0:3c5e2cc8251b 10 echo "Revision is a Pull Request"
chuanga 0:3c5e2cc8251b 11 }
chuanga 0:3c5e2cc8251b 12 }
chuanga 0:3c5e2cc8251b 13
chuanga 0:3c5e2cc8251b 14 // List of targets with supported RF shields to compile
chuanga 0:3c5e2cc8251b 15 def targets = [
chuanga 0:3c5e2cc8251b 16 "UBLOX_EVK_ODIN_W2": ["internal"],
chuanga 0:3c5e2cc8251b 17 "REALTEK_RTL8195AM": ["internal"],
chuanga 0:3c5e2cc8251b 18 "K64F": ["esp8266-driver"],
chuanga 0:3c5e2cc8251b 19 "NUCLEO_F429ZI": ["esp8266-driver"]
chuanga 0:3c5e2cc8251b 20 ]
chuanga 0:3c5e2cc8251b 21
chuanga 0:3c5e2cc8251b 22 // Map toolchains to compilers
chuanga 0:3c5e2cc8251b 23 def toolchains = [
chuanga 0:3c5e2cc8251b 24 ARM: "armcc",
chuanga 0:3c5e2cc8251b 25 GCC_ARM: "arm-none-eabi-gcc",
chuanga 0:3c5e2cc8251b 26 IAR: "IAR-linux"
chuanga 0:3c5e2cc8251b 27 ]
chuanga 0:3c5e2cc8251b 28
chuanga 0:3c5e2cc8251b 29 // Supported RF shields
chuanga 0:3c5e2cc8251b 30 def radioshields = [
chuanga 0:3c5e2cc8251b 31 "internal",
chuanga 0:3c5e2cc8251b 32 "esp8266-driver"
chuanga 0:3c5e2cc8251b 33 ]
chuanga 0:3c5e2cc8251b 34
chuanga 0:3c5e2cc8251b 35 def stepsForParallel = [:]
chuanga 0:3c5e2cc8251b 36
chuanga 0:3c5e2cc8251b 37 // Jenkins pipeline does not support map.each, we need to use oldschool for loop
chuanga 0:3c5e2cc8251b 38 for (int i = 0; i < targets.size(); i++) {
chuanga 0:3c5e2cc8251b 39 for(int j = 0; j < toolchains.size(); j++) {
chuanga 0:3c5e2cc8251b 40 for(int k = 0; k < radioshields.size(); k++) {
chuanga 0:3c5e2cc8251b 41 def target = targets.keySet().asList().get(i)
chuanga 0:3c5e2cc8251b 42 def allowed_shields = targets.get(target)
chuanga 0:3c5e2cc8251b 43 def toolchain = toolchains.keySet().asList().get(j)
chuanga 0:3c5e2cc8251b 44 def compilerLabel = toolchains.get(toolchain)
chuanga 0:3c5e2cc8251b 45 def radioshield = radioshields.get(k)
chuanga 0:3c5e2cc8251b 46
chuanga 0:3c5e2cc8251b 47 def stepName = "${target} ${toolchain} ${radioshield}"
chuanga 0:3c5e2cc8251b 48 if(allowed_shields.contains(radioshield)) {
chuanga 0:3c5e2cc8251b 49 stepsForParallel[stepName] = buildStep(target, compilerLabel, toolchain, radioshield)
chuanga 0:3c5e2cc8251b 50 }
chuanga 0:3c5e2cc8251b 51 }
chuanga 0:3c5e2cc8251b 52 }
chuanga 0:3c5e2cc8251b 53 }
chuanga 0:3c5e2cc8251b 54
chuanga 0:3c5e2cc8251b 55 timestamps {
chuanga 0:3c5e2cc8251b 56 parallel stepsForParallel
chuanga 0:3c5e2cc8251b 57 }
chuanga 0:3c5e2cc8251b 58
chuanga 0:3c5e2cc8251b 59 def buildStep(target, compilerLabel, toolchain, radioShield) {
chuanga 0:3c5e2cc8251b 60 return {
chuanga 0:3c5e2cc8251b 61 stage ("${target}_${compilerLabel}_${radioShield}") {
chuanga 0:3c5e2cc8251b 62 node ("${compilerLabel}") {
chuanga 0:3c5e2cc8251b 63 deleteDir()
chuanga 0:3c5e2cc8251b 64 dir("mbed-os-example-wifi") {
chuanga 0:3c5e2cc8251b 65 checkout scm
chuanga 0:3c5e2cc8251b 66 def config_file = "mbed_app.json"
chuanga 0:3c5e2cc8251b 67
chuanga 0:3c5e2cc8251b 68 // Set mbed-os to revision received as parameter
chuanga 0:3c5e2cc8251b 69 execute ("mbed deploy --protocol ssh")
chuanga 0:3c5e2cc8251b 70 if (params.mbed_os_revision != '') {
chuanga 0:3c5e2cc8251b 71 dir ("mbed-os") {
chuanga 0:3c5e2cc8251b 72 if (params.mbed_os_revision.matches('pull/\\d+/head')) {
chuanga 0:3c5e2cc8251b 73 execute("git fetch origin ${params.mbed_os_revision}:PR")
chuanga 0:3c5e2cc8251b 74 execute("git checkout PR")
chuanga 0:3c5e2cc8251b 75 } else {
chuanga 0:3c5e2cc8251b 76 execute ("git checkout ${params.mbed_os_revision}")
chuanga 0:3c5e2cc8251b 77 }
chuanga 0:3c5e2cc8251b 78 }
chuanga 0:3c5e2cc8251b 79 }
chuanga 0:3c5e2cc8251b 80 execute("mbed new .")
chuanga 0:3c5e2cc8251b 81
chuanga 0:3c5e2cc8251b 82 execute ("mbed compile --build out/${target}_${toolchain}_${radioShield}/ -m ${target} -t ${toolchain} -c --app-config ${config_file}")
chuanga 0:3c5e2cc8251b 83 }
chuanga 0:3c5e2cc8251b 84 stash name: "${target}_${toolchain}_${radioShield}", includes: '**/mbed-os-example-wifi.bin'
chuanga 0:3c5e2cc8251b 85 archive '**/mbed-os-example-wifi.bin'
chuanga 0:3c5e2cc8251b 86 step([$class: 'WsCleanup'])
chuanga 0:3c5e2cc8251b 87 }
chuanga 0:3c5e2cc8251b 88 }
chuanga 0:3c5e2cc8251b 89 }
chuanga 0:3c5e2cc8251b 90 }