mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, startup/bspstart.c: Create bsp_get_work_area() into its own file and use BSP Framework to perform more initialization. * startup/bspgetworkarea.c: New file.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* Makefile.am, startup/bspstart.c: Create bsp_get_work_area() into its
|
||||
own file and use BSP Framework to perform more initialization.
|
||||
* startup/bspgetworkarea.c: New file.
|
||||
|
||||
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* include/bsp.h: Review of all bsp_cleanup() implementations. In this
|
||||
|
||||
@@ -31,6 +31,7 @@ dist_project_lib_DATA += startup/linkcmds
|
||||
|
||||
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
|
||||
../../shared/bsppost.c startup/bspstart.c \
|
||||
../../shared/bsppretaskinghook.c startup/bspgetworkarea.c \
|
||||
../../shared/bootcard.c ../../shared/sbrk.c startup/setvec.c \
|
||||
../../shared/gnatinstallhandler.c
|
||||
clock_SOURCES = clock/clock.c
|
||||
|
||||
41
c/src/lib/libbsp/nios2/nios2_iss/startup/bspgetworkarea.c
Normal file
41
c/src/lib/libbsp/nios2/nios2_iss/startup/bspgetworkarea.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 <bsp/bootcard.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern void *_RamBase;
|
||||
extern void *_RamSize;
|
||||
extern void *end;
|
||||
|
||||
extern char __alt_heap_start[];
|
||||
|
||||
/*
|
||||
* This method returns the base address and size of the area which
|
||||
* is to be allocated between the RTEMS Workspace and the C Program
|
||||
* Heap.
|
||||
*/
|
||||
void bsp_get_work_area(
|
||||
void **work_area_start,
|
||||
size_t *work_area_size,
|
||||
void **heap_start,
|
||||
size_t *heap_size
|
||||
)
|
||||
{
|
||||
uintptr_t size;
|
||||
|
||||
size = (uintptr_t)&RAM_BASE + (uintptr_t)&RAM_BYTES
|
||||
- (uintptr_t)&__alt_heap_start;
|
||||
|
||||
*work_area_start = (void *)__alt_heap_start;
|
||||
*work_area_size = size;
|
||||
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
|
||||
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
|
||||
}
|
||||
|
||||
@@ -19,56 +19,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libcsupport.h>
|
||||
|
||||
/*
|
||||
* Use the shared implementations of the following routines
|
||||
*/
|
||||
|
||||
extern void bsp_libc_init( void *, uint32_t, int );
|
||||
|
||||
#if 0
|
||||
extern char _RAMBase[];
|
||||
extern char _RAMSize[];
|
||||
extern char _WorkspaceBase[];
|
||||
extern char _HeapSize[];
|
||||
#else
|
||||
extern char __alt_heap_start[];
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
unsigned long heapStart;
|
||||
unsigned long ramSpace;
|
||||
|
||||
heapStart = (unsigned long)Configuration.work_space_start
|
||||
+ rtems_configuration_get_work_space_size();
|
||||
|
||||
if (heapStart & (CPU_ALIGNMENT-1))
|
||||
heapStart = (heapStart + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
||||
|
||||
ramSpace = RAM_BASE + RAM_BYTES - heapStart;
|
||||
|
||||
/* TODO */
|
||||
ramSpace -= 16384; /* Space for initial stack, not to be zeroed */
|
||||
|
||||
bsp_libc_init((void *)heapStart, ramSpace, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* bsp_start
|
||||
@@ -78,16 +28,4 @@ void bsp_pretasking_hook(void)
|
||||
|
||||
void bsp_start( void )
|
||||
{
|
||||
/*
|
||||
* Need to "allocate" the memory for the RTEMS Workspace and
|
||||
* tell the RTEMS configuration where it is. This memory is
|
||||
* not malloc'ed. It is just "pulled from the air".
|
||||
*/
|
||||
|
||||
#if 0
|
||||
Configuration.work_space_start = (void *)_WorkspaceBase;
|
||||
#else
|
||||
Configuration.work_space_start = (void *)__alt_heap_start;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user