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 2023/01/07 01:28:37 UTC

[tvm] branch micro/fix_nrf_flash updated (4370c4c0df -> 37c11f8cfe)

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

mehrdadh pushed a change to branch micro/fix_nrf_flash
in repository https://gitbox.apache.org/repos/asf/tvm.git


 discard 4370c4c0df Fix
    omit 16ebf61c1e cleanup
    omit a6bc1719dd Update nrfjprog script and LLVM script
     new 37c11f8cfe Fix NRF find serial

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4370c4c0df)
            \
             N -- N -- N   refs/heads/micro/fix_nrf_flash (37c11f8cfe)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../zephyr/template_project/microtvm_api_server.py |  4 +--
 docker/Dockerfile.ci_cortexm                       |  6 ++---
 docker/install/ubuntu2004_install_llvm.sh          | 30 ----------------------
 docker/install/ubuntu_install_nrfjprog.sh          | 19 +++++---------
 4 files changed, 11 insertions(+), 48 deletions(-)
 delete mode 100755 docker/install/ubuntu2004_install_llvm.sh


[tvm] 01/01: Fix NRF find serial

Posted by me...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 37c11f8cfe5c35c3578cbda680628b83398d3880
Author: Mehrdad Hessar <mh...@octoml.ai>
AuthorDate: Fri Jan 6 16:42:51 2023 -0800

    Fix NRF find serial
---
 .../zephyr/template_project/microtvm_api_server.py | 24 ++++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/apps/microtvm/zephyr/template_project/microtvm_api_server.py b/apps/microtvm/zephyr/template_project/microtvm_api_server.py
index b0cd21e4ad..6f4bc1167b 100644
--- a/apps/microtvm/zephyr/template_project/microtvm_api_server.py
+++ b/apps/microtvm/zephyr/template_project/microtvm_api_server.py
@@ -263,6 +263,10 @@ def _get_openocd_device_args(serial_number: str = None):
 
 
 def _get_nrf_device_args(serial_number: str = None):
+    # iSerial has string type which could mistmatch with
+    # the output of `nrfjprog --ids`. Example: 001050007848 vs 1050007848
+    serial_number = str(int(serial_number))
+
     nrfjprog_args = ["nrfjprog", "--ids"]
     nrfjprog_ids = subprocess.check_output(nrfjprog_args, encoding="utf-8")
     if not nrfjprog_ids.strip("\n"):
@@ -276,9 +280,7 @@ def _get_nrf_device_args(serial_number: str = None):
             )
 
         if serial_number not in boards:
-            raise BoardError(
-                f"serial number ({serial_number}) not found in {nrfjprog_args}: {boards}"
-            )
+            raise BoardError(f"serial number ({serial_number}) not found in {boards}")
 
         return ["--snr", serial_number]
 
@@ -714,23 +716,27 @@ class Handler(server.ProjectAPIHandler):
         if _find_platform_from_cmake_file(API_SERVER_DIR / CMAKELIST_FILENAME):
             return  # NOTE: qemu requires no flash step--it is launched from open_transport.
 
+        flash_runner = _get_flash_runner()
         # The nRF5340DK requires an additional `nrfjprog --recover` before each flash cycle.
         # This is because readback protection is enabled by default when this device is flashed.
         # Otherwise, flashing may fail with an error such as the following:
         #  ERROR: The operation attempted is unavailable due to readback protection in
         #  ERROR: your device. Please use --recover to unlock the device.
         zephyr_board = _find_board_from_cmake_file(API_SERVER_DIR / CMAKELIST_FILENAME)
-        if zephyr_board.startswith("nrf5340dk") and _get_flash_runner() == "nrfjprog":
-            recover_args = ["nrfjprog", "--recover"]
-            recover_args.extend(_get_nrf_device_args(serial_number))
-            check_call(recover_args, cwd=API_SERVER_DIR / "build")
+        # if zephyr_board.startswith("nrf5340dk") and flash_runner == "nrfjprog":
+        #     recover_args = ["nrfjprog", "--recover"]
+        #     recover_args.extend(_get_nrf_device_args(serial_number))
+        #     check_call(recover_args, cwd=API_SERVER_DIR / "build")
 
         flash_extra_args = []
-        if _get_flash_runner() == "openocd" and serial_number:
+        if flash_runner == "openocd" and serial_number:
             flash_extra_args = ["--cmd-pre-init", f"""hla_serial {serial_number}"""]
 
+        if flash_runner == "nrfjprog":
+            flash_extra_args = _get_nrf_device_args(serial_number)
+
         check_call(
-            west_cmd_list + ["flash", "-r", _get_flash_runner()] + flash_extra_args,
+            west_cmd_list + ["flash", "-r", flash_runner] + flash_extra_args,
             cwd=API_SERVER_DIR / "build",
         )