ftstc implementation

Suhas Chakravarty suhas.chakravarty@gmail.com
Tue Aug 12 04:03:00 GMT 2014


I am actually trying to create a semihosting enabled version of uboot
so that I can bring it up on my custom ARM simulator, which doesn't
have a UART in it right now. Therefore function definitions (printf,
tstc etc) in console.c (one of the uboot sources), which rely on the
target UART driver, need to be commented out and their definitions in
newlib applied. It is in this context that I was searching for a
newlib implementation of tstc/ftstc.

Regards
Suhas

On Mon, Aug 11, 2014 at 12:09 PM, Carlos O'Donell
<carlos@systemhalted.org> wrote:
> On Mon, Aug 11, 2014 at 7:44 AM, Suhas Chakravarty
> <suhas.chakravarty@gmail.com> wrote:
>> Hi Carlos
>> Sorry about replying late. Yes, I am attempting port a stripped down
>> version of uboot to the GNU compiler toolchain. The comments in uboot
>> code imply that tstc() and ftstc() are used to test for the presence
>> of a character in stdin or a file, without actually reading it. For
>> now I have thought of implementing it as a getc() followed by
>> ungetc(). Do you think that's a good enough implementation?
>
> U-Boot [1], last I checked 2 years ago, was compilable by gcc, and had
> been so for all the years I worked in embedded Linux development.
>
> Are you certain it needs porting or the use of tstc and ftstc?
>
> Yes, I do believe that implementing them using glibc's primitives is
> as good a solution as you're going to get for your a first cut of your
> work. Without any clear description of the behaviour of the function
> (thread safety, signal safety, async-signal safety etc.) you can't
> really do better.
>
> Cheers,
> Carlos.
>
> [1] http://www.denx.de/wiki/U-Boot



More information about the Libc-help mailing list