← index #4843PR #3277
Related · high · value 2.748
QUERY · ISSUE

Disabling REPL on ESP32

openby hetvishah08opened 2019-06-13updated 2025-04-08
port-esp32

Can we disable REPL on ESP32 for security purposes?
I don't want the main.py to be accessed through REPL.

CANDIDATE · PULL REQUEST

esp8266: Allow disable of REPL on UART0

closedby dmkentopened 2017-08-16updated 2018-05-21

This PR builds on the great initial work of @mhoffma in #2891. It rebases that work then extends those changes to address comments on #2891 by @dpgeorge, provide ability to enable/disable REPL and further decouple esp_mphal.c, machine_uart.c and uart.c from one-another

It pumps all UART RX into it's own ring buffer as well as conditionally to the main REPL input_buf. TX will go out on the UART as normal but this adds a conditional TX API for esp_mphal to use that will conditionally disable REPL TX to UART.

The conditional RX/TX behaviour is currently switched using an extra parameter to UART.init(). This would need to change to align with whatever is eventually decided in #3144. This shouldn't be very onerous if the uos.dupterm(obj, index) approach is adopted.

To make use of this behaviour the process is basically:

  1. Boot ESP8266, connect via UART, use REPL on UART to setup webrepl.

  2. Power down, connect whatever other device you want to your UART.

  3. Boot and connect to webrepl.

  4. Reinitalise the UART to disable REPL (and set other params as needed):

    uart0.init(use_repl=0, baudrate=9600, rxbuflen=256)

  5. Use the webrepl and the Pythonic UART API to talk to your other device using UART without any weird REPL interaction!

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied