-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
407 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env bash | ||
|
||
# @file merge common helpers and script into a single script without dependencies | ||
# | ||
# | ||
# | ||
|
||
set -e | ||
|
||
# find script resources directory | ||
if [ -z "$TBD_PROJECT_DIR" ]; then | ||
scripts_srcs_dir="$(realpath -- $(dirname -- ${BASH_SOURCE[0]}))" | ||
else | ||
scripts_srcs_dir="$TBD_PROJECT_DIR/tools/resources" | ||
fi | ||
|
||
source "$scripts_srcs_dir/common_header.sh" | ||
|
||
# @brief parameter defaults | ||
# | ||
# | ||
tbd_logging_tag="bake_tools" | ||
script_files="$scripts_srcs_dir"/src/*.sh | ||
process_only=false | ||
header_file=$scripts_srcs_dir/common_header.sh | ||
|
||
# @brief parse command line options | ||
# | ||
# | ||
parse_args() { | ||
while [ $# -gt 0 ]; do | ||
arg=$1 | ||
|
||
case $arg in | ||
-o|--out-dir) | ||
out_dir=$2 | ||
shift | ||
;; | ||
-p|--process-ony) | ||
process_only=true | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
if [ $# -gt 0 ]; then | ||
script_files=$@ | ||
fi | ||
|
||
|
||
if [ -z "$out_dir" ]; then | ||
out_dir=$(dirname -- "$scripts_srcs_dir")/bin | ||
fi | ||
} | ||
|
||
|
||
parse_args $@ | ||
|
||
tbd_logi "writing baked script files to $out_dir" | ||
|
||
if ! [ -d "$out_dir" ]; then | ||
mkdir -p "$out_dir" | ||
fi | ||
|
||
for script_file in $script_files; do | ||
if ! [ -f "$script_file" ]; then | ||
tbd_loge "$script_file: input file not found" | ||
continue | ||
fi | ||
|
||
# remove .sh extension from final tool name | ||
out_file=$out_dir/$(basename -- ${script_file%.sh}) | ||
|
||
num_header_lines=$(awk '/-- END OF HEADER --/{ print NR; exit }' "$script_file") | ||
if [ -z "$num_header_lines" ]; then | ||
if $process_only; then | ||
continue | ||
fi | ||
|
||
if cp "$script_file" "$out_file"; then | ||
tbd_logi "$script_file: copied" | ||
else | ||
tbd_loge "$script_file: failed to copy" | ||
fi | ||
else | ||
if cat "$header_file" > "$out_file" \ | ||
&& tail -n +$num_header_lines "$script_file" >> $out_file | ||
then | ||
tbd_logi "$script_file: baked" | ||
else | ||
tbd_loge "$script_file: failed to bake" | ||
fi | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
tbd_logging_tag="tbd_gbd_emu" | ||
|
||
resource_path=$(dirname -- $(dirname -- ${BASH_SOURCE[0]}))/resources | ||
source "$resource_path/helpers.sh" | ||
|
||
project_dir=$(tbd_project_root) | ||
if [ -z "$project_dir" ]; then | ||
tbd_abort "could not find TBD project in path" | ||
fi | ||
|
||
if ! which xtensa-esp32s3-elf-gdb; then | ||
tbd_abort "debugger 'xtensa-esp32s3-elf-gdb' not in PATH, please activate ESP IDF using '. <idf-path>/export.sh'" | ||
fi | ||
|
||
symbols_file=${project_dir}/build/$1/ctag-tbd.elf | ||
if ! [ -f "$symbols_file" ]; then | ||
tbd_abort "symbols file does not exist, no file ${symbols_file}" | ||
fi | ||
|
||
exec xtensa-esp32s3-elf-gdb \ | ||
-x "$resource_path/device.gdb" \ | ||
"$symbols_file" \ | ||
$@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
tbd_logging_tag="tbd_gbd_emu" | ||
|
||
resource_path=$(dirname -- $(dirname -- ${BASH_SOURCE[0]}))/resources | ||
source "$resource_path/helpers.sh" | ||
|
||
project_dir=$(tbd_project_root) | ||
if [ -z "$project_dir" ]; then | ||
tbd_abort "could not find TBD project in path" | ||
fi | ||
|
||
if ! which xtensa-esp32s3-elf-gdb; then | ||
tbd_abort "debugger 'xtensa-esp32s3-elf-gdb' not in PATH, please activate ESP IDF using '. <idf-path>/export.sh'" | ||
fi | ||
|
||
symbols_file=$project_dir/build/emu/ctag-tbd.elf | ||
if ! [ -f "$symbols_file" ]; then | ||
tbd_abort "symbols file does not exist, no file ${symbols_file}" | ||
fi | ||
|
||
exec xtensa-esp32s3-elf-gdb \ | ||
-x "$resource_path/emu.gdb" \ | ||
"$symbols_file" \ | ||
$@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
|
||
resource_path=$(dirname -- $(dirname -- ${BASH_SOURCE[0]})) | ||
source "$resource_path/common_header.sh" | ||
|
||
# -- END OF HEADER -- | ||
|
||
tbd_logging_tag="tbd build" | ||
|
||
project_dir=$(tbd_project_root) | ||
if [ -z "$project_dir" ]; then | ||
tbd_abort "could not find TBD project in path" | ||
fi | ||
|
||
cmake_args= | ||
|
||
# @brief parse command line options | ||
# | ||
# All options unknown to tbb are passed on to CMake | ||
# | ||
parse_args() { | ||
while [ $# -gt 0 ]; do | ||
arg=$1 | ||
case $arg in | ||
--refresh) | ||
refresh=true | ||
;; | ||
--silent) | ||
tbd_cmd_verbosity="SILENT" | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
if [ $# -lt 1 ]; then | ||
tbd_abort "no platform specified" | ||
fi | ||
platform=$1 | ||
shift | ||
|
||
cmake_args=$@ | ||
} | ||
|
||
parse_args $@ | ||
tbd_get_platforms "$project_dir" | ||
|
||
|
||
|
||
# if [ -z "$ESP_IDF_VERSION" ] && [ $TBD_IN_CONTAINER -eq 1 ]; then | ||
# source "$TBD_IDF_ACTIVATE" | ||
# fi | ||
|
||
# if [ -z "$TBD_PROJECT_DIR" ]; then | ||
# TBD_TOOL_MAIN="$(dirname -- $(dirname -- ${BASH_SOURCE[0]}))/tbdtools/__main__.py" | ||
# else | ||
# cd "$TBD_PROJECT_DIR" | ||
# TBD_TOOL_MAIN="$TBD_PROJECT_DIR/tools/tbdtools/__main__.py" | ||
# fi | ||
|
||
# export | ||
|
||
# export LOGURU_LEVEL=DEBUG | ||
# platform="$1" | ||
# shift | ||
|
||
# exec python "$TBD_TOOL_MAIN" -p "${platform}" firmware $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
TBD_TOOL_MAIN="$(dirname -- $(dirname -- ${BASH_SOURCE[0]}))/tbdtools/__main__.py" | ||
export LOGURU_LEVEL=WARNING | ||
exec python "$TBD_TOOL_MAIN" $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ -z "$ESP_IDF_VERSION" ] || [ -z "$IDF_PYTHON_ENV_PATH" ]; then | ||
echo "no esp idf python env seems to be active, make sure to source export.sh from idf dir before running this script" | ||
exit 1 | ||
fi | ||
|
||
if ! echo pip install \ | ||
sphinx \ | ||
pydata-sphinx-theme \ | ||
sphinxcontrib-youtube \ | ||
breathe \ | ||
typer \ | ||
cxxheaderparser \ | ||
jinja2 \ | ||
GitPython \ | ||
loguru \ | ||
pyhumps \ | ||
pydantic \ | ||
pyyaml | ||
then | ||
echo "an error occurred during installation of TBD python dependencies" | ||
fi |
Oops, something went wrong.