Skip to content

Fix 1200 baud reset. #495

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

Merged
merged 1 commit into from
Dec 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions atmel-samd/common-hal/microcontroller/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,14 @@ void common_hal_mcu_enable_interrupts(void) {
}

extern uint32_t _ezero;
extern uint32_t _srelocate;

void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) {
// Set up the defaults.
_bootloader_dbl_tap = DBL_TAP_MAGIC;
_ezero = CIRCUITPY_CANARY_WORD;

if (runmode == RUNMODE_BOOTLOADER) {
if (&_bootloader_dbl_tap < &_srelocate) {
if (!bootloader_available()) {
mp_raise_ValueError("Cannot reset into bootloader because no bootloader is present.");
}
// Pretend to be the first of the two reset presses needed to enter the
Expand Down
2 changes: 1 addition & 1 deletion atmel-samd/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ volatile bool reset_on_disconnect = false;

void usb_dtr_notify(uint8_t port, bool set) {
mp_cdc_enabled = set;
if (!set && reset_on_disconnect && _bootloader_dbl_tap != 0) {
if (!set && reset_on_disconnect && bootloader_available()) {
reset_to_bootloader();
}
}
Expand Down
5 changes: 5 additions & 0 deletions atmel-samd/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ void reset_to_bootloader(void) {
_bootloader_dbl_tap = DBL_TAP_MAGIC;
reset();
}

extern uint32_t _srelocate;
bool bootloader_available(void) {
return &_bootloader_dbl_tap >= &_srelocate;
}
1 change: 1 addition & 0 deletions atmel-samd/reset.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ extern uint32_t _bootloader_dbl_tap;

void reset_to_bootloader(void);
void reset(void);
bool bootloader_available(void);

#endif // MICROPY_INCLUDED_ATMEL_SAMD_RESET_H
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy