Skip to content

Fix rp2 safe mode via reset press #8170

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
Jul 15, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define MICROPY_HW_MCU_NAME "rp2040"

#define MICROPY_HW_NEOPIXEL (&pin_GPIO21)
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO20)

#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2)
Expand Down
9 changes: 5 additions & 4 deletions ports/raspberrypi/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,15 @@ uint32_t *port_heap_get_top(void) {
return port_stack_get_top();
}

uint32_t __uninitialized_ram(saved_word);
void port_set_saved_word(uint32_t value) {
// Store in a watchdog scratch register instead of RAM. 4-7 are used by the
// sdk. 0 is used by alarm. 1-3 are free.
watchdog_hw->scratch[1] = value;
// Store in RAM because the watchdog scratch registers don't survive
// resetting by pulling the RUN pin low.
saved_word = value;
}

uint32_t port_get_saved_word(void) {
return watchdog_hw->scratch[1];
return saved_word;
}

static volatile bool ticks_enabled;
Expand Down