Skip to content

Commit f88c2be

Browse files
authored
[microTVM] Update nrfjprog on reference virtual machine (#7723)
* update nrfjprog and integration test * merge * Revert "merge" This reverts commit 58d5d91. * fix comments * fix clang * revert format * new line * format
1 parent 37e6df1 commit f88c2be

File tree

3 files changed

+44
-13
lines changed

3 files changed

+44
-13
lines changed

apps/microtvm/reference-vm/base-box-tool.py

100755100644
Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
"vmware_desktop",
4343
)
4444

45+
# List of microTVM platforms for testing.
46+
ALL_MICROTVM_PLATFORMS = (
47+
"stm32f746xx",
48+
"nrf5340dk",
49+
)
50+
4551

4652
def parse_virtualbox_devices():
4753
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):
109115
if serial is not None:
110116
rule_args.extend(["--serialnumber", serial])
111117
subprocess.check_call(rule_args)
118+
# TODO(mehrdadh): skip usb attach if it's already attached
112119
subprocess.check_call(["VBoxManage", "controlvm", uuid, "usbattach", dev["UUID"]])
113120
return
114121

@@ -308,13 +315,17 @@ def test_command(args):
308315
test_config_file = os.path.join(base_box_dir, "test-config.json")
309316
with open(test_config_file) as f:
310317
test_config = json.load(f)
318+
319+
# select microTVM test platform
320+
microtvm_test_platform = test_config[args.microtvm_platform]
321+
311322
for key, expected_type in REQUIRED_TEST_CONFIG_KEYS.items():
312-
assert key in test_config and isinstance(
313-
test_config[key], expected_type
323+
assert key in microtvm_test_platform and isinstance(
324+
microtvm_test_platform[key], expected_type
314325
), f"Expected key {key} of type {expected_type} in {test_config_file}: {test_config!r}"
315326

316-
test_config["vid_hex"] = test_config["vid_hex"].lower()
317-
test_config["pid_hex"] = test_config["pid_hex"].lower()
327+
microtvm_test_platform["vid_hex"] = microtvm_test_platform["vid_hex"].lower()
328+
microtvm_test_platform["pid_hex"] = microtvm_test_platform["pid_hex"].lower()
318329

319330
providers = args.provider
320331
provider_passed = {p: False for p in providers}
@@ -331,7 +342,7 @@ def test_command(args):
331342
release_test_dir, user_box_dir, base_box_dir, provider_name
332343
)
333344
do_run_release_test(
334-
release_test_dir, provider_name, test_config, args.test_device_serial
345+
release_test_dir, provider_name, microtvm_test_platform, args.test_device_serial
335346
)
336347
provider_passed[provider_name] = True
337348

@@ -444,6 +455,13 @@ def parse_args():
444455
),
445456
)
446457

458+
parser.add_argument(
459+
"--microtvm-platform",
460+
default="stm32f746xx",
461+
choices=ALL_MICROTVM_PLATFORMS,
462+
help="For use with 'test' command. MicroTVM platfrom that are used for testing.",
463+
)
464+
447465
return parser.parse_args()
448466

449467

apps/microtvm/reference-vm/zephyr/base-box/setup.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,22 @@ sudo apt install -y llvm
5959
sudo apt install -y protobuf-compiler libprotoc-dev
6060

6161
# nrfjprog
62+
NRF_COMMANDLINE_TOOLS_FILE=nRFCommandLineToolsLinuxamd64.tar.gz
63+
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
64+
NRF_COMMANDLINE_TOOLS_INSTALLER=nRF-Command-Line-Tools_10_12_1_Linux-amd64.deb
65+
JLINK_LINUX_INSTALLER=JLink_Linux_V688a_x86_64.deb
66+
6267
cd ~
6368
mkdir -p nrfjprog
64-
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
69+
wget --no-verbose -O $NRF_COMMANDLINE_TOOLS_FILE $NRF_COMMANDLINE_TOOLS_URL
6570
cd nrfjprog
66-
tar -xzvf ../nRFCommandLineTools1090Linuxamd64.tar.gz
67-
sudo apt install -y ./JLink_Linux_V680a_x86_64.deb
68-
sudo apt install -y ./nRF-Command-Line-Tools_10_9_0_Linux-amd64.deb
71+
tar -xzvf "../${NRF_COMMANDLINE_TOOLS_FILE}"
72+
sudo apt install -y "./${JLINK_LINUX_INSTALLER}"
73+
sudo apt install -y "./${NRF_COMMANDLINE_TOOLS_INSTALLER}"
6974
source ~/.profile
7075
nrfjprog --help
7176
cd ..
72-
rm -rf nrfjprog nRFCommandLineTools1090Linuxamd64.tar.gz
77+
rm -rf nrfjprog "${NRF_COMMANDLINE_TOOLS_FILE}"
7378

7479
# Zephyr
7580
pip3 install --user -U west
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
{"vid_hex": "0483",
2-
"pid_hex": "374b",
3-
"test_cmd": ["pytest", "tests/micro/qemu/test_zephyr.py", "--microtvm-platforms=stm32f746xx"]
1+
{
2+
"stm32f746xx": {
3+
"vid_hex": "0483",
4+
"pid_hex": "374b",
5+
"test_cmd": ["pytest", "tests/micro/qemu/test_zephyr.py", "--microtvm-platforms=stm32f746xx"]
6+
},
7+
"nrf5340dk": {
8+
"vid_hex": "1366",
9+
"pid_hex": "1055",
10+
"test_cmd": ["pytest", "tests/micro/qemu/test_zephyr.py", "--microtvm-platforms=nrf5340dk"]
11+
}
412
}

0 commit comments

Comments
 (0)