Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[microTVM][Zephyr] Add MIMXRT1050 board support #9068

Merged
merged 3 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/microtvm/zephyr/template_project/boards.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"mimxrt1050_evk": {
"board": "mimxrt1050_evk",
"model": "imxrt10xx",
"is_qemu": false,
"fpu": true
},
"mps2_an521": {
"board": "mps2_an521",
"model": "mps2_an521",
Expand Down
12 changes: 9 additions & 3 deletions apps/microtvm/zephyr/template_project/microtvm_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def _get_device_args(options):
"nucleo_l4r5zi": {"idVendor": 0x0483, "idProduct": 0x374B},
"nucleo_f746zg": {"idVendor": 0x0483, "idProduct": 0x374B},
"stm32f746g_disco": {"idVendor": 0x0483, "idProduct": 0x374B},
"mimxrt1050_evk": {"idVendor": 0x1366, "idProduct": 0x0105},
}


Expand Down Expand Up @@ -545,6 +546,10 @@ def _find_openocd_serial_port(cls, options):

return ports[0].device

@classmethod
def _find_jlink_serial_port(cls, options):
return cls._find_openocd_serial_port(options)
Copy link
Contributor

@gromero gromero Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mehrdadh I think that ideally _find_jlink_serial_port() should not be made merely a wrapper for _find_openocd_serial_port(). I understand that the code for the later works well for finding a serial for Jlink too, but openocd is not really involved on detecting the serial port in the end. It looks in Zephyr's CMake configs and goes for a detection using usb module. Hence I think that _find_openocd_serial_port() should be made a generic code (and renamed to something like _find_serial_port()) and then be used for both "openocd" and "jlink" flash runners.

_find_openocd_serial_port() even contains debug message which cites openocd which is confusing because under the hood for the board in question JLinkExe will be used to flash the fw, not openocd.

The ProjectOption openocd_serial with also contains "openocd" also becomes incorrect since that option also applies now to jlink flash runner, so ideally it should be adapted too I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for extra investigation on this. I agree that this is a bit confusing. We could do a refactor here in a follow on PR.


@classmethod
def _find_serial_port(cls, options):
flash_runner = _get_flash_runner()
Expand All @@ -555,9 +560,10 @@ def _find_serial_port(cls, options):
if flash_runner == "openocd":
return cls._find_openocd_serial_port(options)

raise FlashRunnerNotSupported(
f"Don't know how to deduce serial port for flash runner {flash_runner}"
)
if flash_runner == "jlink":
return cls._find_jlink_serial_port(options)

raise RuntimeError(f"Don't know how to deduce serial port for flash runner {flash_runner}")

def __init__(self, options):
self._options = options
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/target/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def intel_graphics(model="unknown", options=None):
"atsamd51": ["-mcpu=cortex-m4"],
"cxd5602gg": ["-mcpu=cortex-m4"],
"esp32": [],
"imxrt1060": ["-mcpu=cortex-m7"],
"imxrt10xx": ["-mcpu=cortex-m7"],
"mps2_an521": ["-mcpu=cortex-m33"],
"nrf52840": ["-mcpu=cortex-m4"],
"nrf5340dk": ["-mcpu=cortex-m33"],
Expand Down