forked from Imagelibrary/rtems
2003-09-29 Till Strauman <strauman@slac.stanford.edu>
PR 497/bsps * ChangeLog, bootloader/head.S, startup/bspstart.c: Disable code that returned to the firmware when the loader starts. * startup/sbrk.c: New file.
This commit is contained in:
@@ -1,3 +1,31 @@
|
|||||||
|
2003-09-29 Till Strauman <strauman@slac.stanford.edu>
|
||||||
|
|
||||||
|
PR 497/bsps
|
||||||
|
* ChangeLog, bootloader/head.S, startup/bspstart.c: Disable code that
|
||||||
|
returned to the firmware when the loader starts.
|
||||||
|
* startup/sbrk.c: New file.
|
||||||
|
|
||||||
|
2003-09-26 Till Strauman <strauman@slac.stanford.edu>
|
||||||
|
|
||||||
|
PR 496/bsps
|
||||||
|
* startup/sbrk.c: New file.
|
||||||
|
* startup/bspstart.c: This patch implements 'sbrk'
|
||||||
|
for the powerpc-shared BSP to work around what's known as the
|
||||||
|
'32Mb problem' in combination with run-time loaded code.
|
||||||
|
GCC normally generates (PowerPC) code doing 'short jumps' which
|
||||||
|
requires all text segments being in the same 32Mb area of memory.
|
||||||
|
However, some run-time loaders use (e.g. heap-) memory violating the
|
||||||
|
stated limitation on hardware with more than 32Mb of memory.
|
||||||
|
(NOTE: portable loaders are probably not even aware of this
|
||||||
|
GCC/CPU specific problem.)
|
||||||
|
|
||||||
|
This patch implements a simple workaround: At boot time, the system is
|
||||||
|
only provided with 32Mb of memory. The user is supposed to load all
|
||||||
|
necessary modules prior to that limit being exhausted. Once that
|
||||||
|
happens, newlib/malloc end up trying to 'sbrk()' for more memory and
|
||||||
|
the implementation provided by this patch will then make the rest of
|
||||||
|
the physical memory available.
|
||||||
|
|
||||||
2003-09-26 Till Straumann <strauman@slac.stanford.edu>
|
2003-09-26 Till Straumann <strauman@slac.stanford.edu>
|
||||||
|
|
||||||
PR 497/bsps
|
PR 497/bsps
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
* code area, so that simple C routines can be called.
|
* code area, so that simple C routines can be called.
|
||||||
*/
|
*/
|
||||||
start:
|
start:
|
||||||
#if defined(USE_PPCBUG) && defined(DEBUG)
|
#if defined(USE_PPCBUG) && defined(DEBUG) && defined(REENTER_MONITOR)
|
||||||
MONITOR_ENTER
|
MONITOR_ENTER
|
||||||
#endif
|
#endif
|
||||||
bl 1f
|
bl 1f
|
||||||
@@ -308,7 +308,7 @@ moved: lwz r1,stack(bd)
|
|||||||
mtspr HID0,r0
|
mtspr HID0,r0
|
||||||
|
|
||||||
/* Provisional return to FW, works for PPCBug */
|
/* Provisional return to FW, works for PPCBug */
|
||||||
#if 0
|
#if 0 && defined(REENTER_MONITOR)
|
||||||
MONITOR_ENTER
|
MONITOR_ENTER
|
||||||
#else
|
#else
|
||||||
1: bctr
|
1: bctr
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ void bsp_pretasking_hook(void)
|
|||||||
{
|
{
|
||||||
rtems_unsigned32 heap_start;
|
rtems_unsigned32 heap_start;
|
||||||
rtems_unsigned32 heap_size;
|
rtems_unsigned32 heap_size;
|
||||||
|
rtems_unsigned32 heap_sbrk_spared;
|
||||||
|
extern rtems_unsigned32 _bsp_sbrk_init(rtems_unsigned32, rtems_unsigned32*);
|
||||||
|
|
||||||
heap_start = ((rtems_unsigned32) __rtems_end) +INIT_STACK_SIZE + INTR_STACK_SIZE;
|
heap_start = ((rtems_unsigned32) __rtems_end) +INIT_STACK_SIZE + INTR_STACK_SIZE;
|
||||||
if (heap_start & (CPU_ALIGNMENT-1))
|
if (heap_start & (CPU_ALIGNMENT-1))
|
||||||
@@ -139,10 +141,14 @@ void bsp_pretasking_hook(void)
|
|||||||
|
|
||||||
heap_size = (BSP_mem_size - heap_start) - BSP_Configuration.work_space_size;
|
heap_size = (BSP_mem_size - heap_start) - BSP_Configuration.work_space_size;
|
||||||
|
|
||||||
|
heap_sbrk_spared=_bsp_sbrk_init(heap_start, &heap_size);
|
||||||
|
|
||||||
#ifdef SHOW_MORE_INIT_SETTINGS
|
#ifdef SHOW_MORE_INIT_SETTINGS
|
||||||
printk(" HEAP start %x size %x\n", heap_start, heap_size);
|
printk(" HEAP start %x size %x (%x bytes spared for sbrk)\n", heap_start, heap_size, heap_sbrk_spared);
|
||||||
#endif
|
#endif
|
||||||
bsp_libc_init((void *) heap_start, heap_size, 0);
|
|
||||||
|
bsp_libc_init((void *) 0, heap_size, heap_sbrk_spared);
|
||||||
|
|
||||||
|
|
||||||
#ifdef RTEMS_DEBUG
|
#ifdef RTEMS_DEBUG
|
||||||
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
|
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
|
||||||
|
|||||||
Reference in New Issue
Block a user