Skip to content

Conversation

@jepler
Copy link

@jepler jepler commented Sep 12, 2019

This is certainly in a "hacky-hack" stage. It

  • seems to work on nRF52840
  • almost certainly fails to build on every other platform
  • takes some liberties with existing HAL APIs and memory allocations
    but it does achieve the goal of letting you write in boot.py
import busio, board
busio.UART.make_console(board.TX, board.RX)

to get the regular REPL and program output mirrored both on USB (if attached) and via UART.

The platform build problem is of course surmountable; but can the "hack factor" of the specific implementations be reduced enough that this is acceptable for core? It will be good enough for my specific purposes, getting a CircuitPython REPL into a Commodore 64 via its serial port as a proof of concept.

@tannewt
Copy link
Member

tannewt commented Sep 13, 2019

I'd prefer it if there were two additional functions on supervisor .add_serial_in() and .add_serial_out() that way we can separate the two things. A keyboard for example would only be serial_in. We probably also want a forever kwarg that keeps the object alive past the vm. Folks may want to redirect temporarily too.

Instead of needing a separate hook, you can probably reuse the stream api stuff.

Also, we may want to formalize a way to "save" certain heap state at the end of a vm to preserve it for longer.

@dhalbert dhalbert added this to the Long term milestone Oct 31, 2019
@jepler
Copy link
Author

jepler commented Nov 29, 2019

I'm going to go ahead and close this up but leave the branch in my repo. This approach isn't going to generalize, and more design is needed.

@jepler jepler closed this Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants