Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
Address Mehrdad's PR comments

More PR comments

Documentation tweaks

Add dialout group to user
  • Loading branch information
guberti committed Aug 27, 2021
1 parent 40a261e commit 6afacd7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 37 deletions.
21 changes: 19 additions & 2 deletions apps/microtvm/reference-vm/arduino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,28 @@

# microTVM Arduino Reference Virtual Machine

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

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

(none currently)

## Supported Arduino Boards
This RVM has been tested and is known to work with these boards:
- Adafruit Metro M4
- Adafruit Pybadge
- Arduino Due
- Arduino Nano 33 BLE
- Feather S2
- Sony Spresense
- Wio Terminal

However, the RVM *should* work with any Arduino with sufficient memory, provided
its core is installed in `base-box/base_box_provision.sh`.

Note that this RVM does not work with the Teensy boards, even though they are
supported by microTVM. This is because arduino-cli does not support Teensy
boards (https://github.com/arduino/arduino-cli/issues/700)/).
25 changes: 1 addition & 24 deletions apps/microtvm/reference-vm/arduino/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", path: "provision_setup.sh", env: {"TVM_HOME": dirs_to_mount[0]}, privileged: false

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

config.vm.provider "parallels" do |prl, overrides|
prl.name = vm_name
prl.cpus = num_cores
prl.memory = ram_bytes
prl.update_guest_tools = true
prl.customize ["set", :id, "--support-usb30", "on"]
dirs_to_mount.each do |d|
overrides.vm.synced_folder d.to_s, d.to_s, mount_options: ["share", "nosuid", "host_inodes"]
end
end

config.vm.provider "vmware_desktop" do |vm, overrides|
vm.cpus = num_cores
vm.memory = ram_bytes
vm.vmx["usb_xhci.present"] = "TRUE"
vm.vmx["usb.present"] = "TRUE"
vm.vmx["ehci.present"] = "TRUE"
dirs_to_mount.each do |d|
overrides.vm.synced_folder d.to_s, d.to_s
end
vm.gui = true
end

end
14 changes: 12 additions & 2 deletions apps/microtvm/reference-vm/arduino/base-box/base_box_provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ sudo apt-get install -y ca-certificates
export PATH="/home/vagrant/bin:$PATH"
wget -O - https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s

# Arduino (the CLI and GUI) require the dialout permission for uploading
sudo usermod -a -G dialout $USER

# ubuntu_init_arduino.sh only installs a few officially
# supported architectures, so we don't use it here

Expand All @@ -58,8 +61,15 @@ arduino-cli core install SPRESENSE:spresense --additional-urls $SPRESENSE_BOARDS
# fixes the bug in the main core release SDK - the subcore release SDK and both
# the main and subcore debug SDKs will continue to fail until an official fix is made.
# https://github.com/sonydevworld/spresense/issues/200
SPRESENSE_BUGFIX_PATH=~/.arduino15/packages/SPRESENSE/tools/spresense-sdk/2.2.1/spresense/release/nuttx/include/sys/types.h
sed -i 's/#ifndef CONFIG_WCHAR_BUILTIN/#if !defined(__cplusplus)/g' $SPRESENSE_BUGFIX_PATH
SPRESENSE_NUTTX_BUGFIX_PATH=~/.arduino15/packages/SPRESENSE/tools/spresense-sdk/2.2.1/spresense/release/nuttx/include/sys/types.h
sed -i 's/#ifndef CONFIG_WCHAR_BUILTIN/#if !defined(__cplusplus)/g' $SPRESENSE_NUTTX_BUGFIX_PATH

# There's also a SECOND bug in the Spresense Arduino bindings, relating to how the
# flash_writer path is templated on Linux. This change is only needed to upload code
# (not compile) to the Spresense.
# https://github.com/sonydevworld/spresense-arduino-compatible/issues/127
SPRESENSE_FLASH_WRITER_BUGFIX_PATH=~/.arduino15/packages/SPRESENSE/hardware/spresense/2.2.1/platform.txt
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

# Cleanup
rm -f *.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ microtvm_platform=$1
pytest tests/micro/arduino/test_arduino_workflow.py --microtvm-platforms=${microtvm_platform}

if [ $microtvm_platform == "nano33ble" ]; then
# https://github.com/apache/tvm/issues/8730
echo "NOTE: skipped test_arduino_rpc_server.py on $microtvm_platform -- known failure"
else
pytest tests/micro/arduino/test_arduino_rpc_server.py --microtvm-platforms=${microtvm_platform}
Expand Down
17 changes: 8 additions & 9 deletions apps/microtvm/reference-vm/base-box-tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@
# in [platform]/base-box/base_box_provision.sh
EXTRA_SCRIPTS = {
"arduino": (),
"zephyr": (
"docker/install/ubuntu_init_zephyr_project.sh",
"docker/install/ubuntu_install_qemu.sh",
),
"zephyr": ("docker/install/ubuntu_init_zephyr_project.sh",),
}

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

providers = args.provider
print(providers)
provider_passed = {p: False for p in providers}

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

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

# Options for build subcommand
parser_build = subparsers.add_parser("build", help="Build a base box.")
Expand Down Expand Up @@ -510,9 +506,9 @@ def parse_args():
"iSerial field from `lsusb -v` output."
),
)
platform_subparsers = parser_test.add_subparsers(help=platform_help_str)
parser_test_platform_subparsers = parser_test.add_subparsers(help=platform_help_str)
for platform in ALL_PLATFORMS:
platform_specific_parser = platform_subparsers.add_parser(platform)
platform_specific_parser = parser_test_platform_subparsers.add_parser(platform)
platform_specific_parser.set_defaults(platform=platform)
platform_specific_parser.add_argument(
"--microtvm-platform",
Expand All @@ -538,7 +534,10 @@ def parse_args():
parser_release.add_argument(
"--platform-version",
required=True,
help="Platform version to release, in the form 'x.y'.",
help=(
"For Zephyr, the platform version to release, in the form 'x.y'. "
"For Arduino, the version of arduino-cli that's being used, in the form 'x.y.z'."
),
)

return parser.parse_args()
Expand Down

0 comments on commit 6afacd7

Please sign in to comment.