October 6, 2023

The Kyu real-time operating system -- console interrupt bug

I was in the middle of working on Mitchell's eth driver for Xinu. I wanted to do a printf from an interrupt routine and was not at all sure that this would work with interrupt driven uart code.

In main.c there is a call to a function "console_use_ints ()". I commented this out so that the uart code would be polled.

What happened was strange. At first I thought it was related to some kind of memory corruption done by the eth/emac code, but it can be triggered or avoided by the call above (making the call makes everything work).

The symptoms are from the "n" test menu (actually any of the test menus). You can type "n" and see the menu of tests, but if you type "n 1" to ask for test 1, you get no output at all -- it immediately returns to the prompt! I have not tracked down what is at the bottom of this.

Can we do printf from interrupt level?

I restore the call to "console_use_ints" then add a printf to the function "emac_handler" in emac.c This works just fine.


Have any comments? Questions? Drop me a line!

Kyu / tom@mmto.org