Scanf is not working in posix sample

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Mon May 23 17:12:34 UTC 2005


Jason Davis wrote:
> Hi Joel,
> 
> It looks like you a right. I found the same issue in the mailing list of
> Sep2001. Your answer was to configure the clock tick driver. Is there an
> example availble on
> the net, that shows how to do this? This would be helpful for newbies.

It should be as adding

#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER

below the line that does the same for the console driver.

See ticker in the sample tests for an example.

> Thanks
> Jason 
> 
> -----Original Message-----
> From: Joel Sherrill <joel at OARcorp.com> [mailto:joel.sherrill at OARcorp.com] 
> Sent: Monday, May 23, 2005 12:29 AM
> To: Jason Davis
> Cc: rtems-users at rtems.com
> Subject: Re: Scanf is not working in posix sample
> 
> Jason Davis wrote:
> 
>>Hello,
>>
>>I modified a posix printf example slightly with an additional scanf. 
>>But I can't figure out why the program is not running. It starts and 
>>shows the printf "Hello World" string but the it stops without any 
>>possible input via keyboard. I'm using a PC board with a PIII.
>>
>>I added the test.c file and my makefile below. Any ideas?
> 
> 
> Is there any chance the keyboard is polled and you need to enable the clock
> tick driver?
> 
> --joel
> 
> 
> 
>>Regards,
>>Jason
>>
>>The test.c file:
>>
>>/*
>> *  Simple test program -- simplified version of sample test hello.
>> */
>>
>>#include <bsp.h>
>>
>>#include <stdlib.h>
>>#include <stdio.h>
>>#include <stdlib.h>
>>
>>void *POSIX_Init(
>>  void *argument
>>)
>>{
>>  int nummer;
>>  printf( "\n\n*** HELLO WORLD TEST ***\n" );
>>  printf( "Hello World\n" );
>>  scanf("Eingabe: %d",&nummer);
>>  printf( "*** END OF HELLO WORLD TEST ***\n" );
>>  exit( 0 );
>>}
>>
>>/* configuration information */
>>
>>#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
>>
>>#define CONFIGURE_POSIX_INIT_THREAD_TABLE
>>
>>#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
>>
>>#define CONFIGURE_INIT
>>
>>#include <confdefs.h>
>>
>>/* end of file */
>>
>>And my makefile:
>>
>>#
>>#  Makefile
>>#
>>
>>#
>>#  RTEMS_MAKEFILE_PATH is typically set in an environment variable #
>>
>>EXEC=hello.exe
>>PGM=${ARCH}/$(EXEC)
>>
>># optional managers required
>>MANAGERS=io
>>
>># C source names
>>CSRCS = test.c
>>COBJS_ = $(CSRCS:.c=.o)
>>COBJS = $(COBJS_:%=${ARCH}/%)
>>
>># C++ source names
>>CXXSRCS =
>>CXXOBJS_ = $(CXXSRCS:.cc=.o)
>>CXXOBJS = $(CXXOBJS_:%=${ARCH}/%)
>>
>># AS source names
>>ASSRCS =
>>ASOBJS_ = $(ASSRCS:.s=.o)
>>ASOBJS = $(ASOBJS_:%=${ARCH}/%)
>>
>># Libraries
>>LIBS = -lrtemsall -lc
>>
>>include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
>>
>>include $(RTEMS_CUSTOM)
>>include $(PROJECT_ROOT)/make/leaf.cfg
>>
>>OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS)
>>
>>all:    ${ARCH} $(PGM)
>>
>>$(PGM): $(OBJS)
>>	$(make-exe)
>>
>>j:
>>	@echo $(CFLAGS_DEBUG_V)
>>	@echo $(RTEMS_USE_GCC272)
>>
> 
> 
> 


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985




More information about the users mailing list