@@ -151,6 +151,43 @@ macro(nf_fix_esp32c3_rom_file)
151151
152152endmacro ()
153153
154+ # Fixes an issue with IDF 5.4.1 where we get an error cause by ESP_ROM_ELF_DIR environment variable missing
155+ # This patch removes need for variable. Offical patch added after IDF5.4.1 release
156+ macro (nf_patch_idf5_4_1)
157+ file (READ
158+ ${esp32_idf_SOURCE_DIR} /tools/cmake/gdbinit.cmake
159+ ESP32_GBBINIT_CONTENT)
160+
161+ string (FIND ${ESP32_GBBINIT_CONTENT} "# set(gdbinit_rom_in_path " GBD_INIT_PATCH_INDEX)
162+ message ("-- Check IDF patch exists" )
163+ if (GBD_INIT_PATCH_INDEX EQUAL -1)
164+
165+ message ("-- Patching IDF 5.4.1 gdbinit.cmake" )
166+
167+ string (REPLACE
168+ "set(gdbinit_rom_in_path "
169+ "# set(gdbinit_rom_in_path "
170+ ESP32_GBBINIT_NEW_CONTENT
171+ "${ESP32_GBBINIT_CONTENT} " )
172+
173+ string (REPLACE
174+ "set(gdbinit_rom_path "
175+ "# set(gdbinit_rom_path "
176+ ESP32_GBBINIT_NEW_CONTENT
177+ "${ESP32_GBBINIT_NEW_CONTENT} " )
178+
179+ string (REPLACE
180+ "file(TO_CMAKE_PATH "
181+ "# file(TO_CMAKE_PATH "
182+ ESP32_GBBINIT_NEW_CONTENT
183+ "${ESP32_GBBINIT_NEW_CONTENT} " )
184+
185+ file (WRITE
186+ ${esp32_idf_SOURCE_DIR} /tools/cmake/gdbinit.cmake
187+ "${ESP32_GBBINIT_NEW_CONTENT} " )
188+ endif ()
189+ endmacro ()
190+
154191# setting compile definitions for a target based on general build options
155192# TARGET parameter to set the target that's setting them for
156193# optional EXTRA_COMPILE_DEFINITIONS with compiler definitions to be added to the library
@@ -1025,6 +1062,9 @@ macro(nf_add_idf_as_library)
10251062
10261063 nf_fix_esp32c3_rom_file()
10271064
1065+ # FIXME patch IDF 5.4.1 problem
1066+ nf_patch_idf5_4_1()
1067+
10281068 # find out if there is support for BLE
10291069 string (FIND ${SDKCONFIG_DEFAULT_CONTENTS} "CONFIG_BT_ENABLED=y" CONFIG_BT_ENABLED_POS)
10301070
0 commit comments