2007-09-07 Joel Sherrill <joel.sherrill@oarcorp.com>

* startup/bspstart.c: If we cannot find enough memory to run the
	program, generate a fatal error and print a message.
This commit is contained in:
Joel Sherrill
2007-09-07 23:32:58 +00:00
parent 1f49f77158
commit fb61b0fea5
2 changed files with 19 additions and 13 deletions

View File

@@ -1,3 +1,8 @@
2007-09-07 Joel Sherrill <joel.sherrill@oarcorp.com>
* startup/bspstart.c: If we cannot find enough memory to run the
program, generate a fatal error and print a message.
2007-06-20 Joel Sherrill <joel.sherrill@OARcorp.com>
* ne2000/ne2000.c: Fix spelling error.

View File

@@ -59,7 +59,8 @@ uint32_t _heap_size = 0;
/* Alternative way to hardcode the board's memory size [rather than heap size].
* Can easily be overridden by application.
*/
extern uint32_t bsp_mem_size __attribute__ ((weak, alias("bsp_mem_size_default")));
extern uint32_t bsp_mem_size
__attribute__ ((weak, alias("bsp_mem_size_default")));
uint32_t bsp_mem_size_default = 0;
/* Size of stack used during initialization. Defined in 'start.s'. */
@@ -111,14 +112,13 @@ void bsp_pretasking_hook(void)
/* The memory detection algorithm is very crude; try
* to use multiboot info, if possible (set from start.S)
*/
if ( bsp_mem_size == 0
&& (_boot_multiboot_info.flags & 1)
&& _boot_multiboot_info.mem_upper ) {
if ( bsp_mem_size == 0 &&
(_boot_multiboot_info.flags & 1) &&
_boot_multiboot_info.mem_upper ) {
bsp_mem_size = _boot_multiboot_info.mem_upper * 1024;
}
if (_heap_size == 0) {
if ( _heap_size == 0 ) {
if ( bsp_mem_size == 0 ) {
/*
* We have to dynamically size memory. Memory size can be anything
@@ -139,11 +139,13 @@ void bsp_pretasking_hook(void)
}
topAddr = (i-1)*1024*1024 - 4;
} else {
topAddr = bsp_mem_size;
}
if ( rtemsFreeMemStart > topAddr ) {
printk( "Out of memory -- unable to initialize BSP\n" );
rtems_fatal_error_occurred( 0x85858585 );
}
_heap_size = topAddr - rtemsFreeMemStart;
@@ -153,10 +155,9 @@ void bsp_pretasking_hook(void)
rtemsFreeMemStart += _heap_size; /* HEAP_SIZE in KBytes */
#ifdef RTEMS_DEBUG
rtems_debug_enable(RTEMS_DEBUG_ALL_MASK);
#endif /* RTEMS_DEBUG */
} /* bsp_pretasking_hook */
/*-------------------------------------------------------------------------+