@@ -702,12 +702,25 @@ def coredump_analysis(target, source, env):
702702 # Use defaults: --chip <mcu> info_corefile <elf_file>
703703 cmd .extend (["--chip" , mcu , "info_corefile" , elf_file ])
704704
705+ # Set up ESP-IDF environment variables when ESP-IDF framework is used
706+ coredump_env = os .environ .copy ()
707+ if env .get ("PIOFRAMEWORK" ) and "espidf" in env .get ("PIOFRAMEWORK" , []):
708+ _framework_pkg_dir = platform .get_package_dir ("framework-espidf" )
709+ _rom_elfs_dir = platform .get_package_dir ("tool-esp-rom-elfs" )
710+ if _framework_pkg_dir and os .path .isdir (_framework_pkg_dir ):
711+ coredump_env ['IDF_PATH' ] = str (Path (_framework_pkg_dir ).resolve ())
712+ if _rom_elfs_dir and os .path .isdir (_rom_elfs_dir ):
713+ coredump_env ['ESP_ROM_ELF_DIR' ] = str (Path (_rom_elfs_dir ).resolve ())
714+
705715 # Debug-Info if wanted
706716 if env .GetProjectOption ("custom_esp_coredump_verbose" , False ):
707717 print (f"Running command: { ' ' .join (cmd )} " )
718+ if 'IDF_PATH' in coredump_env :
719+ print (f"IDF_PATH: { coredump_env ['IDF_PATH' ]} " )
720+ print (f"ESP_ROM_ELF_DIR: { coredump_env .get ('ESP_ROM_ELF_DIR' , 'Not set' )} " )
708721
709- # Execute esp-coredump with current environment
710- result = subprocess .run (cmd , check = False , capture_output = False , env = os . environ )
722+ # Execute esp-coredump with ESP-IDF environment
723+ result = subprocess .run (cmd , check = False , capture_output = False , env = coredump_env )
711724
712725 if result .returncode != 0 :
713726 print (f"Warning: esp-coredump exited with code { result .returncode } " )
0 commit comments