forked from Imagelibrary/rtems
2008-09-18 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c: Add bsp_get_work_area() implementation and use more of the BSP Initialization Framework. * startup/bspgetworkarea.c, startup/bsppost.c: New files.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2008-09-18 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* Makefile.am, configure.ac, startup/bspstart.c: Add
|
||||||
|
bsp_get_work_area() implementation and use more of the BSP
|
||||||
|
Initialization Framework.
|
||||||
|
* startup/bspgetworkarea.c, startup/bsppost.c: New files.
|
||||||
|
|
||||||
2008-09-18 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2008-09-18 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* include/bsp.h: Remove unnecessary boilerplate comments.
|
* include/bsp.h: Remove unnecessary boilerplate comments.
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ noinst_LIBRARIES =
|
|||||||
## endif
|
## endif
|
||||||
|
|
||||||
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
|
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
|
||||||
../../shared/bsppredriverhook.c startup/bspstart.c \
|
../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
|
||||||
|
startup/bspstart.c startup/bsppost.c startup/bspgetworkarea.c \
|
||||||
startup/setvec.c ../../shared/bootcard.c
|
startup/setvec.c ../../shared/bootcard.c
|
||||||
## for now always using main.c style startup
|
## for now always using main.c style startup
|
||||||
##if !HAS_CXX
|
##if !HAS_CXX
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ RTEMS_BSPOPTS_SET([HEAPSPACE_MB],[*],[1])
|
|||||||
RTEMS_BSPOPTS_HELP([HEAPSPACE_MB],
|
RTEMS_BSPOPTS_HELP([HEAPSPACE_MB],
|
||||||
[The BSP's heapspace RAM in MB.])
|
[The BSP's heapspace RAM in MB.])
|
||||||
|
|
||||||
|
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
|
||||||
|
|
||||||
# Explicitly list all Makefiles here
|
# Explicitly list all Makefiles here
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
36
c/src/lib/libbsp/unix/posix/startup/bspgetworkarea.c
Normal file
36
c/src/lib/libbsp/unix/posix/startup/bspgetworkarea.c
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-2008.
|
||||||
|
* 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.com/license/LICENSE.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <bsp.h>
|
||||||
|
#include <rtems/libcsupport.h>
|
||||||
|
#include <rtems/libio.h>
|
||||||
|
|
||||||
|
void bsp_get_work_area(
|
||||||
|
void **work_area_start,
|
||||||
|
size_t *work_area_size,
|
||||||
|
void **heap_start,
|
||||||
|
size_t *heap_size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
uintptr_t workspace_ptr;
|
||||||
|
|
||||||
|
workspace_ptr = (uintptr_t)
|
||||||
|
sbrk(rtems_configuration_get_work_space_size() + CPU_ALIGNMENT);
|
||||||
|
workspace_ptr += CPU_ALIGNMENT - 1;
|
||||||
|
workspace_ptr &= ~(CPU_ALIGNMENT - 1);
|
||||||
|
|
||||||
|
/* start with requested workspace + 1 MB for heap */
|
||||||
|
*work_area_start = (void *) workspace_ptr;
|
||||||
|
*work_area_size = rtems_configuration_get_work_space_size() +
|
||||||
|
(1 * 1024 * 1024);
|
||||||
|
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||||
|
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||||
|
}
|
||||||
22
c/src/lib/libbsp/unix/posix/startup/bsppost.c
Normal file
22
c/src/lib/libbsp/unix/posix/startup/bsppost.c
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This is a shared BSP post driver hook designed to open
|
||||||
|
* /dev/console for stdin, stdout, and stderr if it exists.
|
||||||
|
* Newlib will automatically associate the file descriptors
|
||||||
|
* with the first thress files opened.
|
||||||
|
*
|
||||||
|
* COPYRIGHT (c) 1989-2008.
|
||||||
|
* 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.com/license/LICENSE.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <rtems.h>
|
||||||
|
#include <bsp/bootcard.h>
|
||||||
|
|
||||||
|
void bsp_postdriver_hook(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -22,19 +22,6 @@
|
|||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <rtems/libcsupport.h>
|
#include <rtems/libcsupport.h>
|
||||||
#include <rtems/libio.h>
|
|
||||||
|
|
||||||
uint32_t Heap_size;
|
|
||||||
int rtems_argc;
|
|
||||||
char **rtems_argv;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* May be overridden by RTEMS_WORKSPACE_SIZE and RTEMS_HEAPSPACE_SIZE
|
|
||||||
* environment variables; see below.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DEFAULT_WORKSPACE_SIZE (WORKSPACE_MB * (1024 * 1024))
|
|
||||||
#define DEFAULT_HEAPSPACE_SIZE (HEAPSPACE_MB * (1024 * 1024))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Amount to increment itimer by each pass
|
* Amount to increment itimer by each pass
|
||||||
@@ -44,58 +31,13 @@ char **rtems_argv;
|
|||||||
|
|
||||||
uint32_t CPU_CLICKS_PER_TICK;
|
uint32_t CPU_CLICKS_PER_TICK;
|
||||||
|
|
||||||
/*
|
|
||||||
* Use the shared implementations of the following routines
|
|
||||||
*/
|
|
||||||
|
|
||||||
void bsp_libc_init( void *, uint32_t, int );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Function: bsp_pretasking_hook
|
|
||||||
* Created: 95/03/10
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* BSP pretasking hook. Called just before drivers are initialized.
|
|
||||||
* Used to setup libc and install any BSP extensions.
|
|
||||||
*
|
|
||||||
* NOTES:
|
|
||||||
* Must not use libc (to do io) from here, since drivers are
|
|
||||||
* not yet initialized.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void bsp_pretasking_hook(void)
|
|
||||||
{
|
|
||||||
void *heap_start;
|
|
||||||
|
|
||||||
if (getenv("RTEMS_HEAPSPACE_SIZE"))
|
|
||||||
Heap_size = strtol(getenv("RTEMS_HEAPSPACE_SIZE"), 0, 0);
|
|
||||||
else
|
|
||||||
Heap_size = DEFAULT_HEAPSPACE_SIZE;
|
|
||||||
|
|
||||||
heap_start = 0;
|
|
||||||
|
|
||||||
bsp_libc_init((void *)heap_start, Heap_size, 1024 * 1024);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DO NOT Use the shared bsp_postdriver_hook() implementation
|
|
||||||
*/
|
|
||||||
|
|
||||||
void bsp_postdriver_hook(void)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bsp_start
|
* bsp_start
|
||||||
*
|
*
|
||||||
* This routine does the bulk of the system initialization.
|
* This routine does the bulk of the system initialization.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void bsp_start(void)
|
void bsp_start(void)
|
||||||
{
|
{
|
||||||
uintptr_t workspace_ptr;
|
|
||||||
|
|
||||||
cpu_number = 0;
|
cpu_number = 0;
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
@@ -126,23 +68,5 @@ void bsp_start(void)
|
|||||||
cpu_number = Configuration.User_multiprocessing_table->node - 1;
|
cpu_number = Configuration.User_multiprocessing_table->node - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (getenv("RTEMS_WORKSPACE_SIZE"))
|
|
||||||
rtems_configuration_get_work_space_size() =
|
|
||||||
strtol(getenv("RTEMS_WORKSPACE_SIZE"), 0, 0);
|
|
||||||
else
|
|
||||||
rtems_configuration_get_work_space_size() = DEFAULT_WORKSPACE_SIZE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate workspace memory, ensuring it is properly aligned
|
|
||||||
*/
|
|
||||||
|
|
||||||
workspace_ptr =
|
|
||||||
(uintptr_t) sbrk(rtems_configuration_get_work_space_size() + CPU_ALIGNMENT);
|
|
||||||
workspace_ptr += CPU_ALIGNMENT - 1;
|
|
||||||
workspace_ptr &= ~(CPU_ALIGNMENT - 1);
|
|
||||||
|
|
||||||
Configuration.work_space_start = (void *) workspace_ptr;
|
|
||||||
|
|
||||||
CPU_CLICKS_PER_TICK = 1;
|
CPU_CLICKS_PER_TICK = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user