You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by me...@apache.org on 2022/11/29 01:21:18 UTC

[tvm] branch main updated: [microTVM] Use `serial_number` in Zephyr tutorials (#13479)

This is an automated email from the ASF dual-hosted git repository.

mehrdadh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 435df5081a [microTVM] Use `serial_number` in Zephyr tutorials (#13479)
435df5081a is described below

commit 435df5081a68d5e3b913684414b87f2e93de835f
Author: Mehrdad Hessar <mh...@octoml.ai>
AuthorDate: Mon Nov 28 19:21:11 2022 -0600

    [microTVM] Use `serial_number` in Zephyr tutorials (#13479)
    
    Add serial_number option to Zephyr tutorials so it's possible to run them in the hardware CI and specify the serial port by setting TVM_MICRO_SERIAL env. variable.
---
 gallery/how_to/work_with_microtvm/micro_aot.py      | 3 ++-
 gallery/how_to/work_with_microtvm/micro_autotune.py | 4 ++++
 gallery/how_to/work_with_microtvm/micro_tflite.py   | 3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gallery/how_to/work_with_microtvm/micro_aot.py b/gallery/how_to/work_with_microtvm/micro_aot.py
index f02a1ebbbd..f702170f0b 100644
--- a/gallery/how_to/work_with_microtvm/micro_aot.py
+++ b/gallery/how_to/work_with_microtvm/micro_aot.py
@@ -106,6 +106,7 @@ if use_physical_hw:
     with open(boards_file) as f:
         boards = json.load(f)
     BOARD = os.getenv("TVM_MICRO_BOARD", default="nucleo_l4r5zi")
+    SERIAL = os.getenv("TVM_MICRO_SERIAL", default=None)
     TARGET = tvm.target.target.micro(boards[BOARD]["model"])
 
 ######################################################################
@@ -133,7 +134,7 @@ project_options = {}  # You can use options to provide platform-specific options
 
 if use_physical_hw:
     template_project_path = pathlib.Path(tvm.micro.get_microtvm_template_projects("zephyr"))
-    project_options = {"project_type": "host_driven", "board": BOARD}
+    project_options = {"project_type": "host_driven", "board": BOARD, "serial_number": SERIAL}
 
 temp_dir = tvm.contrib.utils.tempdir()
 generated_project_dir = temp_dir / "project"
diff --git a/gallery/how_to/work_with_microtvm/micro_autotune.py b/gallery/how_to/work_with_microtvm/micro_autotune.py
index 4c57717df8..ea83ef5639 100644
--- a/gallery/how_to/work_with_microtvm/micro_autotune.py
+++ b/gallery/how_to/work_with_microtvm/micro_autotune.py
@@ -101,6 +101,7 @@ if use_physical_hw:
         boards = json.load(f)
 
     BOARD = os.getenv("TVM_MICRO_BOARD", default="nucleo_l4r5zi")
+    SERIAL = os.getenv("TVM_MICRO_SERIAL", default=None)
     TARGET = tvm.target.target.micro(boards[BOARD]["model"])
 
 
@@ -156,6 +157,7 @@ if use_physical_hw:
             "west_cmd": "west",
             "verbose": False,
             "project_type": "host_driven",
+            "serial_number": SERIAL,
         },
     )
     builder = tvm.autotvm.LocalBuilder(
@@ -223,6 +225,7 @@ if use_physical_hw:
             "west_cmd": "west",
             "verbose": False,
             "project_type": "host_driven",
+            "serial_number": SERIAL,
         },
     )
 
@@ -266,6 +269,7 @@ if use_physical_hw:
             "west_cmd": "west",
             "verbose": False,
             "project_type": "host_driven",
+            "serial_number": SERIAL,
         },
     )
 
diff --git a/gallery/how_to/work_with_microtvm/micro_tflite.py b/gallery/how_to/work_with_microtvm/micro_tflite.py
index b04a2fdca1..5822a1a1e9 100644
--- a/gallery/how_to/work_with_microtvm/micro_tflite.py
+++ b/gallery/how_to/work_with_microtvm/micro_tflite.py
@@ -209,6 +209,7 @@ if use_physical_hw:
         boards = json.load(f)
 
     BOARD = os.getenv("TVM_MICRO_BOARD", default="nucleo_f746zg")
+    SERIAL = os.getenv("TVM_MICRO_SERIAL", default=None)
     TARGET = tvm.target.target.micro(boards[BOARD]["model"])
 
 #
@@ -291,7 +292,7 @@ project_options = {}  # You can use options to provide platform-specific options
 
 if use_physical_hw:
     template_project_path = pathlib.Path(tvm.micro.get_microtvm_template_projects("zephyr"))
-    project_options = {"project_type": "host_driven", "board": BOARD}
+    project_options = {"project_type": "host_driven", "board": BOARD, "serial_number": SERIAL}
 
 # Create a temporary directory