-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathidfapp
More file actions
executable file
·47 lines (38 loc) · 1.08 KB
/
Copy pathidfapp
File metadata and controls
executable file
·47 lines (38 loc) · 1.08 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WRAP_SCRIPT="$ROOT_DIR/tools/idfwrap.sh"
usage() {
cat <<'EOF'
Usage:
./idfapp <app-path-relative-to-repo-root> [idf.py args...]
Examples:
./idfapp development/localization build
./idfapp legacy/micromouse-robot-main build
./idfapp development/localization -p /dev/ttyUSB0 flash monitor
./idfapp development/localization monitor
EOF
}
fail() {
echo "ERROR: $*" >&2
echo >&2
usage >&2
exit 1
}
APP_RELATIVE_PATH="${1:-}"
if [[ -z "$APP_RELATIVE_PATH" ]]; then
fail "Missing ESP-IDF app path."
fi
shift || true
APP_CANDIDATE="$ROOT_DIR/$APP_RELATIVE_PATH"
if [[ ! -e "$APP_CANDIDATE" ]]; then
fail "App path does not exist: $APP_RELATIVE_PATH"
fi
if [[ ! -d "$APP_CANDIDATE" ]]; then
fail "App path is not a directory: $APP_RELATIVE_PATH"
fi
APP_ABSOLUTE_PATH="$(cd "$APP_CANDIDATE" && pwd)"
if [[ ! -f "$APP_ABSOLUTE_PATH/CMakeLists.txt" ]]; then
fail "App path does not contain CMakeLists.txt: $APP_RELATIVE_PATH"
fi
IDFWRAP_APP="$APP_ABSOLUTE_PATH" exec "$WRAP_SCRIPT" "$@"