@@ -485,11 +485,11 @@ def _generate_cmake_args(self, mlf_extracted_path, options) -> str:
485485 if options .get ("west_cmd" ):
486486 cmake_args += f"set(WEST { options ['west_cmd' ]} )\n "
487487
488- if self ._is_qemu (options ["zephyr_board" ], options . get ( "use_fvp" ) ):
488+ if self ._is_qemu (options ["zephyr_board" ]):
489489 # Some boards support more than one emulator, so ensure QEMU is set.
490490 cmake_args += f"set(EMU_PLATFORM qemu)\n "
491491
492- if self ._is_fvp (options ["zephyr_board" ], options . get ( "use_fvp" ) ):
492+ if self ._is_fvp (options ["zephyr_board" ]):
493493 cmake_args += f"set(EMU_PLATFORM armfvp)\n "
494494 cmake_args += f"set(ARMFVP_FLAGS -I)\n "
495495
@@ -531,9 +531,9 @@ def generate_project(self, model_library_format_path, standalone_crt_dir, projec
531531 os .makedirs (extract_path )
532532 tf .extractall (path = extract_path )
533533
534- if self ._is_qemu (options ["zephyr_board" ], options . get ( "use_fvp" ) ):
534+ if self ._is_qemu (options ["zephyr_board" ]):
535535 shutil .copytree (API_SERVER_DIR / "qemu-hack" , project_dir / "qemu-hack" )
536- elif self ._is_fvp (options ["zephyr_board" ], options . get ( "use_fvp" ) ):
536+ elif self ._is_fvp (options ["zephyr_board" ]):
537537 shutil .copytree (API_SERVER_DIR / "fvp-hack" , project_dir / "fvp-hack" )
538538
539539 # Populate CRT.
@@ -569,7 +569,7 @@ def generate_project(self, model_library_format_path, standalone_crt_dir, projec
569569 for item in flags :
570570 cmake_f .write (f"target_compile_definitions(app PUBLIC { item } )\n " )
571571
572- if self ._is_fvp (options ["zephyr_board" ], options . get ( "use_fvp" ) ):
572+ if self ._is_fvp (options ["zephyr_board" ]):
573573 cmake_f .write (f"target_compile_definitions(app PUBLIC -DFVP=1)\n " )
574574
575575 self ._create_prj_conf (project_dir , options )
@@ -583,9 +583,7 @@ def generate_project(self, model_library_format_path, standalone_crt_dir, projec
583583
584584 # Populate src/
585585 src_dir = project_dir / "src"
586- if options ["project_type" ] != "host_driven" or self ._is_fvp (
587- options ["zephyr_board" ], options .get ("use_fvp" )
588- ):
586+ if options ["project_type" ] != "host_driven" or self ._is_fvp (options ["zephyr_board" ]):
589587 shutil .copytree (API_SERVER_DIR / "src" / options ["project_type" ], src_dir )
590588 else :
591589 src_dir .mkdir ()
@@ -600,10 +598,8 @@ def build(self, options):
600598 BUILD_DIR .mkdir ()
601599
602600 zephyr_board = self ._find_board_from_cmake_file ()
603- emu_platform = self ._find_platform_from_cmake_file ()
604-
605601 env = dict (os .environ )
606- if self ._is_fvp (zephyr_board , emu_platform == "armfvp" ):
602+ if self ._is_fvp (zephyr_board ):
607603 env ["ARMFVP_BIN_PATH" ] = str (API_SERVER_DIR / "fvp-hack" )
608604 env ["ARMFVP_BIN_PATH" ] = os .path .realpath (env ["ARMFVP_BIN_PATH" ])
609605 st = os .stat (env ["ARMFVP_BIN_PATH" ] + "/FVP_Corstone_SSE-300_Ethos-U55" )
@@ -623,25 +619,19 @@ def build(self, options):
623619 # A list of all zephyr_board values which are known to launch using QEMU. Many platforms which
624620 # launch through QEMU by default include "qemu" in their name. However, not all do. This list
625621 # includes those tested platforms which do not include qemu.
626- _KNOWN_QEMU_ZEPHYR_BOARDS = ["mps2_an521" , "mps3_an547" ]
622+ _KNOWN_QEMU_ZEPHYR_BOARDS = ["mps2_an521" ]
627623
628624 # A list of all zephyr_board values which are known to launch using ARM FVP (this script configures
629625 # Zephyr to use that launch method).
630626 _KNOWN_FVP_ZEPHYR_BOARDS = ["mps3_an547" ]
631627
632628 @classmethod
633- def _is_fvp (cls , board , use_fvp ):
634- assert (
635- use_fvp and board not in cls ._KNOWN_FVP_ZEPHYR_BOARDS
636- ) == False , "fvp doesn't support this board."
637-
638- return board in cls ._KNOWN_FVP_ZEPHYR_BOARDS and use_fvp
629+ def _is_fvp (cls , board ):
630+ return board in cls ._KNOWN_FVP_ZEPHYR_BOARDS
639631
640632 @classmethod
641- def _is_qemu (cls , board , use_fvp = False ):
642- return "qemu" in board or (
643- board in cls ._KNOWN_QEMU_ZEPHYR_BOARDS and not cls ._is_fvp (board , use_fvp )
644- )
633+ def _is_qemu (cls , board ):
634+ return "qemu" in board or board in cls ._KNOWN_QEMU_ZEPHYR_BOARDS
645635
646636 @classmethod
647637 def _has_fpu (cls , zephyr_board ):
@@ -669,18 +659,19 @@ def _find_platform_from_cmake_file(cls) -> str:
669659 if line .startswith ("set(EMU_PLATFORM" ):
670660 emu_platform = line .strip ("\n " ).strip ("set(EMU_PLATFORM " ).strip (")" )
671661 break
662+
672663 return emu_platform
673664
674665 def flash (self , options ):
675- if self ._find_platform_from_cmake_file ():
666+ zephyr_board = self ._find_board_from_cmake_file ()
667+ if self ._is_qemu (zephyr_board ) or self ._is_fvp (zephyr_board ):
676668 return # NOTE: qemu requires no flash step--it is launched from open_transport.
677669
678670 # The nRF5340DK requires an additional `nrfjprog --recover` before each flash cycle.
679671 # This is because readback protection is enabled by default when this device is flashed.
680672 # Otherwise, flashing may fail with an error such as the following:
681673 # ERROR: The operation attempted is unavailable due to readback protection in
682674 # ERROR: your device. Please use --recover to unlock the device.
683- zephyr_board = self ._find_board_from_cmake_file ()
684675 if zephyr_board .startswith ("nrf5340dk" ) and _get_flash_runner () == "nrfjprog" :
685676 recover_args = ["nrfjprog" , "--recover" ]
686677 recover_args .extend (_get_nrf_device_args (options ))
@@ -690,11 +681,10 @@ def flash(self, options):
690681
691682 def open_transport (self , options ):
692683 zephyr_board = self ._find_board_from_cmake_file ()
693- emu_platform = self ._find_platform_from_cmake_file ()
694- if self ._is_fvp (zephyr_board , emu_platform == "armfvp" ):
695- transport = ZephyrFvpTransport (options )
696- elif self ._is_qemu (zephyr_board ):
684+ if self ._is_qemu (zephyr_board ):
697685 transport = ZephyrQemuTransport (options )
686+ elif self ._is_fvp (zephyr_board ):
687+ transport = ZephyrFvpTransport (options )
698688 else :
699689 transport = ZephyrSerialTransport (options )
700690
0 commit comments