I've done a fair amount of digging around in the console in the past -- 
implementing the cursor, etc. -- and I don't recall the os_time_delay() from 
that, but it was admittedly a long time ago and I haven't looked at it 
recently. I'd be curious to figure out why the os_time_delay() is needed, and 
IF it is needed, in there at all. Simply taking it out may have some unintended 
consequences that may or may not be catastrophic.

Yeah, I know, not all that helpful. Sorry. I'll dig into it when I have a 
minute.

dg

> On Jul 19, 2017, at 1:34 AM, Sterling Hughes 
> <[email protected]> wrote:
> 
> Hi,
> 
> As I was supporting the Ambiq series of processor, I ran into what I think is 
> a bug in console_queue_char().
> 
> Specifically,
> 
> - console_rx_char() is registered as a uart device callback, which operates 
> in interrupt context
> 
> - console_handle_char() is called by console_rx_char() in uart_console.c.
> 
> - console_handle_char() calls console_out()
> 
> - console_out() calls write_char_cb() which is console_queue_char()
> 
> - console_queue_char() calls os_time_delay()
> 
> So, in the cases where console_queue_char() is called in interrupt context, 
> and os_time_delay() is hit, the operating system crashes.  os_time_delay() is 
> not meant to be called from interrupt context.
> 
> I ran into this due to some errors managing the RX interrupt (more than (n) 
> bytes in a single RX interrupt), but I’m pretty sure the behavior should not 
> be this way/it will happen rarely.  What do folks think in terms of potential 
> options for changing it?
> 
> Sterling
> 
> 
> 

--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin 
<http://linkedin.com/in/davidgsimmons> • Twitter 
<http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.
* If you cannot read the PGP.sig attachment, please go to
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming 
things, and off-by-one errors.


Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to