build.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env bash
  2. set -e
  3. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
  4. BASE_DIR="$( realpath "$DIR/../../../" )"
  5. echo "== freeRTOS Build =="
  6. # Add xtensa compiler to path
  7. export PATH=$PATH:$IDF_PATH/xtensa-esp32-elf/bin
  8. mkdir -p build_freertos && cd build_freertos
  9. CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug \
  10. -DUA_ENABLE_AMALGAMATION=OFF \
  11. -DCMAKE_TOOLCHAIN_FILE=${IDF_PATH}/tools/cmake/toolchain-esp32.cmake \
  12. -DUA_ARCHITECTURE=freertosLWIP \
  13. -DUA_ARCH_EXTRA_INCLUDES=${IDF_PATH}/components/freertos/include/freertos \
  14. -DUA_BUILD_EXAMPLES=OFF"
  15. # We first need to call cmake separately to generate the required source code. Then we can call the freeRTOS CMake
  16. mkdir lib && cd lib
  17. cmake \
  18. ${CMAKE_ARGS} \
  19. ${BASE_DIR}
  20. if [ $? -ne 0 ] ; then exit 1 ; fi
  21. make -j open62541-code-generation
  22. if [ $? -ne 0 ] ; then exit 1 ; fi
  23. # Now call the freeRTOS CMake with same arguments
  24. cd ..
  25. cmake \
  26. ${CMAKE_ARGS} \
  27. ${BASE_DIR}/tools/azure-devops/freeRTOS/
  28. if [ $? -ne 0 ] ; then exit 1 ; fi
  29. # NOTE!!!
  30. # If you came here to see how to build your own version for the ESP32,
  31. # make sure to call `make menuconfig` first and configure the options.
  32. make hello-world.elf
  33. if [ $? -ne 0 ] ; then exit 1 ; fi