This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: ftstc implementation
- From: Suhas Chakravarty <suhas dot chakravarty at gmail dot com>
- To: "Carlos O'Donell" <carlos at systemhalted dot org>
- Cc: "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Tue, 12 Aug 2014 09:33:13 +0530
- Subject: Re: ftstc implementation
- Authentication-results: sourceware.org; auth=none
- References: <CABKwiS_RQpKE6Q_SM9QS-bH-6wDEP+nOMhiEaU7h6hS7dJfs1w at mail dot gmail dot com> <CABKwiS8fc=Mx92i0tiO0O-PS-ahmfwqL6gK-_NsRrEht+51s1Q at mail dot gmail dot com> <CAE2sS1gr4w9uXzOfeFUW1tphGMyeJKMdqaQB6-rtonn1Vrk3Dw at mail dot gmail dot com> <CABKwiS9X2g6FkLExx5sLqcDMK2d0fhBxJCADaje0ZXv=nzBvVQ at mail dot gmail dot com> <CAE2sS1jar9wB__T0OL5DJjO+MCd+EQGTy_8MgmrM_YBCG0F09g at mail dot gmail dot com>
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