-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Add pyb.soft_reset() and pyb.hard_reset() commands. #826
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
Conversation
59679fc
to
646ecf0
Compare
Here's my sample coe (requires #828) You can press and hold RETURN to abort the script. It will stop by itself (well it will run boot.py & main.py from internal flash) if it doesn't detect the sdcard. |
I had this in my /sd/boot.py: import pyb
uart = pyb.UART(6,115200)
pyb.repl_uart(uart) and copied sd_check.py to /sd/main.py Then do a Control-D or hard-reset to start |
646ecf0
to
0fc13a0
Compare
Yeah, that would be great! |
Sorry, I'll get to this eventually :) |
@dhylands now that the SD card issue is (hopefully) fixed, do you still think adding soft_reset and hard_reset is useful? For soft_reset, it might be cleaner to implement it using the SystemExit exception. Then you can do sys.exit() for a soft reset (or raise SystemExit). Then it doesn't need a global variable. |
I still think that the soft/hard reset is useful from the perspective of After installing the new software, then a soft or hard reset can be I don't mind reworking the soft-reset to use the SystemExit exception. I think that means that we need a nlr_push/pop in main.c around the call to On Tue, Oct 21, 2014 at 2:53 PM, Damien George notifications@github.com
Dave Hylands |
No need to add any more nlr push/pop. Just rework parse_compile_execute so that it returns 1 of 3 states: ok, exit, other-exception. Then anyone who calls parse_compile_execute must deal with that return value correctly (this is easy, it's already set up for this). |
See unix/main.c for how it checks for and deals with SystemExit. |
Superseded by #924. |
nrf52: enable framebuf module
These will also be useful for code which performs updates (over wireless or serial for example) and the code then want to simuate a hard or soft reset to execute the new code.