-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
esp8266: UART(0) activation for REPL even if expressly deactivated #4314
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
Comments
Thanks for the report. Indeed this is a problem, as described above. For example, if the user has a device/sensor attached to the UART(0), and wants to drop to a pure webrepl REPL to use this device, then activating the REPL on the UART(0) will most likely mess up the attached sensor.
That seems way too much of a hack, because
This is too dangerous: if by some accident or otherwise the UART(0) is not activated on the REPL by a user script, and webrepl isn't started (or wifi isn't active) then the device is "bricked" and the only way to recover it is to do a complete erase and reflash of the firmware, with a new default filesystem (or to just upload a fresh filesystem, but that's also not easy to make one). It seems to me that the only way to resolve this issue is to unconditionally attach UART(0) to dupterm at the very beginning before |
So that the user can explicitly deactivate UART(0) if needed. See issue micropython#4314.
I submitted #4405 as a fix for this issue. It enables UART(0) as the REPL before running boot.py, so boot.py can disable it if needed. |
Should be fixed by 36808d4 |
So that the user can explicitly deactivate UART(0) if needed. See issue #4314. This introduces some risk to "brick" the device, if the user disables the REPL without providing an alternative REPL (eg WebREPL), or any way to reenable it. In such a case the device needs to be erased and reprogrammed. This seems unavoidable, given the desire to have the option to use the UART for something other than the REPL.
This targets the 64-bit CPU Raspberry Pis. The BCM2711 on the Pi 4 and the BCM2837 on the Pi 3 and Zero 2W. There are 64-bit fixes outside of the ports directory for it. There are a couple other cleanups that were incidental: * Use const mcu_pin_obj_t instead of omitting the const. The structs themselves are const because they are in ROM. * Use PTR <-> OBJ conversions in more places. They were found when mp_obj_t was set to an integer type rather than pointer. * Optimize submodule checkout because the Pi submodules are heavy and unnecessary for the vast majority of builds. Fixes micropython#4314
Uh oh!
There was an error while loading. Please reload this page.
I am not sure if this is a bug or a feature. Before submitting a PR I thought I would ask...
Assume the following situation:
uos.dupterm(machine.UART(0, 115200), 1)
inboot.py
commented outIn this situation, on boot
UART(0)
is still activated. This is fairly counter-intuitive since the user took extra pains to disableUART(0)
for REPL. - Or so s/he thought...Is this intentional?
The "problem" stems from the fact that
mp_reset
checks whether after runningboot.py
anydupterm
objects are registered and if not, it automatically activatesUART(0)
for REPL. Since webREPL only registers a dupterm object when a connection is actually made and we expressly deactivatedUART(0)
inboot.py
,mp_reset
thus activatesUART(0)
...To me this looks a bit like legacy code/behaviour from before the option of detaching
UART(0)
from REPL was introduced (PR #3784).So, shall I submit a pull request for this or not? There are two options:
mp_reset
could additionally check whetherdupterm.listen_s is None
before falling back onUART(0)
.UART(0)
for REPL entirely frommp_reset
since once could argue activation of REPL on startup is now handled entirely byboot.py
. No need to hard code this any more.The text was updated successfully, but these errors were encountered: