<p style="white-space: pre-wrap; word-wrap: break-word;">I think in general I would have preferred to simply use a separate Uart transmit function from the hardirq handlers.  Either by explicitly changing those calls away from printf, or  by catching/redirecting printf using a #define that's #included only in the exceptions.c file in order to bypass normal printf().</p><p style="white-space: pre-wrap; word-wrap: break-word;">Now we have one conditional in every printf (not really relevant) and some global state that we'd have to switch back should we ever want to have "non-final" exception handling.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Another idea that just comes to my mind: Couldn't we simply check some CPU status flags to know that we're in an exception or in an interrupt?  This way the decision to bypass the ring buffer could be entirely automatic without any explcit calls to disable the buffer, or any of the hacks I described above? I would suggest to look into this.  If it turns out it's not that simple, please report back and we can merge your current patch as-is.</p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #d4ffd4;">Code-Review +1</span></p><p><a href="https://gerrit.osmocom.org/10313">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/10313/1/firmware/libboard/common/source/uart_console.c">File firmware/libboard/common/source/uart_console.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/10313/1/firmware/libboard/common/source/uart_console.c@169">Patch Set #1, Line 169:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">hift register */<br>              while (!(pUart->UART_SR & UART_SR_TXEMPTY)); /* Wait for transfer shift register to be empty (i.e. transfer is complete) */<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">why do we wait for this?  IMHO this effectively disables the "1 byte fifo" of the transfer register?  Shouldn't it be safe to transmit the next byte as soon as the hold register has been transferred to the shift register?</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/10313">change 10313</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/10313"/><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: comment </div>
<div style="display:none"> Gerrit-Change-Id: I1b4ace5185cf2dc32684934ed12bf6a8682e9bad </div>
<div style="display:none"> Gerrit-Change-Number: 10313 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kévin Redon <kredon@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 02 Aug 2018 21:13:24 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: Yes </div>