summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-07-13 18:35:04 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-07-13 18:35:04 +0000
commit1e1ee0c01796a12e6f6b2019334455555223deab (patch)
tree0ad7e9de9566f81ae1e6a41500cf086743aba85f /c
parent2011-07-13 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff)
downloadrtems-1e1ee0c01796a12e6f6b2019334455555223deab.tar.bz2
2011-07-13 Joel Sherrill <joel.sherrilL@OARcorp.com>
PR 1824/cpukit * bootcard.c, bspclean.c, include/bootcard.h: Return exit/shutdown status back to boot_card(). boot_card() propagates this to bsp_cleanup() and returns it to the assembly that started the application.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/shared/ChangeLog8
-rw-r--r--c/src/lib/libbsp/shared/bootcard.c17
-rw-r--r--c/src/lib/libbsp/shared/bspclean.c4
-rw-r--r--c/src/lib/libbsp/shared/include/bootcard.h10
4 files changed, 26 insertions, 13 deletions
diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog
index 9951fe3035..641b15ddba 100644
--- a/c/src/lib/libbsp/shared/ChangeLog
+++ b/c/src/lib/libbsp/shared/ChangeLog
@@ -1,3 +1,11 @@
+2011-07-13 Joel Sherrill <joel.sherrilL@OARcorp.com>
+
+ PR 1824/cpukit
+ * bootcard.c, bspclean.c, include/bootcard.h: Return exit/shutdown
+ status back to boot_card(). boot_card() propagates this to
+ bsp_cleanup() and returns it to the assembly that started the
+ application.
+
2011-03-21 Sebastian Huber <sebastian.huber@embedded-brains.de>
* console.c: Make device file optional.
diff --git a/c/src/lib/libbsp/shared/bootcard.c b/c/src/lib/libbsp/shared/bootcard.c
index 939a2069fa..fd7bd22fb9 100644
--- a/c/src/lib/libbsp/shared/bootcard.c
+++ b/c/src/lib/libbsp/shared/bootcard.c
@@ -111,7 +111,7 @@ static void bootcard_bsp_libc_helper(
* the system while maximizing shared code and keeping BSP code in C
* as much as possible.
*/
-int boot_card(
+uint32_t boot_card(
const char *cmdline
)
{
@@ -121,6 +121,7 @@ int boot_card(
void *heap_start = NULL;
uintptr_t heap_size = 0;
uintptr_t sbrk_amount = 0;
+ uint32_t status;
/*
* Special case for PowerPC: The interrupt disable mask is stored in SPRG0.
@@ -170,8 +171,8 @@ int boot_card(
printk("Configuration error!\n"
"Application was configured with CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK\n"
"but BSP was configured w/o sbrk support\n");
- bsp_cleanup();
- return -1;
+ bsp_cleanup(1);
+ return 1;
}
#endif
@@ -181,8 +182,8 @@ int boot_card(
(void *) Configuration.work_space_size,
(void *) work_area_size
);
- bsp_cleanup();
- return -1;
+ bsp_cleanup(1);
+ return 1;
}
if ( rtems_unified_work_area ) {
@@ -265,7 +266,7 @@ int boot_card(
* Complete initialization of RTEMS and switch to the first task.
* Global C++ constructors will be executed in the context of that task.
*/
- rtems_initialize_start_multitasking();
+ status = rtems_initialize_start_multitasking();
/***************************************************************
***************************************************************
@@ -277,10 +278,10 @@ int boot_card(
/*
* Perform any BSP specific shutdown actions which are written in C.
*/
- bsp_cleanup();
+ bsp_cleanup( status );
/*
* Now return to the start code.
*/
- return 0;
+ return status;
}
diff --git a/c/src/lib/libbsp/shared/bspclean.c b/c/src/lib/libbsp/shared/bspclean.c
index 31fa046572..6636dfb577 100644
--- a/c/src/lib/libbsp/shared/bspclean.c
+++ b/c/src/lib/libbsp/shared/bspclean.c
@@ -17,7 +17,9 @@
#include <bspopts.h>
#include <bsp/bootcard.h>
-void bsp_cleanup( void )
+void bsp_cleanup(
+ uint32_t status
+)
{
#if (BSP_PRESS_KEY_FOR_RESET)
printk( "\nEXECUTIVE SHUTDOWN! Any key to reboot..." );
diff --git a/c/src/lib/libbsp/shared/include/bootcard.h b/c/src/lib/libbsp/shared/include/bootcard.h
index 74ad6eec61..33f4883362 100644
--- a/c/src/lib/libbsp/shared/include/bootcard.h
+++ b/c/src/lib/libbsp/shared/include/bootcard.h
@@ -62,7 +62,7 @@ void bsp_predriver_hook(void);
void bsp_postdriver_hook(void);
-void bsp_cleanup(void);
+void bsp_cleanup(uint32_t status);
void bsp_reset(void);
@@ -118,9 +118,11 @@ uintptr_t bsp_sbrk_init(
* the framework for the BSP initialization sequence. The basic flow of
* initialization is:
*
- * - disable interrupts, interrupts will be enabled during the first context switch
+ * - disable interrupts, interrupts will be enabled during the first context
+ * switch
* - bsp_start() - more advanced initialization
- * - obtain information on BSP memory via bsp_get_work_area() and allocate RTEMS Workspace
+ * - obtain information on BSP memory via bsp_get_work_area() and allocate
+ * RTEMS Workspace
* - rtems_initialize_data_structures()
* - allocate memory for C Program Heap
* - initialize C Library and C Program Heap
@@ -144,7 +146,7 @@ uintptr_t bsp_sbrk_init(
* This style of initialization ensures that the C++ global constructors are
* executed after RTEMS is initialized.
*/
-int boot_card(const char *cmdline);
+uint32_t boot_card(const char *cmdline);
/** @} */