-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·26 lines (23 loc) · 910 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
CURPWD=`pwd`
PROJNAME=${PWD##*/}
OCFBASEPATH=`jq --raw-output '.ocf_base_path' ${CURPWD}/${PROJNAME}-config.json`
#TODO Go through DeviceBuilder for each of the implementations and platforms (just doing the first array element for this example)
OCFSUBPATH=`jq --raw-output '.implementation_paths[0]' ${CURPWD}/${PROJNAME}-config.json`
OCFPATH="${OCFBASEPATH}${OCFSUBPATH}"
PLATFORM=`jq --raw-output '.platforms[0]' ${CURPWD}/${PROJNAME}-config.json`
if [ "$PLATFORM" == "esp32" ]; then
MY_COMMAND="cd ${OCFPATH}/iotivity-lite/port/${PLATFORM}/"
eval ${MY_COMMAND}
MY_COMMAND="idf.py -p /dev/ttyUSB0 flash monitor"
eval ${MY_COMMAND}
elif [ "$PLATFORM" == "arduino" ]; then
MY_COMMAND="cd ${OCFPATH}/iotivity-lite/port/${PLATFORM}/"
eval ${MY_COMMAND}
MY_COMMAND="./build_arduino.sh --arch sam --secure --upload"
eval ${MY_COMMAND}
else
cd ./bin
./${PROJNAME}
fi
cd ${CURPWD}