@@ -152,20 +152,29 @@ def main():
152152 print ("[sof-qemu-run] Error: 'west' command not found in PATH." )
153153 sys .exit (1 )
154154
155- # Determine what we are actually running
155+ # Determine execution command
156156 runs = []
157157
158- # Check for multiple firmware images in the build directory (chained boot tests)
159- fw_images = []
160- zephyr_elf = os .path .join (build_dir , "zephyr" , "zephyr.elf" )
161- if os .path .isfile (zephyr_elf ):
162- fw_images .append (zephyr_elf )
158+ if "ace30" in board .lower () or "ptl" in board .lower () or "wcl" in board .lower ():
159+ qemu_bin_path = os .environ .get ("QEMU_BIN_PATH" , os .path .join (os .environ .get ("SOF_WORKSPACE" , os .path .abspath (os .path .join (os .path .dirname (__file__ ), ".." , ".." ))), "qemu" , "build" ))
160+ qemu_exe = os .path .join (qemu_bin_path , "qemu-system-xtensa" )
161+ print (f"[sof-qemu-run] Bypassing west run explicitly for ACE30 target. Using QEMU: { qemu_exe } " )
163162
164- # Also check for .bin images if elf isn't there or if we have multi-image
165- if not is_native_sim :
166- qemu_exe = shutil .which ("qemu-system-xtensa" )
167- if not qemu_exe :
168- print ("[sof-qemu-run] Error: 'qemu-system-xtensa' not found in PATH." )
163+ # Enable dynamic recursive ZTest execution if isolated zephyr.elf doesn't exist
164+ fw_images = []
165+ default_ri = os .path .join (build_dir , "zephyr" , "zephyr.ri" )
166+ default_elf = os .path .join (build_dir , "zephyr" , "zephyr.elf" )
167+ if os .path .isfile (default_ri ):
168+ fw_images .append (default_ri )
169+ elif os .path .isfile (default_elf ):
170+ fw_images .append (default_elf )
171+ else :
172+ for root , dirs , files in os .walk (build_dir ):
173+ if "zephyr.elf" in files :
174+ fw_images .append (os .path .join (root , "zephyr.elf" ))
175+
176+ if not fw_images :
177+ print (f"[sof-qemu-run] Error: No Zephyr firmware generated natively (missing zephyr.elf) within { build_dir } " )
169178 sys .exit (1 )
170179
171180 for fw in fw_images :
0 commit comments