Skip to content

Commit 6afacd7

Browse files
committed
Address PR comments
Address Mehrdad's PR comments More PR comments Documentation tweaks Add dialout group to user
1 parent 40a261e commit 6afacd7

File tree

5 files changed

+41
-37
lines changed

5 files changed

+41
-37
lines changed

apps/microtvm/reference-vm/arduino/README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,28 @@
1717

1818
# microTVM Arduino Reference Virtual Machine
1919

20-
This directory contains setup files for Arduino virtual machine used for testing microTVM platforms
21-
that are supported by [Arduino](https://www.arduino.cc/).
20+
This directory contains setup files for Arduino virtual machine used for testing
21+
microTVM platforms that are supported by [Arduino](https://www.arduino.cc/).
2222

2323
## VM Information for Developers
2424
Arduino VM is published under [tlcpack](https://app.vagrantup.com/tlcpack).
2525
Here is a list of different release versions and their tools.
2626

2727
(none currently)
28+
29+
## Supported Arduino Boards
30+
This RVM has been tested and is known to work with these boards:
31+
- Adafruit Metro M4
32+
- Adafruit Pybadge
33+
- Arduino Due
34+
- Arduino Nano 33 BLE
35+
- Feather S2
36+
- Sony Spresense
37+
- Wio Terminal
38+
39+
However, the RVM *should* work with any Arduino with sufficient memory, provided
40+
its core is installed in `base-box/base_box_provision.sh`.
41+
42+
Note that this RVM does not work with the Teensy boards, even though they are
43+
supported by microTVM. This is because arduino-cli does not support Teensy
44+
boards (https://github.com/arduino/arduino-cli/issues/700)/).

apps/microtvm/reference-vm/arduino/Vagrantfile

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Vagrant.configure("2") do |config|
4949
config.vm.provision "shell", path: "provision_setup.sh", env: {"TVM_HOME": dirs_to_mount[0]}, privileged: false
5050

5151
# Enable USB Controller on VirtualBox
52-
vm_name = "microtvm-#{Time.now.tv_sec}"
52+
vm_name = "microtvm-arduino-#{Time.now.tv_sec}"
5353
config.vm.provider "virtualbox" do |vb, overrides|
5454
vb.name = vm_name
5555
vb.cpus = num_cores
@@ -63,27 +63,4 @@ Vagrant.configure("2") do |config|
6363
end
6464
end
6565

66-
config.vm.provider "parallels" do |prl, overrides|
67-
prl.name = vm_name
68-
prl.cpus = num_cores
69-
prl.memory = ram_bytes
70-
prl.update_guest_tools = true
71-
prl.customize ["set", :id, "--support-usb30", "on"]
72-
dirs_to_mount.each do |d|
73-
overrides.vm.synced_folder d.to_s, d.to_s, mount_options: ["share", "nosuid", "host_inodes"]
74-
end
75-
end
76-
77-
config.vm.provider "vmware_desktop" do |vm, overrides|
78-
vm.cpus = num_cores
79-
vm.memory = ram_bytes
80-
vm.vmx["usb_xhci.present"] = "TRUE"
81-
vm.vmx["usb.present"] = "TRUE"
82-
vm.vmx["ehci.present"] = "TRUE"
83-
dirs_to_mount.each do |d|
84-
overrides.vm.synced_folder d.to_s, d.to_s
85-
end
86-
vm.gui = true
87-
end
88-
8966
end

apps/microtvm/reference-vm/arduino/base-box/base_box_provision.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ sudo apt-get install -y ca-certificates
3434
export PATH="/home/vagrant/bin:$PATH"
3535
wget -O - https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s
3636

37+
# Arduino (the CLI and GUI) require the dialout permission for uploading
38+
sudo usermod -a -G dialout $USER
39+
3740
# ubuntu_init_arduino.sh only installs a few officially
3841
# supported architectures, so we don't use it here
3942

@@ -58,8 +61,15 @@ arduino-cli core install SPRESENSE:spresense --additional-urls $SPRESENSE_BOARDS
5861
# fixes the bug in the main core release SDK - the subcore release SDK and both
5962
# the main and subcore debug SDKs will continue to fail until an official fix is made.
6063
# https://github.com/sonydevworld/spresense/issues/200
61-
SPRESENSE_BUGFIX_PATH=~/.arduino15/packages/SPRESENSE/tools/spresense-sdk/2.2.1/spresense/release/nuttx/include/sys/types.h
62-
sed -i 's/#ifndef CONFIG_WCHAR_BUILTIN/#if !defined(__cplusplus)/g' $SPRESENSE_BUGFIX_PATH
64+
SPRESENSE_NUTTX_BUGFIX_PATH=~/.arduino15/packages/SPRESENSE/tools/spresense-sdk/2.2.1/spresense/release/nuttx/include/sys/types.h
65+
sed -i 's/#ifndef CONFIG_WCHAR_BUILTIN/#if !defined(__cplusplus)/g' $SPRESENSE_NUTTX_BUGFIX_PATH
66+
67+
# There's also a SECOND bug in the Spresense Arduino bindings, relating to how the
68+
# flash_writer path is templated on Linux. This change is only needed to upload code
69+
# (not compile) to the Spresense.
70+
# https://github.com/sonydevworld/spresense-arduino-compatible/issues/127
71+
SPRESENSE_FLASH_WRITER_BUGFIX_PATH=~/.arduino15/packages/SPRESENSE/hardware/spresense/2.2.1/platform.txt
72+
sed -i 's/tools.spresense-tools.cmd.path.linux={path}\/flash_writer\/{runtime.os}\/flash_writer/tools.spresense-tools.cmd.path.linux={path}\/flash_writer\/linux\/flash_writer/g' $SPRESENSE_FLASH_WRITER_BUGFIX_PATH
6373

6474
# Cleanup
6575
rm -f *.sh

apps/microtvm/reference-vm/arduino/base-box/base_box_test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ microtvm_platform=$1
3333
pytest tests/micro/arduino/test_arduino_workflow.py --microtvm-platforms=${microtvm_platform}
3434

3535
if [ $microtvm_platform == "nano33ble" ]; then
36+
# https://github.com/apache/tvm/issues/8730
3637
echo "NOTE: skipped test_arduino_rpc_server.py on $microtvm_platform -- known failure"
3738
else
3839
pytest tests/micro/arduino/test_arduino_rpc_server.py --microtvm-platforms=${microtvm_platform}

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@
7575
# in [platform]/base-box/base_box_provision.sh
7676
EXTRA_SCRIPTS = {
7777
"arduino": (),
78-
"zephyr": (
79-
"docker/install/ubuntu_init_zephyr_project.sh",
80-
"docker/install/ubuntu_install_qemu.sh",
81-
),
78+
"zephyr": ("docker/install/ubuntu_init_zephyr_project.sh",),
8279
}
8380

8481
PACKER_FILE_NAME = "packer.json"
@@ -392,7 +389,6 @@ def test_command(args):
392389
microtvm_test_platform["microtvm_platform"] = args.microtvm_platform
393390

394391
providers = args.provider
395-
print(providers)
396392
provider_passed = {p: False for p in providers}
397393

398394
release_test_dir = os.path.join(THIS_DIR, "release-test")
@@ -479,7 +475,7 @@ def parse_args():
479475

480476
# "test" has special options for different platforms, and "build", "release" might
481477
# in the future, so we'll add the platform argument to each one individually.
482-
platform_help_str = "Electronics platform to use (e.g. Arduino, Zephyr)"
478+
platform_help_str = "Platform to use (e.g. Arduino, Zephyr)"
483479

484480
# Options for build subcommand
485481
parser_build = subparsers.add_parser("build", help="Build a base box.")
@@ -510,9 +506,9 @@ def parse_args():
510506
"iSerial field from `lsusb -v` output."
511507
),
512508
)
513-
platform_subparsers = parser_test.add_subparsers(help=platform_help_str)
509+
parser_test_platform_subparsers = parser_test.add_subparsers(help=platform_help_str)
514510
for platform in ALL_PLATFORMS:
515-
platform_specific_parser = platform_subparsers.add_parser(platform)
511+
platform_specific_parser = parser_test_platform_subparsers.add_parser(platform)
516512
platform_specific_parser.set_defaults(platform=platform)
517513
platform_specific_parser.add_argument(
518514
"--microtvm-platform",
@@ -538,7 +534,10 @@ def parse_args():
538534
parser_release.add_argument(
539535
"--platform-version",
540536
required=True,
541-
help="Platform version to release, in the form 'x.y'.",
537+
help=(
538+
"For Zephyr, the platform version to release, in the form 'x.y'. "
539+
"For Arduino, the version of arduino-cli that's being used, in the form 'x.y.z'."
540+
),
542541
)
543542

544543
return parser.parse_args()

0 commit comments

Comments
 (0)