You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/07/28 22:10:16 UTC

[GitHub] [tvm] mehrdadh commented on a diff in pull request #12209: [microTVM][Zephyr][projectAPI] Minimize project build commands

mehrdadh commented on code in PR #12209:
URL: https://github.com/apache/tvm/pull/12209#discussion_r932716050


##########
apps/microtvm/zephyr/template_project/microtvm_api_server.py:
##########
@@ -576,22 +578,33 @@ def build(self, options):
     _KNOWN_QEMU_ZEPHYR_BOARDS = ("mps2_an521", "mps3_an547")
 
     @classmethod
-    def _is_qemu(cls, options):
-        return (
-            "qemu" in options["zephyr_board"]
-            or options["zephyr_board"] in cls._KNOWN_QEMU_ZEPHYR_BOARDS
-        )
+    def _is_qemu(cls, board: str) -> bool:
+        return "qemu" in board or board in cls._KNOWN_QEMU_ZEPHYR_BOARDS
 
     @classmethod
     def _has_fpu(cls, zephyr_board):
         fpu_boards = [name for name, board in BOARD_PROPERTIES.items() if board["fpu"]]
         return zephyr_board in fpu_boards
 
+    @classmethod
+    def _find_board_from_cmake_file(cls) -> str:
+        with open(API_SERVER_DIR / CMAKELIST_FILENAME) as cmake_f:
+            for line in cmake_f:
+                if line.startswith("set(BOARD"):
+                    zephyr_board = line.strip("\n").strip("set(BOARD ").strip(")")
+                    break
+
+        if not zephyr_board:
+            raise RuntimeError(
+                f"Zephyr Board is not found in the {API_SERVER_DIR / CMAKELIST_FILENAME}"

Review Comment:
   done



##########
apps/microtvm/zephyr/template_project/microtvm_api_server.py:
##########
@@ -576,22 +578,33 @@ def build(self, options):
     _KNOWN_QEMU_ZEPHYR_BOARDS = ("mps2_an521", "mps3_an547")
 
     @classmethod
-    def _is_qemu(cls, options):
-        return (
-            "qemu" in options["zephyr_board"]
-            or options["zephyr_board"] in cls._KNOWN_QEMU_ZEPHYR_BOARDS
-        )
+    def _is_qemu(cls, board: str) -> bool:
+        return "qemu" in board or board in cls._KNOWN_QEMU_ZEPHYR_BOARDS
 
     @classmethod
     def _has_fpu(cls, zephyr_board):
         fpu_boards = [name for name, board in BOARD_PROPERTIES.items() if board["fpu"]]
         return zephyr_board in fpu_boards
 
+    @classmethod
+    def _find_board_from_cmake_file(cls) -> str:
+        with open(API_SERVER_DIR / CMAKELIST_FILENAME) as cmake_f:
+            for line in cmake_f:
+                if line.startswith("set(BOARD"):
+                    zephyr_board = line.strip("\n").strip("set(BOARD ").strip(")")
+                    break
+
+        if not zephyr_board:

Review Comment:
   great catch!



##########
apps/microtvm/zephyr/template_project/microtvm_api_server.py:
##########
@@ -419,7 +419,7 @@ def _create_prj_conf(self, project_dir, options):
             f.write("\n")
 
     API_SERVER_CRT_LIBS_TOKEN = "<API_SERVER_CRT_LIBS>"
-    ENABLE_CMSIS_TOKEN = "<ENABLE_CMSIS>"
+    CMAKE_ARGS = "<CMAKE_ARGS>"

Review Comment:
   done



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org