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 2021/10/17 00:52:09 UTC

[GitHub] [tvm] mehrdadh commented on a change in pull request #9274: [microTVM] Add platform version check to template project

mehrdadh commented on a change in pull request #9274:
URL: https://github.com/apache/tvm/pull/9274#discussion_r730058853



##########
File path: apps/microtvm/arduino/template_project/microtvm_api_server.py
##########
@@ -335,7 +337,23 @@ def _find_modified_include_path(self, project_dir, file_path, include_path):
         # It's probably a standard C/C++ header
         return include_path
 
+    def _get_platform_version(self, arduino_cli_path: str) -> str:
+        version_output = subprocess.check_output([arduino_cli_path, "version"], encoding="utf-8")
+        version_output = (
+            version_output.replace("\n", "").replace("\r", "").replace(":", "").lower().split(" ")
+        )
+        version_index = version_output.index("version") + 1
+
+        return version_output[version_index]
+
     def generate_project(self, model_library_format_path, standalone_crt_dir, project_dir, options):
+        # Check Arduino version
+        version = self._get_platform_version(options["arduino_cli_cmd"])
+        if version != ARDUINO_CLI_VERSION:

Review comment:
       I think two levels of version, Major + Minor, is enough. We don't need to check the patch level version since they usually don't change interfaces. I discussed this with @gromero and that seems to be the case for Zephyr. For Arduino I got the same impression based on their release messages: https://github.com/arduino/arduino-cli/releases 
   @guberti probably has more info here.

##########
File path: apps/microtvm/zephyr/template_project/microtvm_api_server.py
##########
@@ -356,13 +361,16 @@ def _get_platform_version(self) -> str:
                 if "VERSION_MINOR" in line:
                     version_minor = line.split("=")[1]
 
-        return f"{version_major}.{version_minor}"
+        return float(f"{version_major}.{version_minor}")
 
     def generate_project(self, model_library_format_path, standalone_crt_dir, project_dir, options):
         # Check Zephyr version
         version = self._get_platform_version()
         if version != ZEPHYR_VERSION:
-            raise ValueError(f"Zephyr version does not math: {version} != {ZEPHYR_VERSION}")
+            message = f"Zephyr version does not math: {version} != {ZEPHYR_VERSION}"

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