-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ports/unix: Add raw REPL support. #16141
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #16141 +/- ##
=======================================
Coverage 98.57% 98.57%
=======================================
Files 164 164
Lines 21345 21345
=======================================
Hits 21040 21040
Misses 305 305 ☔ View full report in Codecov by Sentry. |
Code size report:
|
Add raw REPL support to the unix port. This make it possible to connect to a unix micropython instance using mpremote and utilise the functionality of the raw REPL. This is useful for debugging and CI tests of mpremote and related tools. Eg: ``` socat PTY,link=$HOME/.upy-pty,rawer | EXEC:./build-standard/micropython,pty,stderr,onlcr=0 & mpremote resume connect ~/.upy-pty ls ``` Requires the inclusion of `#include "extmod/modplatform.h"` in `pyexec.c` so that `MICROPY_BANNER_MACHINE` is fully resolved. Changes are wrapped in `#ifdef linux` to ensure no impact on the windows port. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
75567d5
to
7904157
Compare
Pushed a commit to wrap the changes to |
Ah. Thanks for pointing out those PRs. I completely overlooked them when scanning for PRs. I see the value in a more unified approach to the repl - I was just chasing a particular feature and so a much more limited change. I'm happy to close this PR in favour of #12802 or #6008. |
This PR is nice and simple, and may still be needed. Let's keep it open until the other ones are merged/closed. |
Summary
Add raw REPL support to the unix port. This make it possible to connect to a unix micropython instance using mpremote and utilise the functionality of the raw REPL. This is useful for debugging and CI tests of mpremote and related tools.
For example, one can run micropython behind a PTY with
socat
and connect to the slave pty (as if it were a serial port) withmpremote
:(The
resume
argument is required since micropython v1.24 as a soft reset terminates the micropython process).or, using the micropython docker image (thanks to @mattytrentini ):
Testing
This has been tested using private CI workflows adapted from those in the
mpremote-path
tool (which usesmpremote
as a library).Trade-offs and Alternatives
The changes impact only the unix port (adding
pyexec.c
to the build) and present a user-visible change through behaviour when a ctrl-A character is entered at the repl. However, this reflects expected behaviour on other ports and should not impact on expected or supported usage.