summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorLucian Copeland <hierophect@gmail.com>2020-06-04 16:15:38 -0400
committerLucian Copeland <hierophect@gmail.com>2020-06-04 16:15:38 -0400
commita0977cac7b92233a3ea52404fe59f9a4a3d3ac4a (patch)
tree2e8e7d182871589aaaf9cc72c58b24b5b7f77320 /supervisor
parentd14e34449b5b70ea5e39938324e27af76498b0dd (diff)
parentfffe171d5fed98b8db6f2a59393987a8eb5313e9 (diff)
Merge remote-tracking branch 'upstream/master' into stm32-LSE-startup-fix
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/shared/bluetooth.h2
-rw-r--r--supervisor/shared/external_flash/devices.h18
-rw-r--r--supervisor/shared/safe_mode.c3
-rw-r--r--supervisor/shared/safe_mode.h1
-rw-r--r--supervisor/shared/tick.c11
-rw-r--r--supervisor/stub/internal_flash.c1
6 files changed, 32 insertions, 4 deletions
diff --git a/supervisor/shared/bluetooth.h b/supervisor/shared/bluetooth.h
index 7ebcb953f..1fb6a879a 100644
--- a/supervisor/shared/bluetooth.h
+++ b/supervisor/shared/bluetooth.h
@@ -31,4 +31,4 @@ void supervisor_start_bluetooth(void);
bool supervisor_bluetooth_hook(ble_evt_t *ble_evt);
void supervisor_bluetooth_background(void);
-#endif \ No newline at end of file
+#endif
diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h
index f99fad4e7..466ab49eb 100644
--- a/supervisor/shared/external_flash/devices.h
+++ b/supervisor/shared/external_flash/devices.h
@@ -187,6 +187,24 @@ typedef struct {
.single_status_byte = false, \
}
+// Settings for the Gigadevice GD25S512MD 64MiB SPI flash.
+// Datasheet: http://www.gigadevice.com/datasheet/gd25s512md/
+#define GD25S512MD {\
+ .total_size = (1 << 26), /* 64 MiB */ \
+ .start_up_time_us = 5000, \
+ .manufacturer_id = 0xc8, \
+ .memory_type = 0x40, \
+ .capacity = 0x19, \
+ .max_clock_speed_mhz = 104, /* if we need 120 then we can turn on high performance mode */ \
+ .quad_enable_bit_mask = 0x02, \
+ .has_sector_protection = false, \
+ .supports_fast_read = true, \
+ .supports_qspi = true, \
+ .supports_qspi_writes = true, \
+ .write_status_register_split = true, \
+ .single_status_byte = false, \
+}
+
// Settings for the Cypress (was Spansion) S25FL064L 8MiB SPI flash.
// Datasheet: http://www.cypress.com/file/316661/download
#define S25FL064L {\
diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c
index c957aee53..a167ab392 100644
--- a/supervisor/shared/safe_mode.c
+++ b/supervisor/shared/safe_mode.c
@@ -160,6 +160,9 @@ void print_safe_mode_message(safe_mode_t reason) {
case MEM_MANAGE:
serial_write_compressed(translate("Invalid memory access."));
break;
+ case WATCHDOG_RESET:
+ serial_write_compressed(translate("Watchdog timer expired."));
+ break;
default:
serial_write_compressed(translate("Unknown reason."));
break;
diff --git a/supervisor/shared/safe_mode.h b/supervisor/shared/safe_mode.h
index 5b09c4b54..c160739ae 100644
--- a/supervisor/shared/safe_mode.h
+++ b/supervisor/shared/safe_mode.h
@@ -41,6 +41,7 @@ typedef enum {
NORDIC_SOFT_DEVICE_ASSERT,
FLASH_WRITE_FAIL,
MEM_MANAGE,
+ WATCHDOG_RESET,
} safe_mode_t;
safe_mode_t wait_for_safe_mode_reset(void);
diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c
index dc38e76f6..47395bd60 100644
--- a/supervisor/shared/tick.c
+++ b/supervisor/shared/tick.c
@@ -44,6 +44,13 @@ static volatile uint64_t PLACE_IN_DTCM_BSS(background_ticks);
#include "shared-bindings/microcontroller/__init__.h"
+#if CIRCUITPY_WATCHDOG
+#include "shared-bindings/watchdog/__init__.h"
+#define WATCHDOG_EXCEPTION_CHECK() (MP_STATE_VM(mp_pending_exception) == &mp_watchdog_timeout_exception)
+#else
+#define WATCHDOG_EXCEPTION_CHECK() 0
+#endif
+
void supervisor_tick(void) {
#if CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS > 0
filesystem_tick();
@@ -96,7 +103,8 @@ void mp_hal_delay_ms(mp_uint_t delay) {
RUN_BACKGROUND_TASKS;
// Check to see if we've been CTRL-Ced by autoreload or the user.
if(MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)) ||
- MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
+ MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception)) ||
+ WATCHDOG_EXCEPTION_CHECK()) {
break;
}
remaining = end_tick - port_get_raw_ticks(NULL);
@@ -132,4 +140,3 @@ extern void supervisor_disable_tick(void) {
}
common_hal_mcu_enable_interrupts();
}
-
diff --git a/supervisor/stub/internal_flash.c b/supervisor/stub/internal_flash.c
index 5db6b5bc0..5a82f81f7 100644
--- a/supervisor/stub/internal_flash.c
+++ b/supervisor/stub/internal_flash.c
@@ -63,4 +63,3 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num,
void supervisor_flash_release_cache(void) {
}
-