-
Notifications
You must be signed in to change notification settings - Fork 2.1k
makefiles: Provide USB UART device serial number matching #7695
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
Conversation
fad01b4
to
27a6593
Compare
27a6593
to
b92916a
Compare
It would be good to get this merged early in this release cycle to avoid rebase hell with new boards being added. |
please rebase, and question: is it necessary that this is based on #7686? Would make merging easier if it wasn't. |
b92916a
to
2c8cbf1
Compare
The reason is that this and #7686 both touch approximately the same files, so it will be less work if we merge them in sequence. |
2c8cbf1
to
5eee0f4
Compare
rebased after dependencies were merged |
needs rebase... |
5eee0f4
to
76c052e
Compare
There variables are only used directly in the main Makefile.include or in application makefiles. So there is no need to export the value. Not exporting will also prevent evaluating them for no reason when 'term' is not done.
It remove PORT evaluation when it is not used, which will lead to not calling `find-tty.sh` in upcoming commits.
With deferred assignment, `find-tty.sh` will only be called when `PORT` is evaluated when `TERMFLAGS` is evaluated for `make term`
Done. I tested by adding
I currently only removed the |
I pushed here for simplicity, but feel free to amend/squash my commit. |
This reverts commit 3e8e11d.
@cladmi thanks for improving this PR. I am on holidays and will not have time to work on this for some time |
I tried to check if the script returning an error was handled but it looks like it is silently ignored by make. I am thinking about echoing something like "/find-tty.sh/could/not/find/port/for/board/serial_pattern" to make it obvious when it will fails during Also I plan to split this PR, the common code and then convert boards in separate PRs to not get blocked on edge cases. It will be after the release though I think. |
How is it going here? |
More discussions with @jcarrano and he showed me magic trick to get an error, I did not thought about using This could be the perfect trick to print an error when port is empty. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Based on #7686In the present master branch, each board provides its own way of guessing the name of any USB to UART adapter to use for
make term
by setting the PORT environment variable. This PR centralizes this in makefiles/tools/serial.inc.mk and adds USB serial number matching. If PORT is given, then nothing changes, the make term command will still use the port specified.Otherwise, if USB_UART_ID is given as an environment variable, then that string is searched for as a USB serial number. If no USB_UART_ID is given, fall back to using DEBUG_ADAPTER_ID instead. Last resort is to pick the first found USB tty device.
All USB serial device scanning is handled by find-tty.sh on Linux, and a wildcard matching method on Darwin (Mac OS)