[PATCH] score: rtems_initialize_start_multitasking()

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Dec 6 09:04:41 UTC 2012


Do not return from rtems_initialize_start_multitasking() and call
rtems_fatal() instead with a fatal source of RTEMS_FATAL_SOURCE_EXIT and
a fatal code with the exit status.

Remove all bsp_cleanup() functions.  The boot_card() is now a no return
function.
---
 c/src/lib/libbsp/arm/gdbarmsim/start/start.S       |    2 -
 c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c |    5 ---
 c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c  |    9 -----
 c/src/lib/libbsp/m68k/mrm332/misc/interr.c         |    5 ---
 c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c     |   10 ++---
 c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c   |    7 ----
 c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c   |    7 ----
 c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c   |    7 ----
 c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c   |   29 +++------------
 c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c    |    9 -----
 .../lib/libbsp/powerpc/beatnik/startup/bspclean.c  |    7 ----
 .../lib/libbsp/powerpc/mvme5500/startup/bspclean.c |    7 ----
 .../lib/libbsp/powerpc/virtex4/startup/bspclean.c  |    8 +----
 .../lib/libbsp/powerpc/virtex5/startup/bspclean.c  |    8 +----
 c/src/lib/libbsp/shared/bootcard.c                 |   23 +++----------
 c/src/lib/libbsp/shared/bspclean.c                 |    7 ----
 c/src/lib/libbsp/shared/include/bootcard.h         |   12 ++----
 cpukit/sapi/include/rtems/init.h                   |   20 +++++++----
 cpukit/sapi/src/exinit.c                           |    7 +++-
 doc/bsp_howto/init.t                               |   36 +++++++++-----------
 doc/bsp_howto/support.t                            |   24 +++++++------
 doc/user/init.t                                    |   22 ++++++-----
 22 files changed, 80 insertions(+), 191 deletions(-)

diff --git a/c/src/lib/libbsp/arm/gdbarmsim/start/start.S b/c/src/lib/libbsp/arm/gdbarmsim/start/start.S
index 0c5df48..5a5613a 100644
--- a/c/src/lib/libbsp/arm/gdbarmsim/start/start.S
+++ b/c/src/lib/libbsp/arm/gdbarmsim/start/start.S
@@ -311,8 +311,6 @@ __change_mode:
         mov     r0, #0
 	bl	FUNCTION (boot_card)
 
-	bl	FUNCTION (bsp_cleanup)		/* Should not return.  */
-
 #if defined(__thumb__) && !defined(__thumb2__)
 	/* Come out of Thumb mode.  This code should be redundant.  */
 
diff --git a/c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c b/c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c
index 6dcda18..b713642 100644
--- a/c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c
+++ b/c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c
@@ -56,8 +56,3 @@ void bsp_fatal_extension(
   else
     reboot();
 }
-
-void bsp_cleanup(uint32_t status)
-{
-  rtems_fatal(RTEMS_FATAL_SOURCE_EXIT, status);
-}
diff --git a/c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c b/c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c
index e8c70c3..15dd244 100644
--- a/c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c
+++ b/c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c
@@ -1,6 +1,4 @@
 /*
- *  SBC5206 bsp_cleanup
- *
  *  This routine returns control from RTEMS to the monitor.
  *
  *  Author:
@@ -27,10 +25,3 @@ void bsp_fatal_extension(
 {
   printk("\nRTEMS exited!\n");
 }
-
-void  __attribute__((weak)) bsp_cleanup(
-  uint32_t status
-)
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/m68k/mrm332/misc/interr.c b/c/src/lib/libbsp/m68k/mrm332/misc/interr.c
index 356a247..d96f909 100644
--- a/c/src/lib/libbsp/m68k/mrm332/misc/interr.c
+++ b/c/src/lib/libbsp/m68k/mrm332/misc/interr.c
@@ -48,8 +48,3 @@ void bsp_fatal_extension(
   outbyte( (char)(the_error & 0xff) );
   RAW_PUTS(").\r\n");
 }
-
-void bsp_cleanup( uint32_t status )
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c b/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c
index d5ebfba..c9c94fe 100644
--- a/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c
+++ b/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c
@@ -72,12 +72,10 @@ rtems_isr Spurious_Isr(
   RAW_PUTI(sp);
   RAW_PUTS("\n\r");
 #endif
-  bsp_cleanup(1);
-
-  /* BDM SIGEMT */
-  __asm__ ("  .word  0x4afa");
-
-  for(;;);
+  rtems_fatal(
+    RTEMS_FATAL_SOURCE_BSP_GENERIC,
+    BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT
+  );
 }
 
 void Spurious_Initialize(void)
diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c
index 50feb5a..fa9fb55 100644
--- a/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c
+++ b/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c
@@ -44,10 +44,3 @@ void bsp_fatal_extension(
    M68Kvec[ 45 ] = bsp_return_to_monitor_trap;   /* install handler */
    __asm__ volatile( "trap #13" );  /* insures SUPV mode */
 }
-
-void bsp_cleanup(
-  uint32_t status
-)
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c
index 405d926..e566c1d 100644
--- a/c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c
+++ b/c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c
@@ -43,10 +43,3 @@ void bsp_fatal_extension(
    M68Kvec[ 45 ] = bsp_return_to_monitor_trap;   /* install handler */
    __asm__ volatile( "trap #13" );  /* ensures SUPV mode */
 }
-
-void bsp_cleanup(
-  uint32_t status
-)
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
index 3b275d9..ca59739 100644
--- a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
+++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c
@@ -55,10 +55,3 @@ void bsp_fatal_extension(
    M68Kvec[ 45 ] = bsp_return_to_monitor_trap;   /* install handler */
    __asm__ volatile( "trap #13" );  /* insures SUPV mode */
 }
-
-void bsp_cleanup(
-  uint32_t status
-)
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c
index 68e127f..820ffe8 100644
--- a/c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c
+++ b/c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c
@@ -49,19 +49,7 @@ static void bsp_return_to_monitor_trap( void )
   __asm__ volatile( "jmp %0@" : "=a" (start_addr) : "0" (start_addr) );
 }
 
-void bsp_fatal_extension(
-  rtems_fatal_source source,
-  bool is_internal,
-  rtems_fatal_code error
-)
-{
-   M68Kvec[ 45 ] = bsp_return_to_monitor_trap;
-   __asm__ volatile( "trap #13" );
-}
-
 /*
- *  bsp_cleanup
- *
  *  This code was copied from other MC680x0 MVME BSPs.
  *  Our guess is that someone was concerned about the CPU no longer being in
  *  supervisor mode when they got here. This function forces the CPU back to
@@ -73,18 +61,13 @@ void bsp_fatal_extension(
  *  problems if 167Bug is invoked before we get to switch the VBR back to
  *  167Bug because trap 13 is documented as being reserved for the internal
  *  use of the debugger.
- *
- *  Prototyped in rtems/c/src/lib/libbsp/m68k/mvme167/include/bsp.h
- *
- *  Input parameters: NONE
- *
- *  Output parameters: NONE
- *
- *  Return values: DOES NOT RETURN
  */
-void bsp_cleanup(
-  uint32_t status
+void bsp_fatal_extension(
+  rtems_fatal_source source,
+  bool is_internal,
+  rtems_fatal_code error
 )
 {
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
+   M68Kvec[ 45 ] = bsp_return_to_monitor_trap;
+   __asm__ volatile( "trap #13" );
 }
diff --git a/c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c b/c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c
index dc17af7..37aac9e 100644
--- a/c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c
+++ b/c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c
@@ -1,6 +1,4 @@
 /*
- *  SBC5206 bsp_cleanup
- *
  *  This routine returns control from RTEMS to the monitor.
  *
  *  Author: W. Eric Norum <norume at aps.anl.gov>
@@ -24,10 +22,3 @@ void bsp_fatal_extension(
 {
   bsp_reset();
 }
-
-void bsp_cleanup(
-  uint32_t status
-)
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/powerpc/beatnik/startup/bspclean.c b/c/src/lib/libbsp/powerpc/beatnik/startup/bspclean.c
index 1539e44..f4369b5 100644
--- a/c/src/lib/libbsp/powerpc/beatnik/startup/bspclean.c
+++ b/c/src/lib/libbsp/powerpc/beatnik/startup/bspclean.c
@@ -17,10 +17,3 @@ void bsp_fatal_extension(
   );
   bsp_reset();
 }
-
-void bsp_cleanup(
-  uint32_t status
-)
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/startup/bspclean.c b/c/src/lib/libbsp/powerpc/mvme5500/startup/bspclean.c
index fc488ea..0494696 100644
--- a/c/src/lib/libbsp/powerpc/mvme5500/startup/bspclean.c
+++ b/c/src/lib/libbsp/powerpc/mvme5500/startup/bspclean.c
@@ -24,10 +24,3 @@ void bsp_fatal_extension(
   printk("RTEMS terminated; Boot manually or turn on AUTO_BOOT.\n");
 #endif
 }
-
-void bsp_cleanup(
-  uint32_t status
-)
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/powerpc/virtex4/startup/bspclean.c b/c/src/lib/libbsp/powerpc/virtex4/startup/bspclean.c
index 3a2af55..5c7fe3d 100644
--- a/c/src/lib/libbsp/powerpc/virtex4/startup/bspclean.c
+++ b/c/src/lib/libbsp/powerpc/virtex4/startup/bspclean.c
@@ -1,5 +1,4 @@
-/*  bsp_cleanup()
- *
+/*
  *  This routine normally is part of start.s and usually returns
  *  control to a monitor.
  *
@@ -53,8 +52,3 @@ void bsp_fatal_extension(
   /* All done.  Hang out. */
   BSP_ask_for_reset();
 }
-
-void bsp_cleanup( uint32_t status )
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/bspclean.c b/c/src/lib/libbsp/powerpc/virtex5/startup/bspclean.c
index 3a2af55..5c7fe3d 100644
--- a/c/src/lib/libbsp/powerpc/virtex5/startup/bspclean.c
+++ b/c/src/lib/libbsp/powerpc/virtex5/startup/bspclean.c
@@ -1,5 +1,4 @@
-/*  bsp_cleanup()
- *
+/*
  *  This routine normally is part of start.s and usually returns
  *  control to a monitor.
  *
@@ -53,8 +52,3 @@ void bsp_fatal_extension(
   /* All done.  Hang out. */
   BSP_ask_for_reset();
 }
-
-void bsp_cleanup( uint32_t status )
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/shared/bootcard.c b/c/src/lib/libbsp/shared/bootcard.c
index 33ad0ee..a928bb2 100644
--- a/c/src/lib/libbsp/shared/bootcard.c
+++ b/c/src/lib/libbsp/shared/bootcard.c
@@ -31,8 +31,7 @@
  *        - 1st task executes C++ global constructors
  *          .... appplication runs ...
  *          - exit
- *     + back to here eventually
- *     + bspclean.c: bsp_cleanup
+ *      + will not return to here
  *
  *  This style of initialization ensures that the C++ global
  *  constructors are executed after RTEMS is initialized.
@@ -69,12 +68,11 @@ const char *bsp_boot_cmdline;
  *  the system while maximizing shared code and keeping BSP code in C
  *  as much as possible.
  */
-uint32_t boot_card(
+void boot_card(
   const char *cmdline
 )
 {
   rtems_interrupt_level  bsp_isr_level;
-  uint32_t               status = 0;
 
   /*
    * Special case for PowerPC: The interrupt disable mask is stored in SPRG0.
@@ -164,22 +162,11 @@ uint32_t boot_card(
    *  Complete initialization of RTEMS and switch to the first task.
    *  Global C++ constructors will be executed in the context of that task.
    */
-  status = rtems_initialize_start_multitasking();
+  rtems_initialize_start_multitasking();
 
   /***************************************************************
    ***************************************************************
-   *  APPLICATION RUNS HERE!!!  When it shuts down, we return!!! *
+   *  APPLICATION RUNS NOW!!!  We will not return to here!!!     *
    ***************************************************************
-   ***************************************************************
-   */
-
-  /*
-   *  Perform any BSP specific shutdown actions which are written in C.
-   */
-  bsp_cleanup( status );
-
-  /*
-   *  Now return to the start code.
-   */
-  return status;
+   ***************************************************************/
 }
diff --git a/c/src/lib/libbsp/shared/bspclean.c b/c/src/lib/libbsp/shared/bspclean.c
index 3e48c29..40955c6 100644
--- a/c/src/lib/libbsp/shared/bspclean.c
+++ b/c/src/lib/libbsp/shared/bspclean.c
@@ -1,6 +1,4 @@
 /*
- *  This is a dummy bsp_cleanup routine.
- *
  *  COPYRIGHT (c) 1989-1999.
  *  On-Line Applications Research Corporation (OAR).
  *
@@ -45,8 +43,3 @@ void bsp_fatal_extension(
     bsp_reset();
   #endif
 }
-
-void bsp_cleanup( uint32_t status )
-{
-  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
-}
diff --git a/c/src/lib/libbsp/shared/include/bootcard.h b/c/src/lib/libbsp/shared/include/bootcard.h
index 237b76d..f3de760 100644
--- a/c/src/lib/libbsp/shared/include/bootcard.h
+++ b/c/src/lib/libbsp/shared/include/bootcard.h
@@ -55,7 +55,8 @@ extern "C" {
  */
 typedef enum {
   BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION,
-  BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION
+  BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION,
+  BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT
 } bsp_generic_fatal_code;
 
 /**
@@ -71,8 +72,6 @@ void bsp_predriver_hook(void);
 
 void bsp_postdriver_hook(void);
 
-void bsp_cleanup(uint32_t status);
-
 void bsp_reset(void);
 
 /**
@@ -107,15 +106,12 @@ void bsp_reset(void);
  *   - 1st task executes C++ global constructors
  *   - .... application runs ...
  *   - exit
- * - back to here eventually
- * - bsp_cleanup()
- *
- * If something goes wrong bsp_cleanup() will be called out of order.
+ * - will not return to here
  *
  * This style of initialization ensures that the C++ global constructors are
  * executed after RTEMS is initialized.
  */
-uint32_t boot_card(const char *cmdline);
+void boot_card(const char *cmdline) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
 
 #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
   /**
diff --git a/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h
index e3a5fdf..95b7cc7 100644
--- a/cpukit/sapi/include/rtems/init.h
+++ b/cpukit/sapi/include/rtems/init.h
@@ -69,16 +69,22 @@ void rtems_initialize_before_drivers(void);
 void rtems_initialize_device_drivers(void);
 
 /**
- *  @brief rtems_initialize_start_multitasking
+ *  @brief Starts the multitasking.
  *
- *  This routine implements the early portion of rtems_initialize_executive
- *  directive up to the pretasking hook. This directive is invoked at system
- *  startup to initialize the RTEMS multitasking environment.
+ *  This directive initiates multitasking and performs a context switch to the
+ *  first user application task and may enable interrupts as a side-effect of
+ *  that context switch.  The context switch saves the executing context.  The
+ *  application runs now.  The directive rtems_shutdown_executive() will return
+ *  to the saved context.  The exit() function will use this directive.
  *
- *  @return This method returns the status code passed into the 
- *          @ref rtems_shutdown_executive directive.
+ *  After a return to the saved context a fatal system state is reached.  The
+ *  fatal source is RTEMS_FATAL_SOURCE_EXIT with a fatal code set to the value
+ *  passed to rtems_shutdown_executive().
+ *
+ *  This directive does not return.
  */
-uint32_t rtems_initialize_start_multitasking(void);
+void rtems_initialize_start_multitasking(void)
+  RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
 
 /**
  *  @brief rtems_shutdown_executive
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index 2c68434..a48ad9b 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -217,8 +217,10 @@ void rtems_initialize_device_drivers(void)
   _API_extensions_Run_postdriver();
 }
 
-uint32_t rtems_initialize_start_multitasking(void)
+void rtems_initialize_start_multitasking(void)
 {
+  uint32_t status;
+
   _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING );
 
   _Thread_Start_multitasking();
@@ -232,5 +234,6 @@ uint32_t rtems_initialize_start_multitasking(void)
    *******************************************************************
    *******************************************************************/
   
-  return _Per_CPU_Information[0].idle->Wait.return_code;
+  status = _Per_CPU_Information[0].idle->Wait.return_code;
+  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status );
 }
diff --git a/doc/bsp_howto/init.t b/doc/bsp_howto/init.t
index f91d15f..d1486cc 100644
--- a/doc/bsp_howto/init.t
+++ b/doc/bsp_howto/init.t
@@ -41,7 +41,6 @@ for this functionality.
 
 @example
 ../../sparc/shared/start.S
-../../sparc/shared/bspclean.c
 @end example
 
 @b{NOTE:} In most BSPs, the directory named @code{start340} in the
@@ -93,10 +92,9 @@ to the shared @code{bootcard.c} framework then through the C Library,
 RTEMS, device driver initialization phases, and the context switch
 to the first application task.  After this, the application executes
 until it calls @code{exit}, @code{rtems_shutdown_executive}, or some
-other normal termination initiating routine and control is returned
-to @code{bootcard.c} which allows the BSP to perform some cleanup in C
-(@code{bsp_cleanup}) and then @code{boot_card} returns to the assembly
-language which initially invoked it.
+other normal termination initiating routine and a fatal system state is
+reached.  The optional @code{bsp_fatal_extension} initial extension can perform
+BSP specific system termination.
 
 The routines invoked during this will be discussed and their location
 in the RTEMS source tree pointed out as we discuss each.
@@ -197,28 +195,26 @@ this point in the initialization sequence.  This is the last opportunity
 for the BSP to insert BSP specific code into the initialization sequence.
 
 @item It invokes the RTEMS directive
- at code{rtems_initialize_start_multitasking()} which starts multitasking and context switches to the first task.  @code{boot_card()} will not return until the application is shutdown.  As part of this sequence the following actions occur:
+ at code{rtems_initialize_start_multitasking()}
+which initiates multitasking and performs a context switch to the
+first user application task and may enable interrupts as a side-effect of
+that context switch.  The context switch saves the executing context.  The
+application runs now.  The directive rtems_shutdown_executive() will return
+to the saved context.  The exit() function will use this directive.
 
- at itemize @bullet
+After a return to the saved context a fatal system state is reached.  The
+fatal source is RTEMS_FATAL_SOURCE_EXIT with a fatal code set to the value
+passed to rtems_shutdown_executive().
 
- at item RTEMS will context switch to the first application task.  As a
-side-effect of this context switch, processor interrupts will be enabled.
-This is often the source of a fatal error during BSP development because
-the BSP did not clear and/or disable all interrupt sources and a spurious
-interrupt will occur .
+The enabling of interrupts during the first context switch is often the source
+for fatal errors during BSP development because the BSP did not clear and/or
+disable all interrupt sources and a spurious interrupt will occur.
 
- at item When in the context of the first task but before its body has been
+When in the context of the first task but before its body has been
 entered, any C++ Global Constructors will be invoked.
 
 @end itemize
 
- at item Finally after the application shutsdown RTEMS and control is
-return to @code{boot_card()} from RTEMS, it invokes the BSP specific
-routine @code{bsp_cleanup()} to perform any necessary board specific
-shutdown actions.
-
- at end itemize
-
 That's it.  We just went through the entire sequence. 
 
 @subsection bsp_start() - BSP Specific Initialization
diff --git a/doc/bsp_howto/support.t b/doc/bsp_howto/support.t
index 9856deb..5f8eb1a 100644
--- a/doc/bsp_howto/support.t
+++ b/doc/bsp_howto/support.t
@@ -179,23 +179,25 @@ this operation.
 @findex CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
 If your BSP does not want to support dynamic heap extension, then you do not have to do anything special.  However, if you want to support @code{sbrk}, you must provide an implementation of this method and define @code{CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK} in @code{bsp.h}.  This informs @code{rtems/confdefs.h} to configure the Malloc Family Extensions which support @code{sbrk}.
 
- at section bsp_cleanup(uint32_t status) - Cleanup the Hardware
+ at section bsp_fatal_extension() - Cleanup the Hardware
 
-The @code{bsp_cleanup()} is the last C code invoked.  Most of the BSPs
-use the same shared version of @code{bsp_cleanup()} that does nothing.
-This implementation is located in the following file:
+The @code{bsp_fatal_extension()} is an optional BSP specific initial extension
+invoked once a fatal system state is reached.  Most of the BSPs use the same
+shared version of @code{bsp_fatal_extension()} that does nothing or performs a
+system reset.  This implementation is located in the following file:
 
 @example
 c/src/lib/libbsp/shared/bspclean.c
 @end example
 
-The @code{bsp_cleanup()} routine can be used to return to a ROM monitor,
-insure that interrupt sources are disabled, etc..  This routine is the
-last place to ensure a clean shutdown of the hardware.  The @code{status}
-argument is the value passed to the service which initiated shutting
-down RTEMS.  All of the non-fatal shutdown sequences ultimately pass
-their exit status to @code{rtems_shutdown_executive} and this is what
-is passed to this routine.
+The @code{bsp_fatal_extension()} routine can be used to return to a ROM
+monitor, insure that interrupt sources are disabled, etc..  This routine is the
+last place to ensure a clean shutdown of the hardware.  The fatal source,
+internal error indicator, and the fatal code arguments are available to
+evaluate the fatal condition.  All of the non-fatal shutdown sequences
+ultimately pass their exit status to @code{rtems_shutdown_executive} and this
+is what is passed to this routine in case the fatal source is
+RTEMS_FATAL_SOURCE_EXIT.
 
 On some BSPs, it prints a message indicating that the application
 completed execution and waits for the user to press a key before
diff --git a/doc/user/init.t b/doc/user/init.t
index d7da360..4fe4926 100644
--- a/doc/user/init.t
+++ b/doc/user/init.t
@@ -346,7 +346,7 @@ the first context switch.
 @ifset is-C
 @findex rtems_initialize_start_multitasking
 @example
-uint32_t rtems_initialize_start_multitasking(void);
+void rtems_initialize_start_multitasking(void);
 @end example
 @end ifset
 
@@ -358,21 +358,23 @@ NOT SUPPORTED FROM Ada BINDING
 
 @subheading DIRECTIVE STATUS CODES:
 
-This directive returns the status code passed in to the 
- at code{@value{DIRPREFIX}shutdown_executive}.
+NONE
 
 @subheading DESCRIPTION:
 
-This directive is called after the other Initialization Manager
-directives have successfully completed.  This directive
-initiates multitasking and performs a context switch to
-the first user application task and enables interrupts as
-a side-effect of that context switch.
+This directive initiates multitasking and performs a context switch to the
+first user application task and may enable interrupts as a side-effect of
+that context switch.  The context switch saves the executing context.  The
+application runs now.  The directive rtems_shutdown_executive() will return
+to the saved context.  The exit() function will use this directive.
+
+After a return to the saved context a fatal system state is reached.  The
+fatal source is RTEMS_FATAL_SOURCE_EXIT with a fatal code set to the value
+passed to rtems_shutdown_executive().
 
 @subheading NOTES:
 
-This directive @b{DOES NOT RETURN} to the caller until the
- at code{@value{DIRPREFIX}shutdown_executive} is invoked.
+This directive @b{DOES NOT RETURN} to the caller.
 
 This directive causes all nodes in the system to
 verify that certain configuration parameters are the same as
-- 
1.7.7




More information about the devel mailing list