Hello world example not working on QEMU

Joel Sherrill joel at rtems.org
Sun Aug 21 11:57:37 UTC 2016


On Aug 21, 2016 1:31 AM, "Sambeet Panigrahi" <sambeet161616 at gmail.com>
wrote:
>
> Hi,
> I followed the https://devel.rtems.org/wiki/Developer/Simulators/QEMU
>  simulate RTEMS for i386. I used the hello world example from examples-v2
repository. The source code is directly taken from RTEMS C user guide.
>
> /*
>  *  Classic API Hello World
>  */
>
> #include <rtems.h> //Contains the RTEMS datatypes
> #include <stdlib.h>//Standard C library
> #include <stdio.h>//Standard C input ouput library
>
> rtems_task Init(
>   rtems_task_argument ignored
> )
> {
>   printf( "\n\n*** MODIFIED HELLO WORLD TEST ***\n" );
>   printf( "Hello Sambeet!How are You?\n" );
>   printf( "*** END OF MODIFIED HELLO WORLD TEST ***\n" );
>   exit( 0 );
> }
>
> /* configuration information */
>
> #include <bsp.h>
>
> /* NOTICE: the clock driver is explicitly disabled */
> #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> #define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
>
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> #define CONFIGURE_MAXIMUM_TASKS 1
>
> #define CONFIGURE_INIT
> #include <rtems/confdefs.h>
> /* end of file */
>
> I compiled it using RTEMS GCC, the exact same commands as the makefile
i.e.
>
>
/home/sambeet/NewRockPort/x86/Install/rtems/4.11.0-rc3/bin/i386-rtems4.11-gcc
--pipe
-B/home/sambeet/NewRockPort/x86/Install/rtems/4.11.0-rc3/i386-rtems4.11/pc486/lib/
-specs bsp_specs -qrtems   -Wall  -O2 -g    -mtune=i486      -o
o-optimize/test.exe test.c
>
> that was because makefile was showing some errors
>
> sambeet at Holmes
~/Documents/GitRepos/examples/examples-v2/hello/hello_world_c $ make
> i386-rtems4.11-gcc --pipe
-B/home/sambeet/NewRockPort/x86/Install/rtems/4.11.0-rc3/i386-rtems4.11/pc486/lib/
-specs bsp_specs -qrtems   -Wall  -O2 -g    -mtune=i486       -c   -o
o-optimize/test.o test.c
> /bin/bash: i386-rtems4.11-gcc: command not found
> make: *** [o-optimize/test.o] Error 127
>
> Now I generated the executable successfully but when I run it in QEMU.I
get a blank screen.However  when I try this which comes with i386
testsuites, I get the output
>
> /*
>  *  COPYRIGHT (c) 1989-2012.
>  *  On-Line Applications Research Corporation (OAR).
>  *
>  *  The license and distribution terms for this file may be
>  *  found in the file LICENSE in this distribution or at
>  *  http://www.rtems.org/license/LICENSE.
>  */
>
> #ifdef HAVE_CONFIG_H
> #include "config.h"
> #endif
>
> #include <rtems/test.h>
>
> #include <bsp.h> /* for device driver prototypes */
>
> #include <stdio.h>
> #include <stdlib.h>
>
> /* forward declarations to avoid warnings */
> rtems_task Init(rtems_task_argument argument);
>
> const char rtems_test_name[] = "HELLO WORLD";
>
> rtems_task Init(
>   rtems_task_argument ignored
> )
> {
>   rtems_test_begin();
>   printf( "Hello World\n" );
>   rtems_test_end();
>   exit( 0 );
> }
>
>
> /* NOTICE: the clock driver is explicitly disabled */
> #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
>
> #define CONFIGURE_MAXIMUM_TASKS            1
> #define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
>
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
>
> #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
>
> #define CONFIGURE_INIT
> #include <rtems/confdefs.h>
>
> QEMU doesn't show any error, just the blank screen, so I am not able to
figure out what,s wrong with my code,can somebody help?
>

The kernel arguments format changed a few months ago. Very likely it is
passing --console=com1 when it is now --console=/dev/com1.

Notice the addition of /dev/ to the device name so no string construction
had to occur during the BSP boot sequence.

How are you invoking qemu? If using a virtual floppy, you need to edit a
file on that virtual floppy to change this.

_______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160821/05b14ae4/attachment-0002.html>


More information about the users mailing list