mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 22:48:23 +00:00
Made sweep of changes to get all BSPs to the same point on the linkcmds
and memory layout. Next step is to share the same bsp_pretasking_hook.
This commit is contained in:
@@ -57,9 +57,9 @@ void bsp_libc_init( void *, unsigned32, int );
|
||||
void bsp_pretasking_hook(void)
|
||||
{
|
||||
extern void *_HeapStart;
|
||||
extern rtems_unsigned32 _HeapSize;
|
||||
extern rtems_unsigned32 HeapSize;
|
||||
|
||||
bsp_libc_init( &_HeapStart, _HeapSize, 0 );
|
||||
bsp_libc_init( &_HeapStart, HeapSize, 0 );
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
|
||||
|
||||
@@ -111,9 +111,7 @@ SECTIONS
|
||||
copy_end = .;
|
||||
} >ram
|
||||
.bss : {
|
||||
bss_start = .;
|
||||
. += (256 * 4);
|
||||
clear_start = .;
|
||||
_clear_start = .;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
. = ALIGN (16);
|
||||
@@ -127,7 +125,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
_WorkspaceBase = .;
|
||||
} >ram
|
||||
|
||||
@@ -75,7 +75,7 @@ extern "C" {
|
||||
extern char _etext[];
|
||||
extern char _copy_start[];
|
||||
extern char _edata[];
|
||||
extern char _bss_start[];
|
||||
extern char _clear_start[];
|
||||
extern char end[];
|
||||
extern char _copy_data_from_rom[];
|
||||
extern char __end_of_ram[];
|
||||
|
||||
@@ -207,7 +207,7 @@ void dumby_start() {
|
||||
*dst++ = *src++;
|
||||
|
||||
/* Zero bss */
|
||||
for (dst = _bss_start; dst< end; dst++)
|
||||
for (dst = _clear_start; dst< end; dst++)
|
||||
*dst = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ void bsp_pretasking_hook(void)
|
||||
void bsp_start( void )
|
||||
{
|
||||
void *vbr;
|
||||
extern unsigned int _WorkspaceBase;
|
||||
|
||||
/*
|
||||
* we only use a hook to get the C library initialized.
|
||||
@@ -97,7 +98,11 @@ void bsp_start( void )
|
||||
Cpu_table.interrupt_vector_table = vbr;
|
||||
|
||||
BSP_Configuration.work_space_start = (void *)
|
||||
(((unsigned int)_WorkspaceBase + STACK_SIZE + 0x100) & 0xffffff00);
|
||||
|
||||
#if 0
|
||||
(((unsigned int)_end + STACK_SIZE + 0x100) & 0xffffff00);
|
||||
#endif
|
||||
|
||||
/* Clock_exit is done as an atexit() function */
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ __DYNAMIC = 0;
|
||||
* | _edata |
|
||||
* +--------------------+
|
||||
* | .bss |
|
||||
* | __bss_start | start of bss, cleared by crt0
|
||||
* | _clear_start| start of bss, cleared by crt0
|
||||
* | _end | start of heap, used by sbrk()
|
||||
* +--------------------+
|
||||
* | heap space |
|
||||
@@ -135,7 +135,6 @@ SECTIONS
|
||||
PROVIDE (_copy_end = .);
|
||||
} >ram
|
||||
.bss : {
|
||||
PROVIDE (_bss_start = .);
|
||||
PROVIDE (_clear_start = .);
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
@@ -150,7 +149,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -75,7 +75,7 @@ extern "C" {
|
||||
extern char _etext[];
|
||||
extern char _copy_start[];
|
||||
extern char _edata[];
|
||||
extern char _bss_start[];
|
||||
extern char _clear_start[];
|
||||
extern char end[];
|
||||
extern char _copy_data_from_rom[];
|
||||
extern char __end_of_ram[];
|
||||
|
||||
@@ -49,7 +49,7 @@ void boot_card();
|
||||
*dst++ = *src++;
|
||||
|
||||
/* Zero bss */
|
||||
for (dst = _bss_start; dst< end; dst++)
|
||||
for (dst = _clear_start; dst< end; dst++)
|
||||
*dst = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ void bsp_pretasking_hook(void)
|
||||
void bsp_start( void )
|
||||
{
|
||||
void *vbr;
|
||||
extern unsigned int _WorkspaceBase;
|
||||
|
||||
/* set_debug_traps(); */
|
||||
/* breakpoint(); */
|
||||
@@ -105,7 +106,11 @@ void bsp_start( void )
|
||||
Cpu_table.interrupt_vector_table = vbr;
|
||||
|
||||
BSP_Configuration.work_space_start = (void *)
|
||||
(((unsigned int)_WorkspaceBase + STACK_SIZE + 0x100) & 0xffffff00);
|
||||
|
||||
#if 0
|
||||
(((unsigned int)_end + STACK_SIZE + 0x100) & 0xffffff00);
|
||||
#endif
|
||||
|
||||
/* Clock_exit is done as an atexit() function */
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ __DYNAMIC = 0;
|
||||
* | _edata |
|
||||
* +--------------------+
|
||||
* | .bss |
|
||||
* | __bss_start | start of bss, cleared by crt0
|
||||
* | _clear_start| start of bss, cleared by crt0
|
||||
* | _end | start of heap, used by sbrk()
|
||||
* +--------------------+
|
||||
* | heap space |
|
||||
@@ -144,7 +144,6 @@ SECTIONS
|
||||
PROVIDE (_copy_end = .);
|
||||
} >ram
|
||||
.bss : {
|
||||
PROVIDE (_bss_start = .);
|
||||
PROVIDE (_clear_start = .);
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
@@ -159,7 +158,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -197,22 +197,18 @@ cpy_Bad1: move.l d1,(a0)+
|
||||
| zero out uninitialized data area
|
||||
|
|
||||
zerobss:
|
||||
moveal # SYM (_end),a0 | find end of .bss
|
||||
moveal # SYM (_bss_start),a1 | find beginning of .bss
|
||||
moveal # SYM (_clear_end),a0 | find end of .bss
|
||||
moveal # SYM (_clear_start),a1 | find beginning of .bss
|
||||
moveq #0,d0
|
||||
|
||||
loop: movel d0,a1@+ | to zero out uninitialized
|
||||
cmpal a0,a1
|
||||
jlt loop | loop until _end reached
|
||||
jlt loop | loop until _clear_end reached
|
||||
|
||||
movel # SYM (_end),d0 | d0 = end of bss/start of heap
|
||||
addl # SYM (heap_size),d0 | d0 = end of heap
|
||||
movel d0, SYM (stack_start) | Save for brk() routine
|
||||
addl # SYM (stack_size),d0 | make room for stack
|
||||
andl #0xffffffc0,d0 | align it on 16 byte boundary
|
||||
movel d0, SYM (_stack_init) | Set Stack pointer
|
||||
movw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!!
|
||||
movel d0,a7 | set master stack pointer
|
||||
movel d0,a6 | set base pointer
|
||||
movel d0,a7 | set master stack pointer
|
||||
movel d0,a6 | set base pointer
|
||||
|
||||
/*
|
||||
* RTEMS should maintain a separate interrupt stack on CPUs
|
||||
|
||||
@@ -56,10 +56,10 @@ void bsp_libc_init( void *, unsigned32, int );
|
||||
|
||||
void bsp_pretasking_hook(void)
|
||||
{
|
||||
extern int _end;
|
||||
extern int end;
|
||||
rtems_unsigned32 heap_start;
|
||||
|
||||
heap_start = (rtems_unsigned32) &_end;
|
||||
heap_start = (rtems_unsigned32) &end;
|
||||
if (heap_start & (CPU_ALIGNMENT-1))
|
||||
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
|
||||
|
||||
|
||||
@@ -114,7 +114,6 @@ SECTIONS
|
||||
PROVIDE (_copy_end = .);
|
||||
} >ram
|
||||
.bss : {
|
||||
PROVIDE (_bss_start = .);
|
||||
PROVIDE (_clear_start = .);
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
@@ -129,7 +128,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -172,7 +172,7 @@ SECTIONS {
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -126,7 +126,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -126,7 +126,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -130,7 +130,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -130,7 +130,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -133,7 +133,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
@@ -128,7 +128,7 @@ SECTIONS
|
||||
. += HeapSize;
|
||||
PROVIDE (_HeapEnd = .);
|
||||
|
||||
clear_end = .;
|
||||
PROVIDE (_clear_end = .);
|
||||
|
||||
PROVIDE (_WorkspaceBase = .);
|
||||
} >ram
|
||||
|
||||
62
c/src/lib/libbsp/m68k/shared/m68kpretaskinghook.c
Normal file
62
c/src/lib/libbsp/m68k/shared/m68kpretaskinghook.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* This routine is an implementation of the bsp_pretasking_hook
|
||||
* that can be used by all m68k BSPs following linkcmds conventions
|
||||
* regarding heap, stack, and workspace allocation.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* 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.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <libcsupport.h>
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
extern void bsp_libc_init( void *, unsigned long, int );
|
||||
extern rtems_configuration_table BSP_Configuration;
|
||||
|
||||
extern unsigned long _RamSize;
|
||||
extern void *_WorkspaceBase;
|
||||
extern void *_HeapSize;
|
||||
|
||||
void bsp_pretasking_hook(void)
|
||||
{
|
||||
void *heapStart;
|
||||
unsigned long heapSize = (unsigned long)&_HeapSize;
|
||||
unsigned long ramSpace;
|
||||
|
||||
heapStart = (void *)
|
||||
((unsigned long)&_WorkspaceBase + BSP_Configuration.work_space_size);
|
||||
ramSpace = _RamSize - (unsigned long) heapStart;
|
||||
|
||||
if (heapSize == 0)
|
||||
heapSize = ramSpace;
|
||||
else if (heapSize > ramSpace)
|
||||
rtems_fatal_error_occurred (('H'<<24) | ('E'<<16) | ('A'<<8) | 'P');
|
||||
|
||||
bsp_libc_init(heapStart, heapSize, 0);
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -68,8 +68,8 @@ SYM (start_around):
|
||||
| zero out uninitialized data area
|
||||
|
|
||||
zerobss:
|
||||
moveal # SYM (end),a0 | find end of .bss
|
||||
moveal # SYM (_bss_start),a1 | find beginning of .bss
|
||||
moveal # SYM (_clear_end),a0 | find end of .bss
|
||||
moveal # SYM (_clear_start),a1 | find beginning of .bss
|
||||
movel #0,d0
|
||||
|
||||
loop: movel #0,a1@+ | to zero out uninitialized
|
||||
|
||||
Reference in New Issue
Block a user