mkatanbaf commented on code in PR #12125:
URL: https://github.com/apache/tvm/pull/12125#discussion_r943920872


##########
apps/microtvm/zephyr/template_project/microtvm_api_server.py:
##########
@@ -578,49 +623,78 @@ def generate_project(self, model_library_format_path, 
standalone_crt_dir, projec
     def build(self, options):
         BUILD_DIR.mkdir()
 
-        check_call(["cmake", ".."], cwd=BUILD_DIR)
+        zephyr_board = _find_board_from_cmake_file(API_SERVER_DIR / 
CMAKELIST_FILENAME)
+        emu_platform = _find_platform_from_cmake_file(API_SERVER_DIR / 
CMAKELIST_FILENAME)
+
+        env = dict(os.environ)
+        if self._is_fvp(zephyr_board, emu_platform == "armfvp"):
+            env["ARMFVP_BIN_PATH"] = str(API_SERVER_DIR / "fvp-hack")
+            env["ARMFVP_BIN_PATH"] = os.path.realpath(env["ARMFVP_BIN_PATH"])
+            st = os.stat(env["ARMFVP_BIN_PATH"] + 
"/FVP_Corstone_SSE-300_Ethos-U55")
+            os.chmod(
+                env["ARMFVP_BIN_PATH"] + "/FVP_Corstone_SSE-300_Ethos-U55",
+                st.st_mode | stat.S_IEXEC,
+            )
 
-        args = ["make", "-j2"]
+        print("ENV", env)
+        check_call(["cmake", "-GNinja", ".."], cwd=BUILD_DIR, env=env)
+
+        args = ["ninja"]
         if options.get("verbose"):
-            args.append("VERBOSE=1")
-        check_call(args, cwd=BUILD_DIR)
+            args.append("-v")
+        check_call(args, cwd=BUILD_DIR, env=env)
 
     # A list of all zephyr_board values which are known to launch using QEMU. 
Many platforms which
     # launch through QEMU by default include "qemu" in their name. However, 
not all do. This list
     # includes those tested platforms which do not include qemu.
-    _KNOWN_QEMU_ZEPHYR_BOARDS = ("mps2_an521", "mps3_an547")
+    _KNOWN_QEMU_ZEPHYR_BOARDS = ["mps2_an521", "mps3_an547"]
+
+    # A list of all zephyr_board values which are known to launch using ARM 
FVP (this script configures
+    # Zephyr to use that launch method).
+    _KNOWN_FVP_ZEPHYR_BOARDS = ["mps3_an547"]
 
     @classmethod
-    def _is_qemu(cls, board: str) -> bool:
-        return "qemu" in board or board in cls._KNOWN_QEMU_ZEPHYR_BOARDS
+    def _is_fvp(cls, board, use_fvp):
+        assert not (

Review Comment:
   Yes, this is a better way to express the function. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to