This is an automated email from the ASF dual-hosted git repository.
areusch 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 f88c2be [microTVM] Update nrfjprog on reference virtual machine
(#7723)
f88c2be is described below
commit f88c2be21e3c268713f0772274ca206ed35da784
Author: Mehrdad Hessar <[email protected]>
AuthorDate: Tue Mar 23 09:50:37 2021 -0700
[microTVM] Update nrfjprog on reference virtual machine (#7723)
* update nrfjprog and integration test
* merge
* Revert "merge"
This reverts commit 58d5d9187448e6580b6b780821eb2ea42ec34e8e.
* fix comments
* fix clang
* revert format
* new line
* format
---
apps/microtvm/reference-vm/base-box-tool.py | 28 ++++++++++++++++++----
.../microtvm/reference-vm/zephyr/base-box/setup.sh | 15 ++++++++----
.../reference-vm/zephyr/base-box/test-config.json | 14 ++++++++---
3 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/apps/microtvm/reference-vm/base-box-tool.py
b/apps/microtvm/reference-vm/base-box-tool.py
old mode 100755
new mode 100644
index 0e82dc2..dbf05f0
--- a/apps/microtvm/reference-vm/base-box-tool.py
+++ b/apps/microtvm/reference-vm/base-box-tool.py
@@ -42,6 +42,12 @@ ALL_PROVIDERS = (
"vmware_desktop",
)
+# List of microTVM platforms for testing.
+ALL_MICROTVM_PLATFORMS = (
+ "stm32f746xx",
+ "nrf5340dk",
+)
+
def parse_virtualbox_devices():
output = subprocess.check_output(["VBoxManage", "list", "usbhost"],
encoding="utf-8")
@@ -109,6 +115,7 @@ def attach_virtualbox(uuid, vid_hex=None, pid_hex=None,
serial=None):
if serial is not None:
rule_args.extend(["--serialnumber", serial])
subprocess.check_call(rule_args)
+ # TODO(mehrdadh): skip usb attach if it's already attached
subprocess.check_call(["VBoxManage", "controlvm", uuid,
"usbattach", dev["UUID"]])
return
@@ -308,13 +315,17 @@ def test_command(args):
test_config_file = os.path.join(base_box_dir, "test-config.json")
with open(test_config_file) as f:
test_config = json.load(f)
+
+ # select microTVM test platform
+ microtvm_test_platform = test_config[args.microtvm_platform]
+
for key, expected_type in REQUIRED_TEST_CONFIG_KEYS.items():
- assert key in test_config and isinstance(
- test_config[key], expected_type
+ assert key in microtvm_test_platform and isinstance(
+ microtvm_test_platform[key], expected_type
), f"Expected key {key} of type {expected_type} in
{test_config_file}: {test_config!r}"
- test_config["vid_hex"] = test_config["vid_hex"].lower()
- test_config["pid_hex"] = test_config["pid_hex"].lower()
+ microtvm_test_platform["vid_hex"] =
microtvm_test_platform["vid_hex"].lower()
+ microtvm_test_platform["pid_hex"] =
microtvm_test_platform["pid_hex"].lower()
providers = args.provider
provider_passed = {p: False for p in providers}
@@ -331,7 +342,7 @@ def test_command(args):
release_test_dir, user_box_dir, base_box_dir, provider_name
)
do_run_release_test(
- release_test_dir, provider_name, test_config,
args.test_device_serial
+ release_test_dir, provider_name, microtvm_test_platform,
args.test_device_serial
)
provider_passed[provider_name] = True
@@ -444,6 +455,13 @@ def parse_args():
),
)
+ parser.add_argument(
+ "--microtvm-platform",
+ default="stm32f746xx",
+ choices=ALL_MICROTVM_PLATFORMS,
+ help="For use with 'test' command. MicroTVM platfrom that are used for
testing.",
+ )
+
return parser.parse_args()
diff --git a/apps/microtvm/reference-vm/zephyr/base-box/setup.sh
b/apps/microtvm/reference-vm/zephyr/base-box/setup.sh
index 52af947..7299cea 100644
--- a/apps/microtvm/reference-vm/zephyr/base-box/setup.sh
+++ b/apps/microtvm/reference-vm/zephyr/base-box/setup.sh
@@ -59,17 +59,22 @@ sudo apt install -y llvm
sudo apt install -y protobuf-compiler libprotoc-dev
# nrfjprog
+NRF_COMMANDLINE_TOOLS_FILE=nRFCommandLineToolsLinuxamd64.tar.gz
+NRF_COMMANDLINE_TOOLS_URL=https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/10-12-1/nRFCommandLineTools10121Linuxamd64.tar.gz
+NRF_COMMANDLINE_TOOLS_INSTALLER=nRF-Command-Line-Tools_10_12_1_Linux-amd64.deb
+JLINK_LINUX_INSTALLER=JLink_Linux_V688a_x86_64.deb
+
cd ~
mkdir -p nrfjprog
-wget --no-verbose -O nRFCommandLineTools1090Linuxamd64.tar.gz
https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/10-9-0/nRFCommandLineTools1090Linuxamd64tar.gz
+wget --no-verbose -O $NRF_COMMANDLINE_TOOLS_FILE $NRF_COMMANDLINE_TOOLS_URL
cd nrfjprog
-tar -xzvf ../nRFCommandLineTools1090Linuxamd64.tar.gz
-sudo apt install -y ./JLink_Linux_V680a_x86_64.deb
-sudo apt install -y ./nRF-Command-Line-Tools_10_9_0_Linux-amd64.deb
+tar -xzvf "../${NRF_COMMANDLINE_TOOLS_FILE}"
+sudo apt install -y "./${JLINK_LINUX_INSTALLER}"
+sudo apt install -y "./${NRF_COMMANDLINE_TOOLS_INSTALLER}"
source ~/.profile
nrfjprog --help
cd ..
-rm -rf nrfjprog nRFCommandLineTools1090Linuxamd64.tar.gz
+rm -rf nrfjprog "${NRF_COMMANDLINE_TOOLS_FILE}"
# Zephyr
pip3 install --user -U west
diff --git a/apps/microtvm/reference-vm/zephyr/base-box/test-config.json
b/apps/microtvm/reference-vm/zephyr/base-box/test-config.json
index 78a6bd2..0d26679 100644
--- a/apps/microtvm/reference-vm/zephyr/base-box/test-config.json
+++ b/apps/microtvm/reference-vm/zephyr/base-box/test-config.json
@@ -1,4 +1,12 @@
-{"vid_hex": "0483",
- "pid_hex": "374b",
- "test_cmd": ["pytest", "tests/micro/qemu/test_zephyr.py",
"--microtvm-platforms=stm32f746xx"]
+{
+ "stm32f746xx": {
+ "vid_hex": "0483",
+ "pid_hex": "374b",
+ "test_cmd": ["pytest", "tests/micro/qemu/test_zephyr.py",
"--microtvm-platforms=stm32f746xx"]
+ },
+ "nrf5340dk": {
+ "vid_hex": "1366",
+ "pid_hex": "1055",
+ "test_cmd": ["pytest", "tests/micro/qemu/test_zephyr.py",
"--microtvm-platforms=nrf5340dk"]
+ }
}