2008-09-12 Joel Sherrill <joel.sherrill@OARcorp.com>

* Makefile.am, configure.ac, startup/bspstart.c: Now support
	bsp_get_work_area() and used shared implementation of it and
	bsp_pretasking_hook. Ticker runs.
	* startup/bspgetworkarea.c: New file.
This commit is contained in:
Joel Sherrill
2008-09-12 21:47:01 +00:00
parent 3ab13d5ce8
commit b9cb6cdf74
5 changed files with 47 additions and 108 deletions

View File

@@ -1,3 +1,10 @@
2008-09-12 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c: Now support
bsp_get_work_area() and used shared implementation of it and
bsp_pretasking_hook. Ticker runs.
* startup/bspgetworkarea.c: New file.
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* startup/bspstart.c: Review of all bsp_cleanup() implementations. In

View File

@@ -38,6 +38,7 @@ gbaoverrides_rel_CPPFLAGS = $(AM_CPPFLAGS)
gbaoverrides_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
startup/bspgetworkarea.c ../../shared/bsppretaskinghook.c \
../../shared/bsppredriverhook.c startup/bspclean.c \
../../shared/bootcard.c ../../shared/sbrk.c \
../../shared/gnatinstallhandler.c

View File

@@ -18,6 +18,8 @@ RTEMS_PROG_CCAS
RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@@ -0,0 +1,33 @@
/*
* 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 _end;
extern void __heap_limit;
/*
* 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
)
{
*work_area_start = (void *)&_end;
*work_area_size = (uintptr_t)&__heap_limit - (uintptr_t)&_end;
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
}

View File

@@ -26,89 +26,12 @@
#include <gba.h>
#include <conio.h>
#define BSP_DEBUG 0
/* Global Variables, Defined in 'linkcmds' */
extern void _end;
extern void _stack_size;
extern void _irq_max_vector;
extern void __heap_limit;
extern void __ro_start;
extern void __ro_end;
extern void __data_start;
extern void __data_end;
extern void __load_start_data;
extern void __load_stop_data;
extern void __ewram_start;
extern void __ewram_end;
extern void __load_start_ewram;
extern void __load_stop_ewram;
extern void __iwram_start;
extern void __iwram_end;
extern void __load_start_iwram;
extern void __load_stop_iwram;
extern void __bss_start;
extern void __bss_end;
/* External Prototypes */
extern void rtems_irq_mngt_init(void);
extern void bsp_libc_init( void *, uint32_t, int );
/** Chip registers */
volatile unsigned int *Regs = (unsigned int *)GBA_IO_REGS_ADDR;
/**
* Size of heap if it is 0 it will be dynamically defined by memory size,
* otherwise the value should be changed by binary patch
*/
uint32_t _heap_size = 0;
/** Address of start of free memory - should be updated after creating new partitions or regions.*/
uint32_t rtemsFreeMemStart;
/**
* @brief BSP pretasking hook.
*
* Called just before drivers are initialized.
* Used to setup libc and install any BSP extensions.
*
* NOTE: Must not use libc (to do io) from here, since drivers are not yet initialized.
*
* @param None
* @return None
*/
void bsp_pretasking_hook(void)
{
if (_heap_size == 0) {
_heap_size = (uint32_t)&__heap_limit - rtemsFreeMemStart;
}
bsp_libc_init((void *)rtemsFreeMemStart, _heap_size, 0);
rtemsFreeMemStart += _heap_size;
#if BSP_DEBUG
/* The following information is very useful when debugging. */
printk("[bsp_pretasking_hook]\n");
printk("_heap_size = 0x%x\n", _heap_size);
printk("_stack_size = 0x%x\n", (uint32_t)&_stack_size);
printk("_irq_max_vector = 0x%x\n", (uint32_t)&_irq_max_vector);
printk("__ro_start = 0x%x : __ro_end = 0x%x\n", (uint32_t)&__ro_start, (uint32_t)&__ro_end);
printk("__ewram_start = 0x%x : __ewram_end = 0x%x\n", (uint32_t)&__ewram_start, (uint32_t)&__ewram_end);
printk("__data_start = 0x%x : __data_end = 0x%x\n", (uint32_t)&__data_start, (uint32_t)&__data_end);
printk("__bss_start = 0x%x : __bss_end = 0x%x\n", (uint32_t)&__bss_start,(uint32_t)&__bss_end);
printk("__iwram_start = 0x%x : __iwram_end = 0x%x\n", (uint32_t)&__iwram_start,(uint32_t)&__iwram_end);
printk("__load_start_iwram = 0x%x\n", (uint32_t)&__load_start_iwram);
printk("__load_stop_iwram = 0x%x\n", (uint32_t)&__load_stop_iwram);
printk("__load_start_ewram = 0x%x\n", (uint32_t)&__load_start_ewram);
printk("__load_stop_ewram = 0x%x\n", (uint32_t)&__load_stop_ewram);
printk("__load_start_data = 0x%x\n", (uint32_t)&__load_start_data);
printk("__load_stop_data = 0x%x\n", (uint32_t)&__load_stop_data);
#endif
}
/**
* @brief BSP Start
*
@@ -119,46 +42,19 @@ void bsp_pretasking_hook(void)
*/
void bsp_start_default( void )
{
/* set the value of start of free memory. */
rtemsFreeMemStart = (uint32_t)&_end;
/* Place RTEMS workspace at beginning of free memory. */
Configuration.work_space_start = (void *)rtemsFreeMemStart;
rtemsFreeMemStart += rtems_configuration_get_work_space_size();
/* Init conio */
gba_textmode(CO60);
/* Init rtems exceptions management */
/*!!!!!GBA - Can't use exception vectors in GBA because they are already in GBA ROM BIOS */
/* Init rtems exceptions management
* !!!!!GBA -- Can't use exception vectors in GBA because they are
* already in GBA ROM BIOS
*/
/* rtems_exception_init_mngt(); */
/* Init rtems interrupt management */
rtems_irq_mngt_init();
#if BSP_DEBUG
/* The following information is very useful when debugging. */
printk("[bsp_start]\n");
printk("rtemsFreeMemStart= 0x%x\n", rtemsFreeMemStart);
printk("__heap_limit = 0x%x\n", (uint32_t)&__heap_limit);
printk("work_space_start = 0x%x size = 0x%x\n",
Configuration.work_space_start,
rtems_configuration_get_work_space_size());
printk("microseconds_per_tick = 0x%x\n",
rtems_configuration_get_microseconds_per_tick());
printk("ticks_per_timeslice = 0x%x\n",
rtems_configuration_get_ticks_per_timeslice());
#endif
/* Do we have enough memory */
if ((uint32_t)&__heap_limit < rtemsFreeMemStart) {
printk("\nFatal Error: Memory overflow[0x%x]!\n",rtemsFreeMemStart);
bsp_cleanup();
}
}
/**
* @brief weak alias for bsp_start_default
*