Skip to content

ports/unix: Add embedded mode. #12807

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

smurfix
Copy link
Contributor

@smurfix smurfix commented Oct 26, 2023

Embedded mode means that

  • boot.py is executed, if present
  • the same REPL as on embedded systems is used that is, ^A switches to raw mode.

This change does not yet(?)

  • modify the terminal mode Workaround: wrap with stty raw; micropython -e …; stty -raw
  • support a restart via machine.reset()

Embedded mode means that

* boot.py is executed, if present
* the same REPL as on embedded systems is used
  that is, ^A switches to raw mode.

This change does not yet(?)

* modify the terminal mode
  Workaround: wrap with `stty raw; micropython -e …; stty -raw`
* support a restart via `machine.reset()`

Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
@jimmo
Copy link
Member

jimmo commented Oct 26, 2023

Thanks. See also #12802 -- might be good to get that one in first then update this PR correspondingly?

Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
@smurfix
Copy link
Contributor Author

smurfix commented Oct 26, 2023

Heh. Fun. Two people, one thought … I'll have a look at #12802.

@jimmo
Copy link
Member

jimmo commented Oct 26, 2023

Out of curiosity though... what is the meaning of boot.py on unix?

On the embedded ports, boot.py is about setting up filesystems in order to be able to find main.py, or any once-off configuration of peripherals that can't change at runtime (e.g. usb mode).

Is there some other precedent from CPython we could follow for the unix port? e.g. site ?

@smurfix
Copy link
Contributor Author

smurfix commented Oct 26, 2023

In my case boot.py is about setting up paths, pre-importing and assembling stub modules, and related hackery that's required for my micropython testcases so that they behave as if they're running on a "real" embedded system.

There are some other embedded-ish changes I'd like to add, e.g. mostly-restricting file system functions to the current directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants