-
Notifications
You must be signed in to change notification settings - Fork 178
New feature: Serial Terminal (revised) #664
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 but might want @toyowata to review and confirm if we are using UTF-8 support by default with the Arm standard library and Japanese characters.
I tested it on Japanese Windows 10 and works fine. #include "mbed.h"
DigitalOut led1(LED1);
// main() runs in its own thread in the OS
int main() {
printf("hello, Mbed world!\n");
printf("こんにちは。エェェェェンベッドの世界へようこそ!\n");
int count = 0;
while (true) {
led1 = !led1;
printf("count = %d\n", ++count);
wait(0.5);
}
}
|
Bump @theotherjimmy @yennster |
@screamerbg For all of the commands with letters such as |
@yennster these don't have to be capitalised. Technically lower case. |
@screamerbg I'd personally like to see them lower cased. I don't think anyone will have a problem with CTRL vs. Ctrl, although the later is what's printed on my keyboard... |
@theotherjimmy @yennster These are now provided lower case (see latest commit) |
Bump @MarceloSalazar |
@iriark01 @AnotherButler @GarySwansonARM @cargro This feature could replace the various OS-specific terminal tools we have in OS documentation and training materials. What do you think? |
@screamerbg As usual, you want to specify the version of Mbed CLI :D. Yes documenting this feature are the primary method of interaction with the serial console is warranted. You may want to leave the rest as alternatives. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great!
mbed/mbed_terminal.py
Outdated
--- Mbed Serial Terminal (0.3a) | ||
--- Based on miniterm from pySerial | ||
--- | ||
--- CTRL+B Send Break (reset target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@screamerbg Are these just comments within the file? Can they be changed to match the lowercase commands in the README? (L67-L85)
README.md
Outdated
- Ctrl+t - Menu escape key | ||
- _Even more shortcuts are available through the Menu shortcut. Check the help within the serial terminal (Ctrl+h).__ | ||
|
||
To automate things, you can also add the `--sterm` option to `mbed compile -f` to compile a new program, flash the program/firmware image to the connected target and then open serial terminal to it's COM port: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@screamerbg I think this should say:
You can also add the
--sterm
option tombed compile -f
to compile a new program, flash the program/firmware image to the connected target and then open the serial terminal to it's COM port:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great. Thanks!
README.md
Outdated
- Ctrl+e - Toggle local echo | ||
- Ctrl+h - Help | ||
- Ctrl+t - Menu escape key | ||
- _Even more shortcuts are available through the Menu shortcut. Check the help within the serial terminal (Ctrl+h).__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@screamerbg Why not list all of the shortcut commands within the README?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yennster Primarily because it's a long list of commands that are very specific to the console experience. Unless you have the console running, you won't care about these options. Does this make sense?
@AnotherButler can you do a quick run-through please? |
I assume we've tested it and works on all 3 OS's? Im super pumped for this, cant wait to make a video about it! |
README.md
Outdated
- Ctrl+e - Toggle local echo | ||
- Ctrl+h - Help | ||
- Ctrl+t - Menu escape key | ||
- _Even more shortcuts are available through the Menu shortcut. Check the help within the serial terminal (Ctrl+h).__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the last bullet should say:
More shortcuts can be viewed within the serial terminal's help menu (Ctrl+h).
README.md
Outdated
- Ctrl+t - Menu escape key | ||
- _Even more shortcuts are available through the Menu shortcut. Check the help within the serial terminal (Ctrl+h).__ | ||
|
||
You can also add the --sterm option to mbed compile -f to compile a new program, flash the program/firmware image to the connected target and then open the serial terminal to it's COM port: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this line needs references to commands wrapped in code tags:
You can also add the
--sterm
option tombed compile -f
to compile a new program, flash the program/firmware image to the connected target and then open the serial terminal to it's COM port:
@@ -514,6 +514,32 @@ $ mbed export -i uvision -m K64F | |||
|
|||
Mbed CLI creates a `.uvprojx` file in the projectfiles/uvision folder. You can open the project file with uVision. | |||
|
|||
### Serial terminal | |||
|
|||
You can open a serial terminal to the COM port of a connected Mbed target (usually board) using the `mbed sterm` command. If no COM port is specified, Mbed CLI will attempt to detect the connected Mbed targets and their COM ports. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mbed CLI will attempt to detect the connected Mbed targets and their COM ports.
Does this mean you can use the mbed sterm
command with multiple Mbed boards plugged into the computer at the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It would detect all and iterate through them (one by one, not simultaneously).
@BlackstoneEngineering it's now live. |
Hi @screamerbg As in test_api.py, greentea is able to detect the used baud rate: Do you think it is possible to get the same feature within 'mbed compile xxx -f --sterm' command ? Thx |
@screamerbg If we were to implement this feature, it would involve calling |
Revised based on feedback in #650 and #652
This PR adds serial terminal feature to Mbed CLI via
mbed sterm
command. Currently, the supported command-line arguments are:--port <COM port>
to specify system COM port to connect to.--baudrate <numeric>
to select the communication baudrate, where the default value is 9600.--echo <on|off>
to switch local echo (default ison
).--reset
to reset the connected target by sending Break before opening the serial terminal.If no COM port is specified, Mbed CLI will attempt to detect the connected Mbed target and its COM port.
Inside the serial terminal, there's a wider variety of options:
Example usage with
mbed sterm
This feature also extends the
mbed compile
command and adds--sterm
argument, which could be combined with-f/--flash
. This enables automation workflow where Mbed CLI will first compile a program, then flash/apply it onto the connected target, and then open serial terminal to the target, so you can check the output of the freshly compiled program - see below.The implementation is based on PySerial, which is one of the fundamental libraries for Mbed Greentea (
mbed test
). Therefore there are no additional dependencies.Inspired by @yennster's request (#639).
Also revised based on feedback in #650 and #652