You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/02/22 14:59:04 UTC
[GitHub] [tvm] gromero opened a new pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
gromero opened a new pull request #10346:
URL: https://github.com/apache/tvm/pull/10346
Refactor _find_openocd_serial_port() as a generic USB serial port
finder since other runners beyond openocd use it (e.g. jlink runner).
Also instead of using redundant hardcoded values in BOARD_USB_FIND_KW
dict, use idVendor and idProduct from boards.json. And don't use 'usb'
module to first find the serial number of the port and then pass it to
'serial' module to obtain the port path, instead search for the port
path directly via 'serial' module using the serial number (if provided)
or use idVendor and idProduct values taken from boards.json.
Signed-off-by: Gustavo Romero <gu...@linaro.org>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] alanmacd edited a comment on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
alanmacd edited a comment on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1049225731
> > I think you need to rebase because of this PR: #10304
>
>
> Could you please test it against your hardware fleet? :)
@gromero I can test your changes on the hardware, we are just waiting for an unrelated fix to land, then I'll run your branch. Your rebase looks good to me from the perspective of merging in the #10304 changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] areusch merged pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
areusch merged pull request #10346:
URL: https://github.com/apache/tvm/pull/10346
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] alanmacd commented on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
alanmacd commented on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1050146682
> > > > I think you need to rebase because of this PR: #10304
> > >
> > >
> > > Could you please test it against your hardware fleet? :)
> >
> >
> > @gromero I can test your changes on the hardware, we are just waiting for an unrelated fix to land, then I'll run your branch. Your rebase looks good to me from the perspective of merging in the #10304 changes.
>
> @alanmacd Hi Alan. Thanks a lot for the review and for testing the change against the hw fleet there ;)
@gromero I ran you changes last night, the testing run looks good.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] alanmacd commented on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
alanmacd commented on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1049225731
> > I think you need to rebase because of this PR: #10304
>
>
> Could you please test it against your hardware fleet? :)
@gromero I can run your changes on the hardware, we are just waiting for an unrelated fix to land, then I'll run your branch. Your rebase looks good to me from the perspective of merging in the #10304 changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] gromero commented on a change in pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
gromero commented on a change in pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#discussion_r812370126
##########
File path: apps/microtvm/zephyr/template_project/microtvm_api_server.py
##########
@@ -165,38 +165,6 @@ def _get_device_args(options):
)
-# kwargs passed to usb.core.find to find attached boards for the openocd flash runner.
-BOARD_USB_FIND_KW = {
- "nucleo_l4r5zi": {"idVendor": 0x0483, "idProduct": 0x374B},
- "nucleo_f746zg": {"idVendor": 0x0483, "idProduct": 0x374B},
- "stm32f746g_disco": {"idVendor": 0x0483, "idProduct": 0x374B},
- "mimxrt1050_evk": {"idVendor": 0x1366, "idProduct": 0x0105},
-}
-
-
-def openocd_serial(options):
- """Find the serial port to use for a board with OpenOCD flash strategy."""
- if "openocd_serial" in options:
- return options["openocd_serial"]
-
- import usb # pylint: disable=import-outside-toplevel
-
- find_kw = BOARD_USB_FIND_KW[CMAKE_CACHE["BOARD"]]
- boards = usb.core.find(find_all=True, **find_kw)
- serials = []
- for b in boards:
- serials.append(b.serial_number)
-
- if len(serials) == 0:
- raise BoardAutodetectFailed(f"No attached USB devices matching: {find_kw!r}")
- serials.sort()
-
- autodetected_openocd_serial = serials[0]
- _LOG.debug("zephyr openocd driver: autodetected serial %s", serials[0])
-
- return autodetected_openocd_serial
-
-
def _get_openocd_device_args(options):
return ["--serial", openocd_serial(options)]
Review comment:
@mehrdadh Thanks for catching it! I'll promote `_generic_find_serial_port()` to a module method so it can be used in `_get_openocd_device_args`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] mehrdadh commented on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
mehrdadh commented on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1048344450
I think you need to rebase because of this PR: https://github.com/apache/tvm/pull/10304
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] gromero edited a comment on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
gromero edited a comment on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1048852272
> I think you need to rebase because of this PR: #10304
@mehrdadh I've pushed a rebased version. However diff shown by GH is total crap imo. So maybe you would need to pull the changes and check the modified file locally. I don't know why GH (and git apparently too) are doing such a horrible diff work. I've tried different diff algorithms and nothing really improved :S
Could you please test it against your hardware fleet? :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] areusch commented on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
areusch commented on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1054570189
thanks @gromero !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] gromero commented on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
gromero commented on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1049311155
> > > I think you need to rebase because of this PR: #10304
> >
> >
> > Could you please test it against your hardware fleet? :)
>
> @gromero I can test your changes on the hardware, we are just waiting for an unrelated fix to land, then I'll run your branch. Your rebase looks good to me from the perspective of merging in the #10304 changes.
@alanmacd Hi Alan. Thanks a lot for the review and for testing the change against the hw fleet there ;)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] gromero commented on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
gromero commented on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1048852272
> I think you need to rebase because of this PR: #10304
I've pushed a rebased version. However diff shown by GH is total crap imo. So maybe you would need to pull the changes and check the modified file locally. I don't know why GH (and git apparently too) are doing such a horrible diff work. I've tried different diff algorithms and nothing really improved :S
Could you please test it against your hardware fleet? :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] gromero edited a comment on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
gromero edited a comment on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1048852272
> I think you need to rebase because of this PR: #10304
@mehrdadh I've pushed a rebased version. However diff shown by GH is total crap imo. So maybe you would need to pull the changes and check the modified file locally. I don't know why GH (and git apparently too) is doing such a horrible diff work. I've tried different diff algorithms and nothing really improved :S
Could you please test it against your hardware fleet? :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] gromero commented on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
gromero commented on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1050300169
Thanks a lot @mehrdadh @alanmacd
@areusch would you mind to land this change, please?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] mehrdadh commented on a change in pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
mehrdadh commented on a change in pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#discussion_r812165251
##########
File path: apps/microtvm/zephyr/template_project/microtvm_api_server.py
##########
@@ -165,38 +165,6 @@ def _get_device_args(options):
)
-# kwargs passed to usb.core.find to find attached boards for the openocd flash runner.
-BOARD_USB_FIND_KW = {
- "nucleo_l4r5zi": {"idVendor": 0x0483, "idProduct": 0x374B},
- "nucleo_f746zg": {"idVendor": 0x0483, "idProduct": 0x374B},
- "stm32f746g_disco": {"idVendor": 0x0483, "idProduct": 0x374B},
- "mimxrt1050_evk": {"idVendor": 0x1366, "idProduct": 0x0105},
-}
-
-
-def openocd_serial(options):
- """Find the serial port to use for a board with OpenOCD flash strategy."""
- if "openocd_serial" in options:
- return options["openocd_serial"]
-
- import usb # pylint: disable=import-outside-toplevel
-
- find_kw = BOARD_USB_FIND_KW[CMAKE_CACHE["BOARD"]]
- boards = usb.core.find(find_all=True, **find_kw)
- serials = []
- for b in boards:
- serials.append(b.serial_number)
-
- if len(serials) == 0:
- raise BoardAutodetectFailed(f"No attached USB devices matching: {find_kw!r}")
- serials.sort()
-
- autodetected_openocd_serial = serials[0]
- _LOG.debug("zephyr openocd driver: autodetected serial %s", serials[0])
-
- return autodetected_openocd_serial
-
-
def _get_openocd_device_args(options):
return ["--serial", openocd_serial(options)]
Review comment:
`openocd_serial` is still used here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] mehrdadh commented on pull request #10346: [microTVM] Zephyr: refactor _find_openocd_serial_port
Posted by GitBox <gi...@apache.org>.
mehrdadh commented on pull request #10346:
URL: https://github.com/apache/tvm/pull/10346#issuecomment-1050147840
Thanks @alanmacd for testing on hardware fleet!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org