This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: diagnostic output to custom handler
>>>>> "Simon" == Simon Kallweit <simon.kallweit@intefo.ch> writes:
Simon> Bart Veer schrieb:
>>>>>>> "Simon" == Simon Kallweit <simon.kallweit@intefo.ch> writes:
>>>>>>>
>>
Simon> This patch adds the possibility to override the
Simon> diag_write_char function at run-time, allowing diagnostic
Simon> output to be redirected to a custom handler. I need this
Simon> functionality as I want the diagnostic output to be written
Simon> into a ring buffer in flash. I think this function may be
Simon> useful to others too?!?
>> What is the point of this, given that you can already insert
>> your own putc function using diag_init_putc()?
Simon> This won't change the output function for some of the
Simon> diagnostic output calls, but on a second glance it would
Simon> probably cover most of the diagnostic output and might be
Simon> just fine for my purpose.
>> The only gain appears to be that your custom write_char
>> function would not need to worry about carriage return/linefeed
>> handling, whereas a custom putc may need to do so - depending
>> on the output destination. That is not worth imposing a bit
>> more code and data bloat on everybody.
Simon> Would it make sense to allow overriding the write_char
Simon> INSTEAD of the putc call?
I think it would be better to stick with _putc, and fix any diagnostic
calls that currently don't use _putc to make them consistent with the
rest of the diag code.
An alternative approach is to tackle things at a lower level: fix the
HAL so that HAL_DIAG_WRITE_CHAR() does the right thing for your
platform, e.g. write data into flash. That may or may not be easy,
depending on the target hardware and the HAL packages involved.
Bart
--
Bart Veer eCos Configuration Architect
eCosCentric Limited The eCos experts http://www.ecoscentric.com/
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.