Tools: Migration of ESP32 targets from idf 4.4 to 5.3 consisting of:

- Updated installation scripts of esp-idf toolchain;
- Adding ESP_PLATFORM define to ESP32 targets, it is required to compile FreeRTOS with idf 5.3;
This commit is contained in:
ARg 2024-09-25 12:10:08 +02:00 committed by Andrew Tridgell
parent 1ef0f1a63f
commit f3a39105b9
2 changed files with 31 additions and 19 deletions

View File

@ -57,6 +57,7 @@ class Board:
def srcpath(path): def srcpath(path):
return cfg.srcnode.make_node(path).abspath() return cfg.srcnode.make_node(path).abspath()
env.SRCROOT = srcpath('') env.SRCROOT = srcpath('')
self.configure_env(cfg, env) self.configure_env(cfg, env)
# Setup scripting: # Setup scripting:
@ -1002,7 +1003,7 @@ class esp32(Board):
) )
tt = self.name[5:] #leave off 'esp32' so we just get 'buzz','diy','icarus, etc tt = self.name[5:] #leave off 'esp32' so we just get 'buzz','diy','icarus, etc
# this makes sure we get the correct subtype # this makes sure we get the correct subtype
env.DEFINES.update( env.DEFINES.update(
CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_ESP32_%s' % tt.upper() , CONFIG_HAL_BOARD_SUBTYPE = 'HAL_BOARD_SUBTYPE_ESP32_%s' % tt.upper() ,
@ -1018,6 +1019,9 @@ class esp32(Board):
else: else:
env.DEFINES.update(AP_SIM_ENABLED = 0) env.DEFINES.update(AP_SIM_ENABLED = 0)
# FreeRTOS component from esp-idf expects this define
env.DEFINES.update(ESP_PLATFORM = 1)
env.AP_LIBRARIES += [ env.AP_LIBRARIES += [
'AP_HAL_ESP32', 'AP_HAL_ESP32',
] ]

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# if you have modules/esp_idf setup as a submodule, then leave it as a submodule and switch branches # if you have modules/esp_idf setup as a submodule, then leave it as a submodule and switch branches
COMMIT="cc3203dc4f087ab41b434afff1ed7520c6d90993"
if [ ! -d modules ]; then if [ ! -d modules ]; then
echo "this script needs to be run from the root of your repo, sorry, giving up." echo "this script needs to be run from the root of your repo, sorry, giving up."
exit 1 exit 1
@ -13,6 +16,7 @@ if [ ! -d esp_idf ]; then
else else
echo 'found modules/esp_idf folder' ; echo 'found modules/esp_idf folder' ;
fi fi
echo "looking for submodule or repo..." echo "looking for submodule or repo..."
if [ `git submodule | grep esp_idf | wc | cut -c1-7` == '1' ]; then if [ `git submodule | grep esp_idf | wc | cut -c1-7` == '1' ]; then
echo "found real submodule, syncing" echo "found real submodule, syncing"
@ -23,40 +27,44 @@ else
if [ ! `ls esp_idf/install.sh 2>/dev/null` ]; then if [ ! `ls esp_idf/install.sh 2>/dev/null` ]; then
echo "found empty IDF, cloning" echo "found empty IDF, cloning"
# add esp_idf as almost submodule, depths uses less space # add esp_idf as almost submodule, depths uses less space
#git clone -b v4.4 --single-branch --depth 10 https://github.com/espressif/esp-idf.git esp_idf git clone -b 'release/v5.3' https://github.com/espressif/esp-idf.git esp_idf
git clone -b 'release/v4.4' https://github.com/espressif/esp-idf.git esp_idf git checkout $COMMIT
git checkout 6d853f
# check if we've got v4.4 checked out, only this version of esp_idf is tested and works?
fi fi
fi fi
echo "inspecting possible IDF... " echo "inspecting possible IDF... "
cd esp_idf cd esp_idf
echo `git rev-parse HEAD` echo `git rev-parse HEAD`
# these are a selection of possible specific commit/s that represent v4.4 branch of the esp_idf # these are a selection of possible specific commit/s that represent v5.3 branch of the esp_idf
if [ `git rev-parse HEAD` == '6d853f0525b003afaeaed4fb59a265c8522c2da9' ]; then if [ `git rev-parse HEAD` == '$COMMIT' ]; then
echo "IDF version 'release/4.4' found OK, great."; echo "IDF version 'release/5.3' found OK, great.";
else else
echo "looks like an idf, but not v4.4 branch, or wrong commit , trying to switch branch and reflect upstream"; echo "looks like an idf, but not v5.3 branch, or wrong commit , trying to switch branch and reflect upstream";
../../Tools/gittools/submodule-sync.sh >/dev/null ../../Tools/gittools/submodule-sync.sh >/dev/null
git fetch ; git checkout -f release/v4.4 git fetch ; git checkout -f release/v5.3
git checkout 6d853f git checkout $COMMIT
# retry same as above # retry same as above
echo `git rev-parse HEAD` echo `git rev-parse HEAD`
if [ `git rev-parse HEAD` == '6d853f0525b003afaeaed4fb59a265c8522c2da9' ]; then if [ `git rev-parse HEAD` == '$COMMIT' ]; then
echo "IDF version 'release/4.4' found OK, great."; echo "IDF version 'release/5.3' found OK, great.";
git checkout 6d853f git checkout $COMMIT
fi fi
fi fi
cd ../.. cd ../..
cd modules/esp_idf cd modules/esp_idf
git submodule update --init --recursive git submodule update --init --recursive
echo
echo "installing missing python modules"
python -m pip install empy==3.3.4
python -m pip install pexpect
python -m pip install future
cd ../.. cd ../..
echo "after changing IDF versions [ such as between 4.2 and 4.4 ] you should re-run these in your console:"
echo
echo "after changing IDF versions [ such as between 4.4 and 5.3 ] you should re-run these in your console:"
echo "./modules/esp_idf/install.sh" echo "./modules/esp_idf/install.sh"
echo "source ./modules/esp_idf/export.sh" echo "source ./modules/esp_idf/export.sh"