<p>Kévin Redon has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10214">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cardem: show detailed reset cause<br><br>this helps detecting when a reset was due to the watchdog<br><br>Change-Id: I2d59c2f2c8fe9e559eddfafacf25879263ef81ff<br>---<br>M firmware/apps/cardem/main.c<br>1 file changed, 15 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/14/10214/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/firmware/apps/cardem/main.c b/firmware/apps/cardem/main.c</span><br><span>index ae46794..7d65c7e 100644</span><br><span>--- a/firmware/apps/cardem/main.c</span><br><span>+++ b/firmware/apps/cardem/main.c</span><br><span>@@ -157,11 +157,25 @@</span><br><span>             "SIMtrace2 firmware " GIT_VERSION " (C) 2010-2016 by Harald Welte\n\r"</span><br><span>           "=============================================================================\n\r");</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#if (TRACE_LEVEL >= TRACE_LEVEL_INFO)</span><br><span>        TRACE_INFO("Chip ID: 0x%08x (Ext 0x%08x)\n\r", CHIPID->CHIPID_CIDR, CHIPID->CHIPID_EXID);</span><br><span>    TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\n\r",</span><br><span>              g_unique_id[0], g_unique_id[1],</span><br><span>              g_unique_id[2], g_unique_id[3]);</span><br><span style="color: hsl(0, 100%, 40%);">-     TRACE_INFO("Reset Cause: 0x%x\n\r", (RSTC->RSTC_SR & RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos);</span><br><span style="color: hsl(120, 100%, 40%);">+       uint8_t reset_cause = (RSTC->RSTC_SR & RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos;</span><br><span style="color: hsl(120, 100%, 40%);">+        static const char* reset_causes[] = {</span><br><span style="color: hsl(120, 100%, 40%);">+         "general reset (first power-up reset)",</span><br><span style="color: hsl(120, 100%, 40%);">+             "backup reset (return from backup mode)",</span><br><span style="color: hsl(120, 100%, 40%);">+           "watchdog reset (watchdog fault occurred)",</span><br><span style="color: hsl(120, 100%, 40%);">+         "software reset (processor reset required by the software)",</span><br><span style="color: hsl(120, 100%, 40%);">+                "user reset (NRST pin detected low)",</span><br><span style="color: hsl(120, 100%, 40%);">+       };</span><br><span style="color: hsl(120, 100%, 40%);">+    if (reset_cause < ARRAY_SIZE(reset_causes)) {</span><br><span style="color: hsl(120, 100%, 40%);">+              TRACE_INFO("Reset Cause: %s\n\r", reset_causes[reset_cause]);</span><br><span style="color: hsl(120, 100%, 40%);">+       } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              TRACE_INFO("Reset Cause: 0x%x\n\r", (RSTC->RSTC_SR & RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos);</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> </span><br><span>        board_main_top();</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10214">change 10214</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10214"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: simtrace2 </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I2d59c2f2c8fe9e559eddfafacf25879263ef81ff </div>
<div style="display:none"> Gerrit-Change-Number: 10214 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kévin Redon <kredon@sysmocom.de> </div>