diff options
| author | Scott Shawcroft <scott@chickadee.tech> | 2017-09-06 00:19:57 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2017-09-06 11:56:41 -0700 |
| commit | c0159c5e80f9ca29ac9cf25602b92cd46f4a762d (patch) | |
| tree | 0c8568731a03afcb439c330c7f7bc82892344930 /atmel-samd/main.c | |
| parent | 6baacf46b746b897cc8fea0f32df4379370b2c04 (diff) | |
atmel-samd: Ensure MTB is off in case we ran a debug build before
a non-debug build.
Diffstat (limited to 'atmel-samd/main.c')
| -rw-r--r-- | atmel-samd/main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/atmel-samd/main.c b/atmel-samd/main.c index 70c343507..3a2d5a63c 100644 --- a/atmel-samd/main.c +++ b/atmel-samd/main.c @@ -513,6 +513,10 @@ safe_mode_t samd21_init(void) { REG_MTB_POSITION = ((uint32_t) (mtb - REG_MTB_BASE)) & 0xFFFFFFF8; REG_MTB_FLOW = (((uint32_t) mtb - REG_MTB_BASE) + TRACE_BUFFER_SIZE_BYTES) & 0xFFFFFFF8; REG_MTB_MASTER = 0x80000000 + (TRACE_BUFFER_MAGNITUDE_PACKETS - 1); +#else + // Triple check that the MTB is off. Switching between debug and non-debug + // builds can leave it set over reset and wreak havok as a result. + REG_MTB_MASTER = 0x00000000 + 6; #endif // On power on start or external reset, set _ezero to the canary word. If it |
