diff --git a/config/zephyr/generic/create.sh b/config/zephyr/generic/create.sh index 707ded3b..d335ebf8 100755 --- a/config/zephyr/generic/create.sh +++ b/config/zephyr/generic/create.sh @@ -15,7 +15,7 @@ if ! (( $CMAKE_VERSION_MAJOR_NUMBER > 3 || \ fi export PATH=~/.local/bin:"$PATH" -export ZEPHYR_VERSION="v0.12.4" +export ZEPHYR_VERSION="0.16.5" export ARCH=$(uname -m) pushd $FW_TARGETDIR >/dev/null @@ -23,35 +23,41 @@ pushd $FW_TARGETDIR >/dev/null west init zephyrproject pushd zephyrproject >/dev/null cd zephyr - git checkout zephyr-v2.6.0 + git checkout v3.6.0 cd .. west update + if [ "$PLATFORM" = "esp32_devkitc_wroom"] || [ "$PLATFORM" = "esp32c3_devkitm" ]; then + west blobs fetch hal_espressif + west zephyr-export + fi popd >/dev/null pip3 install -r zephyrproject/zephyr/scripts/requirements.txt --ignore-installed - if [ "$PLATFORM" = "host" ]; then - if [ "$ARCH" = "aarch64" ]; then - export TOOLCHAIN_VERSION=zephyr-sdk-0.13.1-linux-aarch64-setup.run - export ZEPHYR_VERSION="v0.13.1" - else - export TOOLCHAIN_VERSION=zephyr-sdk-0.12.4-x86_64-linux-setup.run - fi - else - if [ "$ARCH" = "aarch64" ]; then - export TOOLCHAIN_VERSION=zephyr-toolchain-arm-0.13.1-linux-aarch64-setup.run - export ZEPHYR_VERSION="v0.13.1" - else - export TOOLCHAIN_VERSION=zephyr-toolchain-arm-0.12.4-x86_64-linux-setup.run - fi + sdkfound=false + if [ -e ~/.zephyrrc ]; then + source ~/.zephyrrc + if [ -d $ZEPHYR_SDK_INSTALL_DIR ]; then + ln -s $ZEPHYR_SDK_INSTALL_DIR zephyr-sdk + sdkfound=true + fi fi + echo PLATFORM: $PLATFORM + if [ "$sdkfound" = false ]; then + export TOOLCHAIN_VERSION=zephyr-sdk-${ZEPHYR_VERSION}_linux-${ARCH}.tar.xz - wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/$ZEPHYR_VERSION/$TOOLCHAIN_VERSION - chmod +x $TOOLCHAIN_VERSION - ./$TOOLCHAIN_VERSION -- -d $(pwd)/zephyr-sdk -y + wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v$ZEPHYR_VERSION/$TOOLCHAIN_VERSION + chmod +x $TOOLCHAIN_VERSION + tar -xvf ./$TOOLCHAIN_VERSION + mv zephyr-sdk-${ZEPHYR_VERSION} zephyr-sdk - rm -rf $TOOLCHAIN_VERSION + rm -rf $TOOLCHAIN_VERSION + fi + pushd zephyr-sdk + ./setup.sh -t all -c -h + popd + echo FW_TARGET_DIR: ${FW_TARGET_DIR} export ZEPHYR_TOOLCHAIN_VARIANT=zephyr export ZEPHYR_SDK_INSTALL_DIR=$FW_TARGETDIR/zephyr-sdk @@ -67,7 +73,4 @@ pushd $FW_TARGETDIR >/dev/null touch mcu_ws/uros/rcl/rcl_yaml_param_parser/COLCON_IGNORE touch mcu_ws/uros/rclc/rclc_examples/COLCON_IGNORE - # Upgrade sphinx - pip install --force-reinstall Sphinx==4.2.0 - popd >/dev/null diff --git a/config/zephyr/generic/flash.sh b/config/zephyr/generic/flash.sh index 13fb4bef..448b6865 100755 --- a/config/zephyr/generic/flash.sh +++ b/config/zephyr/generic/flash.sh @@ -70,7 +70,7 @@ else source $FW_TARGETDIR/zephyrproject/zephyr/zephyr-env.sh - west flash + west flash ${UROS_EXTRA_FLASH_ARGS[@]} fi diff --git a/config/zephyr/generic/supported_platforms b/config/zephyr/generic/supported_platforms index fa108d62..5b8c810e 100644 --- a/config/zephyr/generic/supported_platforms +++ b/config/zephyr/generic/supported_platforms @@ -3,3 +3,6 @@ olimex-stm32-e407 nucleo_f401re nucleo_h743zi nucleo_f746zg +esp32_devkitc_wroom +esp32c3_devkitm +rpi_pico_w diff --git a/scripts/flash_firmware.sh b/scripts/flash_firmware.sh index 15192dbd..e8f72f17 100755 --- a/scripts/flash_firmware.sh +++ b/scripts/flash_firmware.sh @@ -4,6 +4,8 @@ set -e set -o nounset set -o pipefail +UROS_EXTRA_FLASH_ARGS="" + FW_TARGETDIR=$(pwd)/firmware PREFIX=$(ros2 pkg prefix micro_ros_setup) @@ -16,6 +18,11 @@ else exit 1 fi +if [[ -n "$@" ]]; then + UROS_EXTRA_FLASH_ARGS=("$@") +fi +export UROS_EXTRA_FLASH_ARGS + # Flash specific firmware folder if needed if [ -d "$PREFIX/config/$RTOS/generic" ]; then if [ -f $PREFIX/config/$RTOS/generic/flash.sh ]; then