forked from Imagelibrary/rtems
2008-09-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* bootcard.c, include/bootcard.h: Make letting boot_card() handle work area allocation mandatory. Rename RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION to BSP_BOOTCARD_OPTIONS.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2008-09-23 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* bootcard.c, include/bootcard.h: Make letting boot_card() handle work
|
||||||
|
area allocation mandatory. Rename
|
||||||
|
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION to BSP_BOOTCARD_OPTIONS.
|
||||||
|
|
||||||
2008-09-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
2008-09-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
* include/utility.h: New file.
|
* include/utility.h: New file.
|
||||||
|
|||||||
@@ -62,14 +62,13 @@ extern bool rtems_unified_work_area;
|
|||||||
* when the BSP lets the framework handle RAM allocation between
|
* when the BSP lets the framework handle RAM allocation between
|
||||||
* the RTEMS Workspace and C Program Heap.
|
* the RTEMS Workspace and C Program Heap.
|
||||||
*/
|
*/
|
||||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
static rtems_status_code bootcard_bsp_libc_helper(
|
||||||
static rtems_status_code bootcard_bsp_libc_helper(
|
|
||||||
void *work_area_start,
|
void *work_area_start,
|
||||||
size_t work_area_size,
|
size_t work_area_size,
|
||||||
void *heap_start,
|
void *heap_start,
|
||||||
size_t heap_size
|
size_t heap_size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
size_t heap_size_default = 0;
|
size_t heap_size_default = 0;
|
||||||
|
|
||||||
if ( !rtems_unified_work_area &&
|
if ( !rtems_unified_work_area &&
|
||||||
@@ -107,8 +106,7 @@ extern bool rtems_unified_work_area;
|
|||||||
bsp_libc_init(heap_start, heap_size, 0);
|
bsp_libc_init(heap_start, heap_size, 0);
|
||||||
|
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the initialization framework routine that weaves together
|
* This is the initialization framework routine that weaves together
|
||||||
@@ -127,13 +125,11 @@ int boot_card(
|
|||||||
char **argv_p = &argv_pointer;
|
char **argv_p = &argv_pointer;
|
||||||
char **envp_p = &envp_pointer;
|
char **envp_p = &envp_pointer;
|
||||||
rtems_interrupt_level bsp_isr_level;
|
rtems_interrupt_level bsp_isr_level;
|
||||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
void *work_area_start = NULL;
|
void *work_area_start = NULL;
|
||||||
size_t work_area_size = 0;
|
size_t work_area_size = 0;
|
||||||
void *heap_start = NULL;
|
void *heap_start = NULL;
|
||||||
size_t heap_size = 0;
|
size_t heap_size = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special case for PowerPC: The interrupt disable mask is stored in SPRG0.
|
* Special case for PowerPC: The interrupt disable mask is stored in SPRG0.
|
||||||
@@ -174,14 +170,7 @@ int boot_card(
|
|||||||
* Find out where the block of memory the BSP will use for
|
* Find out where the block of memory the BSP will use for
|
||||||
* the RTEMS Workspace and the C Program Heap is.
|
* the RTEMS Workspace and the C Program Heap is.
|
||||||
*/
|
*/
|
||||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
bsp_get_work_area(&work_area_start, &work_area_size, &heap_start, &heap_size);
|
||||||
{
|
|
||||||
bsp_get_work_area(
|
|
||||||
&work_area_start,
|
|
||||||
&work_area_size,
|
|
||||||
&heap_start,
|
|
||||||
&heap_size
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( work_area_size <= Configuration.work_space_size ) {
|
if ( work_area_size <= Configuration.work_space_size ) {
|
||||||
printk( "bootcard: Work space too big for work area!\n");
|
printk( "bootcard: Work space too big for work area!\n");
|
||||||
@@ -198,9 +187,7 @@ int boot_card(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (BSP_DIRTY_MEMORY == 1)
|
#if (BSP_DIRTY_MEMORY == 1)
|
||||||
memset( work_area_start, 0xCF, work_area_size);
|
memset( work_area_start, 0xCF, work_area_size );
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -212,19 +199,17 @@ int boot_card(
|
|||||||
* Initialize the C library for those BSPs using the shared
|
* Initialize the C library for those BSPs using the shared
|
||||||
* framework.
|
* framework.
|
||||||
*/
|
*/
|
||||||
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
|
|
||||||
sc = bootcard_bsp_libc_helper(
|
sc = bootcard_bsp_libc_helper(
|
||||||
work_area_start,
|
work_area_start,
|
||||||
work_area_size,
|
work_area_size,
|
||||||
heap_start,
|
heap_start,
|
||||||
heap_size
|
heap_size
|
||||||
);
|
);
|
||||||
if (sc != RTEMS_SUCCESSFUL) {
|
if ( sc != RTEMS_SUCCESSFUL ) {
|
||||||
printk( "bootcard: Cannot initialize C library!\n");
|
printk( "bootcard: Cannot initialize C library!\n");
|
||||||
bsp_cleanup();
|
bsp_cleanup();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All BSP to do any required initialization now that RTEMS
|
* All BSP to do any required initialization now that RTEMS
|
||||||
@@ -295,6 +280,5 @@ int boot_card(
|
|||||||
/*
|
/*
|
||||||
* Now return to the start code.
|
* Now return to the start code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <bspopts.h> /* for BSP_BOOTCARD_HANDLES_RAM_ALLOCATION */
|
#include <bspopts.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -48,18 +48,16 @@ void bsp_cleanup(void);
|
|||||||
|
|
||||||
void bsp_reset(void);
|
void bsp_reset(void);
|
||||||
|
|
||||||
#ifdef BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
|
#define BSP_BOOTCARD_HEAP_USES_WORK_AREA NULL
|
||||||
#define BSP_BOOTCARD_HEAP_USES_WORK_AREA NULL
|
|
||||||
|
|
||||||
#define BSP_BOOTCARD_HEAP_SIZE_DEFAULT 0
|
#define BSP_BOOTCARD_HEAP_SIZE_DEFAULT 0
|
||||||
|
|
||||||
void bsp_get_work_area(
|
void bsp_get_work_area(
|
||||||
void **work_area_start,
|
void **work_area_start,
|
||||||
size_t *work_area_size,
|
size_t *work_area_size,
|
||||||
void **heap_start,
|
void **heap_start,
|
||||||
size_t *heap_size
|
size_t *heap_size
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
|
|
||||||
int boot_card( int argc, char **argv, char **envp);
|
int boot_card( int argc, char **argv, char **envp);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user