pc386dx exception 6 was Re: 4.6.0pre2 and docs released

Joel Sherrill joel.sherrill at OARcorp.com
Tue Apr 22 16:11:39 UTC 2003



Angelo Fraietta wrote:
> 
> I have built and modified the ticker example to show how inlcuding
> iostream causes the program to crash.
> If you comment out line 23 (the include statement), the program runs.
> This was built using gcc3.2.2. and newlib 1.11.0 And the pre-release 2.
> 
> I am curently only able to successfully run the first pre-release using
> gcc3.2 and newlib 1.10. As soon as I try to use anything later than
> this, it fails.
> 
> I am running the pc386dx BSP.
> 
> The program fails with exception 6 immediatly after the device drivers
> are initialised.

This is an illegal instruction exception. Where does the address
reported
correspond in your application?  Can you do an objdump on the ticker
file
and see what is actually at that address?

I see PR381 in the ChangeLog for 4.6.0pre2 and it appears to be
committed
to src/newlibc.c.  So that shouldn't be it.

What type of PC are you on?  What CPU is REALLY in it?  There are some
legitimate instruction variations between ix86 CPU models.  It is 
possible that the updated tool combination somehow contains or
generates an instruction that is not valid for an i386DX.  It is also
possible that your CPU model is just enough not an i386dx where
something
has finally shown up.

--joel

> Joel Sherrill wrote:
> 
> >
> > Hi,
> >
> > RTEMS 4.6.0pre2 is now available at:
> >
> > ftp://ftp.oarcorp.com/pub/rtems/cd-working
> >
> > It closes the following PRs:
> >
> > PR 338/filesystem         PR 348/bsps                 PR 349/bsps
> > PR 351/networking       PR 352/rtems_misc       PR 353/bsps
> > PR 354/networking       PR 356/bsps                PR 357/rtems_misc
> > PR 360/bsps                PR 367/filesystem         PR 368/filesystem
> > PR 368/filesystems       PR 374/networking       PR 378/bsps
> > PR 379/bsps                PR 380/bsps                 PR 381/core
> > PR 383/bsps                PR 385/filesystem         PR 387/rtems_misc
> > PR 388/networking      PR 389/rtems
> >
> > [NOTE: Hopefully next time I will know how to automate the GNATS
> > query so we will see the PR synopsis with that list. :)
> >
> > Corresponding documentation is at:
> >
> > http://www.oarcorp.com/rtemsdoc-4.6.0-pre/
> >
> > I hope this is the final preview before the release.  But feedback is
> > needed.
> >
> > Thanks
> >
> > --joel
> >
> >
> >
> 
> --
> Angelo Fraietta
> 
> PO Box 859
> Hamilton NSW 2303
> 
> Home Page
> 
> http://www.users.bigpond.com/angelo_f/
> 
> There are those who seek knowledge for the sake of knowledge - that is CURIOSITY
> There are those who seek knowledge to be known by others - that is VANITY
> There are those who seek knowledge in order to serve - that is LOVE
>     Bernard of Clairvaux (1090 - 1153)
> 
>   ------------------------------------------------------------------------
> #
> #  Makefile
> #
> 
> #
> #  RTEMS_MAKEFILE_PATH is typically set in an environment variable
> #
> 
> EXEC=ticker.exe
> PGM=${ARCH}/$(EXEC)
> 
> # optional managers required
> MANAGERS=all
> 
> # C source names
> CSRCS = init.c
> COBJS_ = $(CSRCS:.c=.o)
> COBJS = $(COBJS_:%=${ARCH}/%)
> 
> # C++ source names
> CXXSRCS = tasks.cpp
> CXXOBJS_ = $(CXXSRCS:.cpp=.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-cxx-exe)
> 
> j:
>         @echo $(CFLAGS_DEBUG_V)
>         @echo $(RTEMS_USE_GCC272)
> 
>   ------------------------------------------------------------------------
> /*  Init
>  *
>  *  This routine is the initialization task for this test program.
>  *  It is called from init_exec and has the responsibility for creating
>  *  and starting the tasks that make up the test.  If the time of day
>  *  clock is required for the test, it should also be set to a known
>  *  value by this function.
>  *
>  *  Input parameters:  NONE
>  *
>  *  Output parameters:  NONE
>  *
>  *  COPYRIGHT (c) 1989-1999.
>  *  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.OARcorp.com/rtems/license.html.
>  *
>  *  init.c,v 1.11 2000/06/12 15:00:12 joel Exp
>  */
> 
> #define CONFIGURE_INIT
> #include "system.h"
> #include <stdio.h>
> 
> rtems_task Test_task(
>   rtems_task_argument argument
> );
> 
> /*
>  *  Keep the names and IDs in global variables so another task can use them.
>  */
> 
> rtems_id   Task_id[ 4 ];         /* array of task ids */
> rtems_name Task_name[ 4 ];       /* array of task names */
> 
> rtems_task Init(
>   rtems_task_argument argument
> )
> {
>   rtems_status_code status;
>   rtems_time_of_day time;
> 
>   puts( "\n\n*** CLOCK TICK TEST ***" );
> 
>   time.year   = 1988;
>   time.month  = 12;
>   time.day    = 31;
>   time.hour   = 9;
>   time.minute = 0;
>   time.second = 0;
>   time.ticks  = 0;
> 
>   status = rtems_clock_set( &time );
> 
>   Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
>   Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
>   Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
> 
>   status = rtems_task_create(
>     Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 8, RTEMS_DEFAULT_MODES,
>     RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
>   );
> 
>         /*
>   status = rtems_task_create(
>     Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
>     RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
>   );
>   status = rtems_task_create(
>         Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
>         RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
>   );
>         */
>         if (status == RTEMS_SUCCESSFUL)
>         {
>                 printf ("Stack Size = %u\r\n", RTEMS_MINIMUM_STACK_SIZE);
>                 puts("Starting Task");
>                 status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
>         }
>         else
>                 {
>                         puts("Unable to create task");
>                 }
>         /*
>   status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
>   status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
>         */
>   status = rtems_task_delete( RTEMS_SELF );
> }
> 
>   ------------------------------------------------------------------------
> /*  system.h
>  *
>  *  This include file contains information that is included in every
>  *  function in the test set.
>  *
>  *  COPYRIGHT (c) 1989-1999.
>  *  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.OARcorp.com/rtems/license.html.
>  *
>  *  system.h,v 1.13 2000/06/12 15:00:12 joel Exp
>  */
> 
> #include <rtems.h>
> 
> /* functions */
> 
> rtems_task Init(
>   rtems_task_argument argument
> );
> 
> /* global variables */
> 
> /*
>  *  Keep the names and IDs in global variables so another task can use them.
>  */
> 
> extern rtems_id   Task_id[ 4 ];         /* array of task ids */
> extern rtems_name Task_name[ 4 ];       /* array of task names */
> 
> /* configuration information */
> 
> #include <bsp.h> /* for device driver prototypes */
> 
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
> 
> #define CONFIGURE_MAXIMUM_TASKS             4
> 
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> 
> #define CONFIGURE_EXTRA_TASK_STACKS         (10 * RTEMS_MINIMUM_STACK_SIZE * CONFIGURE_MAXIMUM_TASKS)
> 
> #include <confdefs.h>
> 
> /*
>  *  Handy macros and static inline functions
>  */
> 
> /*
>  *  Macro to hide the ugliness of printing the time.
>  */
> 
> #define print_time(_s1, _tb, _s2) \
>   do { \
>     printf( "%s%02d:%02d:%02d   %02d/%02d/%04d%s", \
>        _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \
>        (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \
>     fflush(stdout); \
>   } while ( 0 )
> 
> /*
>  *  Macro to print an task name that is composed of ASCII characters.
>  *
>  */
> 
> #define put_name( _name, _crlf ) \
>   do { \
>     rtems_unsigned32 c0, c1, c2, c3; \
>     \
>     c0 = ((_name) >> 24) & 0xff; \
>     c1 = ((_name) >> 16) & 0xff; \
>     c2 = ((_name) >> 8) & 0xff; \
>     c3 = (_name) & 0xff; \
>     putchar( (char)c0 ); \
>     if ( c1 ) putchar( (char)c1 ); \
>     if ( c2 ) putchar( (char)c2 ); \
>     if ( c3 ) putchar( (char)c3 ); \
>     if ( (_crlf) ) \
>       putchar( '\n' ); \
>   } while (0)
> 
> /*
>  *  static inline routine to make obtaining ticks per second easier.
>  */
> 
> static inline rtems_unsigned32 get_ticks_per_second( void )
> {
>   rtems_interval ticks_per_second;
>   (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );  return ticks_per_second;
> }
> 
> /*
>  *  This allows us to view the "Test_task" instantiations as a set
>  *  of numbered tasks by eliminating the number of application
>  *  tasks created.
>  *
>  *  In reality, this is too complex for the purposes of this
>  *  example.  It would have been easier to pass a task argument. :)
>  *  But it shows how rtems_id's can sometimes be used.
>  */
> 
> #define task_number( tid ) \
>   ( rtems_get_index( tid ) - \
>      rtems_configuration_get_rtems_api_configuration()->number_of_initialization_tasks )
> 
> /* end of include file */
> 
>   ------------------------------------------------------------------------
> /*  Test_task
>  *
>  *  This routine serves as a test task.  It verifies the basic task
>  *  switching capabilities of the executive.
>  *
>  *  Input parameters:  NONE
>  *
>  *  Output parameters:  NONE
>  *
>  *  COPYRIGHT (c) 1989-1999.
>  *  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.OARcorp.com/rtems/license.html.
>  *
>  *  tasks.c,v 1.9 2002/04/17 14:01:40 joel Exp
>  */
> 
> #include "system.h"
> #include <stdio.h>
> #include <stdlib.h>
> #include <iostream>
> 
> extern "C" rtems_task Test_task(
>   rtems_task_argument unused
> )
> {
> 
>   rtems_id          tid;
>   rtems_time_of_day time;
>   rtems_unsigned32  task_index;
>   rtems_status_code status;
> 
>   status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
>   task_index = task_number( tid );
>   for ( ; ; ) {
>                 printf ("tick\r\n");
>     status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
>     if ( time.second >= 35 ) {
>       puts( "*** END OF CLOCK TICK TEST ***" );
>       exit( 0 );
>     }
> 
>     print_time( " - rtems_clock_get - ", &time, "\n" );
>     status = rtems_task_wake_after( task_index * 5 * get_ticks_per_second() );
>   }
> 
> }



More information about the users mailing list