Skip to content

Commit

Permalink
[script] fix to allow 'script/efr32-definitions' to be sourced from o…
Browse files Browse the repository at this point in the history
…utside the repo
  • Loading branch information
lmnotran committed May 3, 2024
1 parent a1a2aba commit b5c6e56
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions script/efr32-definitions
Expand Up @@ -35,9 +35,16 @@ if [[ -n ${BASH_SOURCE[0]} ]]; then
else
script_path="$0"
fi
script_dir="$(realpath "$(dirname "${script_path}")")"
repo_dir="$(dirname "${script_dir}")"
sdk_dir="${repo_dir}/third_party/silabs/gecko_sdk"

# Check if repo_dir is defined
if [ -z ${repo_dir+x} ]; then
script_dir="$(realpath "$(dirname "${script_path}")")"
repo_dir="$(dirname "${script_dir}")"
fi
# Check if gsdk_dir is defined
if [ -z ${gsdk_dir+x} ]; then
gsdk_dir="${repo_dir}/third_party/silabs/gecko_sdk"
fi

efr32_device_regex=""
efr32_device_regex+="\(efr32\)*" # Group 1 - efr32 (optional)
Expand Down Expand Up @@ -69,7 +76,7 @@ efr32_get_board_slcc()
# Find component file for latest revision of board
local board_slcc
board_slcc=$(
find "${sdk_dir}"/hardware/board/component -type f \( -name "${board}*" ! -name '*_support.slcc' \) \
find "${gsdk_dir}"/hardware/board/component -type f \( -name "${board}*" ! -name '*_support.slcc' \) \
| sort --version-sort \
| tail -n 1
)
Expand Down

0 comments on commit b5c6e56

Please sign in to comment.