nrfconnect_example.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) 2020 Project CHIP Authors
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. cd "$(dirname "$0")/../../examples"
  18. APP="$1"
  19. BOARD="$2"
  20. shift 2
  21. # Disable debug symbols and firmware build time to increase ccache hit ratio in CI
  22. COMMON_CI_FLAGS=(-DCONFIG_CHIP_DEBUG_SYMBOLS=n)
  23. if [[ ! -f "$APP/nrfconnect/CMakeLists.txt" || -z "$BOARD" ]]; then
  24. echo "Usage: $0 <application> <board>" >&2
  25. echo "Applications:" >&2
  26. ls */nrfconnect/CMakeLists.txt | awk -F/ '{print " "$1}' >&2
  27. exit 1
  28. fi
  29. set -x
  30. # Activate Matter environment
  31. source "../scripts/activate.sh"
  32. # Activate Zephyr environment
  33. [[ -n $ZEPHYR_BASE ]] && source "$ZEPHYR_BASE/zephyr-env.sh"
  34. # Use Zephyr SDK toolchain
  35. export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
  36. if [[ -z "$ZEPHYR_SDK_INSTALL_DIR" && -n "$NRF5_TOOLS_ROOT" ]]; then
  37. export ZEPHYR_SDK_INSTALL_DIR="$NRF5_TOOLS_ROOT"/zephyr-sdk-0.16.0
  38. fi
  39. # Set ccache base directory to improve the cache hit ratio
  40. export CCACHE_BASEDIR="$PWD/$APP/nrfconnect"
  41. env
  42. west build -p auto -b "$BOARD" -d "$APP/nrfconnect/build" "$APP/nrfconnect" -- "${COMMON_CI_FLAGS[@]}" "$@"