diff options
Diffstat (limited to 'c/src/lib/libbsp/m68k/mrm332/startup')
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/.cvsignore | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am | 55 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c | 27 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/bspstart.c | 72 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/except_vect_332_ROM.S | 294 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/linkcmds | 153 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/mrm332/startup/linkcmds_ROM | 163 |
7 files changed, 766 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/.cvsignore b/c/src/lib/libbsp/m68k/mrm332/startup/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/c/src/lib/libbsp/m68k/mrm332/startup/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am b/c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am new file mode 100644 index 0000000000..1801ae3072 --- /dev/null +++ b/c/src/lib/libbsp/m68k/mrm332/startup/Makefile.am @@ -0,0 +1,55 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +VPATH = @srcdir@:@srcdir@/../../shared:@srcdir@/../../../shared + +PGM = $(ARCH)/startup.rel + +C_FILES = bsplibc.c bsppost.c bspstart.c bspclean.c bootcard.c \ + m68kpretaskinghook.c main.c sbrk.c setvec.c gnatinstallhandler.c +C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) + +S_FILES = except_vect_332_ROM.S +S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o) + +OBJS = $(C_O_FILES) $(S_O_FILES) + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../../../../../../automake/lib.am + +# +# (OPTIONAL) Add local stuff here using += +# + +# USE_INIT_FINI tells main.c what C++ help we need. +AM_CPPFLAGS += -DUSE_INIT_FINI + +$(PGM): $(OBJS) + $(make-rel) + +$(PROJECT_RELEASE)/lib/linkcmds: linkcmds + $(INSTALL_DATA) $< $@ + +$(PROJECT_RELEASE)/lib/linkcmds_ROM: linkcmds_ROM + $(INSTALL_DATA) $< $@ + +$(PROJECT_RELEASE)/lib/except_vect_332_ROM$(LIB_VARIANT).o: \ + $(ARCH)/except_vect_332_ROM.o + $(INSTALL_DATA) $< $@ + +# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile +TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/linkcmds \ + $(PROJECT_RELEASE)/lib/linkcmds_ROM \ + $(PROJECT_RELEASE)/lib/except_vect_332_ROM$(LIB_VARIANT).o + +all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES) + +.PRECIOUS: $(PGM) + +EXTRA_DIST = bspclean.c bspstart.c except_vect_332_ROM.S linkcmds \ + linkcmds_ROM + +include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c b/c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c new file mode 100644 index 0000000000..c8d5656d3a --- /dev/null +++ b/c/src/lib/libbsp/m68k/mrm332/startup/bspclean.c @@ -0,0 +1,27 @@ +/* bsp_cleanup() + * + * This routine cleans up in the sense that it places the board + * in a safe state and flushes the I/O buffers before exiting. + * + * INPUT: NONE + * + * OUTPUT: NONE + * + * 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 <bsp.h> + +void bsp_cleanup(void) +{ + /* interrupt driven stdio must be flushed */ + _CPU_ISR_Set_level( 7 ); + _UART_flush(); +} diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/bspstart.c b/c/src/lib/libbsp/m68k/mrm332/startup/bspstart.c new file mode 100644 index 0000000000..b50dd710a1 --- /dev/null +++ b/c/src/lib/libbsp/m68k/mrm332/startup/bspstart.c @@ -0,0 +1,72 @@ +/* + * This routine starts the application. It includes application, + * board, and monitor specific initialization and configuration. + * The generic CPU dependent initialization has been performed + * before this routine is invoked. + * + * 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 <bsp.h> +#include <rtems/libio.h> +#include <libcsupport.h> + +#include <string.h> + +/* + * The original table from the application and our copy of it with + * some changes. + */ + +extern rtems_configuration_table Configuration; +rtems_configuration_table BSP_Configuration; + +rtems_cpu_table Cpu_table; + +char *rtems_progname; + +/* + * Use the shared implementations of the following routines + */ + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); +void bsp_pretasking_hook(void); /* m68k version */ + +/* + * bsp_start + * + * This routine does the bulk of the system initialization. + */ + +void bsp_start( void ) +{ + void *vbr; + extern void *_WorkspaceBase; + extern void *_RamSize; + extern unsigned long _M68k_Ramsize; + + _M68k_Ramsize = (unsigned long)&_RamSize; /* RAM size set in linker script */ + + /* + * we only use a hook to get the C library initialized. + */ + + Cpu_table.pretasking_hook = bsp_pretasking_hook; + Cpu_table.postdriver_hook = bsp_postdriver_hook; + + m68k_get_vbr( vbr ); + Cpu_table.interrupt_vector_table = vbr; + + BSP_Configuration.work_space_start = (void *) &_WorkspaceBase; + + /* Clock_exit is done as an atexit() function */ +} + diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/except_vect_332_ROM.S b/c/src/lib/libbsp/m68k/mrm332/startup/except_vect_332_ROM.S new file mode 100644 index 0000000000..cb8ce4cf5c --- /dev/null +++ b/c/src/lib/libbsp/m68k/mrm332/startup/except_vect_332_ROM.S @@ -0,0 +1,294 @@ +/* + * $Id$ + */ + +/* Exception Vector definitions follow */ + + /* !!! Warning !!! This table is not tested, and + the user must make sure it is complete. */ + + /* If we use TRAP #15 for reboot, note that group 0 and 1 exceptions + will have priority. */ + + /* This is the "magic word" that CPU32bug uses to indicate that + there is a bootable image here. */ + .long 0xBEEFBEEF + + /* Vector 0: RESET: Initial SSP */ + .long _RamEnd + /* Vector 1: RESET: Initial PC */ + .long start + + /* default action for undefined vectors is to re-boot */ + + /* Note group 0 and 1 exception (like trace) have priority + over other exceptions (like trap #15) that may call this. */ + + /* Vectors 2-255 */ + .long reboot /* exception vector: 2 */ + .long reboot /* exception vector: 3 */ + .long reboot /* exception vector: 4 */ + .long reboot /* exception vector: 5 */ + .long reboot /* exception vector: 6 */ + .long reboot /* exception vector: 7 */ + .long reboot /* exception vector: 8 */ + .long reboot /* exception vector: 9 */ + .long reboot /* exception vector: 10 */ + .long reboot /* exception vector: 11 */ + .long reboot /* exception vector: 12 */ + .long reboot /* exception vector: 13 */ + .long reboot /* exception vector: 14 */ + .long reboot /* exception vector: 15 */ + .long reboot /* exception vector: 16 */ + .long reboot /* exception vector: 17 */ + .long reboot /* exception vector: 18 */ + .long reboot /* exception vector: 19 */ + .long reboot /* exception vector: 20 */ + .long reboot /* exception vector: 21 */ + .long reboot /* exception vector: 22 */ + .long reboot /* exception vector: 23 */ + .long reboot /* exception vector: 24 */ + .long reboot /* exception vector: 25 */ + .long reboot /* exception vector: 26 */ + .long reboot /* exception vector: 27 */ + .long reboot /* exception vector: 28 */ + .long reboot /* exception vector: 29 */ + .long reboot /* exception vector: 30 */ + .long reboot /* exception vector: 31 */ + .long reboot /* exception vector: 32 */ + .long reboot /* exception vector: 33 */ + .long reboot /* exception vector: 34 */ + .long reboot /* exception vector: 35 */ + .long reboot /* exception vector: 36 */ + .long reboot /* exception vector: 37 */ + .long reboot /* exception vector: 38 */ + .long reboot /* exception vector: 39 */ + .long reboot /* exception vector: 40 */ + .long reboot /* exception vector: 41 */ + .long reboot /* exception vector: 42 */ + .long reboot /* exception vector: 43 */ + .long reboot /* exception vector: 44 */ + .long reboot /* exception vector: 45 */ + .long reboot /* exception vector: 46 */ + .long _reboot /* the reboot trap: 47 */ + .long reboot /* exception vector: 48 */ + .long reboot /* exception vector: 49 */ + .long reboot /* exception vector: 50 */ + .long reboot /* exception vector: 51 */ + .long reboot /* exception vector: 52 */ + .long reboot /* exception vector: 53 */ + .long reboot /* exception vector: 54 */ + .long reboot /* exception vector: 55 */ + .long reboot /* exception vector: 56 */ + .long reboot /* exception vector: 57 */ + .long reboot /* exception vector: 58 */ + .long reboot /* exception vector: 59 */ + .long reboot /* exception vector: 60 */ + .long reboot /* exception vector: 61 */ + .long reboot /* exception vector: 62 */ + .long reboot /* exception vector: 63 */ + .long reboot /* exception vector: 64 */ + .long reboot /* exception vector: 65 */ + .long reboot /* exception vector: 66 */ + .long reboot /* exception vector: 67 */ + .long reboot /* exception vector: 68 */ + .long reboot /* exception vector: 69 */ + .long reboot /* exception vector: 70 */ + .long reboot /* exception vector: 71 */ + .long reboot /* exception vector: 72 */ + .long reboot /* exception vector: 73 */ + .long reboot /* exception vector: 74 */ + .long reboot /* exception vector: 75 */ + .long reboot /* exception vector: 76 */ + .long reboot /* exception vector: 77 */ + .long reboot /* exception vector: 78 */ + .long reboot /* exception vector: 79 */ + .long reboot /* exception vector: 80 */ + .long reboot /* exception vector: 81 */ + .long reboot /* exception vector: 82 */ + .long reboot /* exception vector: 83 */ + .long reboot /* exception vector: 84 */ + .long reboot /* exception vector: 85 */ + .long reboot /* exception vector: 86 */ + .long reboot /* exception vector: 87 */ + .long reboot /* exception vector: 88 */ + .long reboot /* exception vector: 89 */ + .long reboot /* exception vector: 90 */ + .long reboot /* exception vector: 91 */ + .long reboot /* exception vector: 92 */ + .long reboot /* exception vector: 93 */ + .long reboot /* exception vector: 94 */ + .long reboot /* exception vector: 95 */ + .long reboot /* exception vector: 96 */ + .long reboot /* exception vector: 97 */ + .long reboot /* exception vector: 98 */ + .long reboot /* exception vector: 99 */ + .long reboot /* exception vector: 100 */ + .long reboot /* exception vector: 101 */ + .long reboot /* exception vector: 102 */ + .long reboot /* exception vector: 103 */ + .long reboot /* exception vector: 104 */ + .long reboot /* exception vector: 105 */ + .long reboot /* exception vector: 106 */ + .long reboot /* exception vector: 107 */ + .long reboot /* exception vector: 108 */ + .long reboot /* exception vector: 109 */ + .long reboot /* exception vector: 110 */ + .long reboot /* exception vector: 111 */ + .long reboot /* exception vector: 112 */ + .long reboot /* exception vector: 113 */ + .long reboot /* exception vector: 114 */ + .long reboot /* exception vector: 115 */ + .long reboot /* exception vector: 116 */ + .long reboot /* exception vector: 117 */ + .long reboot /* exception vector: 118 */ + .long reboot /* exception vector: 119 */ + .long reboot /* exception vector: 120 */ + .long reboot /* exception vector: 121 */ + .long reboot /* exception vector: 122 */ + .long reboot /* exception vector: 123 */ + .long reboot /* exception vector: 124 */ + .long reboot /* exception vector: 125 */ + .long reboot /* exception vector: 126 */ + .long reboot /* exception vector: 127 */ + .long reboot /* exception vector: 128 */ + .long reboot /* exception vector: 129 */ + .long reboot /* exception vector: 130 */ + .long reboot /* exception vector: 131 */ + .long reboot /* exception vector: 132 */ + .long reboot /* exception vector: 133 */ + .long reboot /* exception vector: 134 */ + .long reboot /* exception vector: 135 */ + .long reboot /* exception vector: 136 */ + .long reboot /* exception vector: 137 */ + .long reboot /* exception vector: 138 */ + .long reboot /* exception vector: 139 */ + .long reboot /* exception vector: 140 */ + .long reboot /* exception vector: 141 */ + .long reboot /* exception vector: 142 */ + .long reboot /* exception vector: 143 */ + .long reboot /* exception vector: 144 */ + .long reboot /* exception vector: 145 */ + .long reboot /* exception vector: 146 */ + .long reboot /* exception vector: 147 */ + .long reboot /* exception vector: 148 */ + .long reboot /* exception vector: 149 */ + .long reboot /* exception vector: 150 */ + .long reboot /* exception vector: 151 */ + .long reboot /* exception vector: 152 */ + .long reboot /* exception vector: 153 */ + .long reboot /* exception vector: 154 */ + .long reboot /* exception vector: 155 */ + .long reboot /* exception vector: 156 */ + .long reboot /* exception vector: 157 */ + .long reboot /* exception vector: 158 */ + .long reboot /* exception vector: 159 */ + .long reboot /* exception vector: 160 */ + .long reboot /* exception vector: 161 */ + .long reboot /* exception vector: 162 */ + .long reboot /* exception vector: 163 */ + .long reboot /* exception vector: 164 */ + .long reboot /* exception vector: 165 */ + .long reboot /* exception vector: 166 */ + .long reboot /* exception vector: 167 */ + .long reboot /* exception vector: 168 */ + .long reboot /* exception vector: 169 */ + .long reboot /* exception vector: 170 */ + .long reboot /* exception vector: 171 */ + .long reboot /* exception vector: 172 */ + .long reboot /* exception vector: 173 */ + .long reboot /* exception vector: 174 */ + .long reboot /* exception vector: 175 */ + .long reboot /* exception vector: 176 */ + .long reboot /* exception vector: 177 */ + .long reboot /* exception vector: 178 */ + .long reboot /* exception vector: 179 */ + .long reboot /* exception vector: 180 */ + .long reboot /* exception vector: 181 */ + .long reboot /* exception vector: 182 */ + .long reboot /* exception vector: 183 */ + .long reboot /* exception vector: 184 */ + .long reboot /* exception vector: 185 */ + .long reboot /* exception vector: 186 */ + .long reboot /* exception vector: 187 */ + .long reboot /* exception vector: 188 */ + .long reboot /* exception vector: 189 */ + .long reboot /* exception vector: 190 */ + .long reboot /* exception vector: 191 */ + .long reboot /* exception vector: 192 */ + .long reboot /* exception vector: 193 */ + .long reboot /* exception vector: 194 */ + .long reboot /* exception vector: 195 */ + .long reboot /* exception vector: 196 */ + .long reboot /* exception vector: 197 */ + .long reboot /* exception vector: 198 */ + .long reboot /* exception vector: 199 */ + .long reboot /* exception vector: 200 */ + .long reboot /* exception vector: 201 */ + .long reboot /* exception vector: 202 */ + .long reboot /* exception vector: 203 */ + .long reboot /* exception vector: 204 */ + .long reboot /* exception vector: 205 */ + .long reboot /* exception vector: 206 */ + .long reboot /* exception vector: 207 */ + .long reboot /* exception vector: 208 */ + .long reboot /* exception vector: 209 */ + .long reboot /* exception vector: 210 */ + .long reboot /* exception vector: 211 */ + .long reboot /* exception vector: 212 */ + .long reboot /* exception vector: 213 */ + .long reboot /* exception vector: 214 */ + .long reboot /* exception vector: 215 */ + .long reboot /* exception vector: 216 */ + .long reboot /* exception vector: 217 */ + .long reboot /* exception vector: 218 */ + .long reboot /* exception vector: 219 */ + .long reboot /* exception vector: 220 */ + .long reboot /* exception vector: 221 */ + .long reboot /* exception vector: 222 */ + .long reboot /* exception vector: 223 */ + .long reboot /* exception vector: 224 */ + .long reboot /* exception vector: 225 */ + .long reboot /* exception vector: 226 */ + .long reboot /* exception vector: 227 */ + .long reboot /* exception vector: 228 */ + .long reboot /* exception vector: 229 */ + .long reboot /* exception vector: 230 */ + .long reboot /* exception vector: 231 */ + .long reboot /* exception vector: 232 */ + .long reboot /* exception vector: 233 */ + .long reboot /* exception vector: 234 */ + .long reboot /* exception vector: 235 */ + .long reboot /* exception vector: 236 */ + .long reboot /* exception vector: 237 */ + .long reboot /* exception vector: 238 */ + .long reboot /* exception vector: 239 */ + .long reboot /* exception vector: 240 */ + .long reboot /* exception vector: 241 */ + .long reboot /* exception vector: 242 */ + .long reboot /* exception vector: 243 */ + .long reboot /* exception vector: 244 */ + .long reboot /* exception vector: 245 */ + .long reboot /* exception vector: 246 */ + .long reboot /* exception vector: 247 */ + .long reboot /* exception vector: 248 */ + .long reboot /* exception vector: 249 */ + .long reboot /* exception vector: 250 */ + .long reboot /* exception vector: 251 */ + .long reboot /* exception vector: 252 */ + .long reboot /* exception vector: 253 */ + .long reboot /* exception vector: 254 */ + .long reboot /* exception vector: 255 */ + + +_reboot: + move #0x2700,%sr /* mask interrupts */ + movea.l (0x0).w,%a7 /* load stack */ + movea.l (0x4).w,%a0 /* jmp to location of reset vector */ + jmp (%a0) + +reboot: + trap #15 /* use trap exception to enter supervisor + state. Trace mode ( and other group 0 + and 1 exceptions) *could* screw this up if + not vectored to reboot or did not return. */ diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds b/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds new file mode 100644 index 0000000000..830f3a6572 --- /dev/null +++ b/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds @@ -0,0 +1,153 @@ +/* linkcmds + * + * $Id$ + */ + +OUTPUT_ARCH(m68k) +__DYNAMIC = 0; + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _endtext | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | _clear_start| start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +/* + * Declare some sizes. + */ +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x03000; +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x80000; +_RamEnd = _RamBase + _RamSize; +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000; +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; + +MEMORY +{ + ram : ORIGIN = 0x03000, LENGTH = 0x7d000 +} + +_copy_data_from_rom = 0; + +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + ram : { + . = .; + } >ram + + /* + * Text, data and bss segments + */ + .text : { + *(.text) + + /* + * C++ constructors/destructors + */ + *(.gnu.linkonce.t.*) + + /* + * Initialization and finalization code. + * + * Various files can provide initialization and finalization + * functions. crtbegin.o and crtend.o are two instances. The + * body of these functions are in .init and .fini sections. We + * accumulate the bodies here, and prepend function prologues + * from crti.o and function epilogues from crtn.o. crti.o must + * be linked first; crtn.o must be linked last. Because these + * are wildcards, it doesn't matter if the user does not + * actually link against crti.o and crtn.o; the linker won't + * look for a file to match a wildcard. The wildcard also + * means that it doesn't matter which directory crti.o and + * crtn.o are in. + */ + PROVIDE (_init = .); + *crti.o(.init) + *(.init) + *crtn.o(.init) + PROVIDE (_fini = .); + *crti.o(.fini) + *(.fini) + *crtn.o(.fini) + + /* + * C++ constructors/destructors + * + * gcc uses crtbegin.o to find the start of the constructors + * and destructors so we make sure it is first. Because this + * is a wildcard, it doesn't matter if the user does not + * actually link against crtbegin.o; the linker won't look for + * a file to match a wildcard. The wildcard also means that + * it doesn't matter which directory crtbegin.o is in. The + * constructor and destructor list are terminated in + * crtend.o. The same comments apply to it. + */ + . = ALIGN (16); + *crtbegin.o(.ctors) + *(.ctors) + *crtend.o(.ctors) + *crtbegin.o(.dtors) + *(.dtors) + *crtend.o(.dtors) + + /* + * Exception frame info + */ + . = ALIGN (16); + *(.eh_frame) + + /* + * Read-only data + */ + . = ALIGN (16); + _rodata_start = . ; + *(.rodata) + *(.gnu.linkonce.r*) + + . = ALIGN (16); + PROVIDE (_etext = .); + } >ram + .data : { + PROVIDE (_copy_start = .); + *(.data) + *(.gnu.linkonce.d*) + *(.gcc_except_table) + . = ALIGN (16); + PROVIDE (_edata = .); + PROVIDE (_copy_end = .); + } >ram + .bss : { + _clear_start = .; + *(.bss) + *(COMMON) + . = ALIGN (16); + PROVIDE (end = .); + + . += _StackSize; + . = ALIGN (16); + _stack_init = .; + _clear_end = .; + + _WorkspaceBase = .; + } >ram +} diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds_ROM b/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds_ROM new file mode 100644 index 0000000000..7467f78a25 --- /dev/null +++ b/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds_ROM @@ -0,0 +1,163 @@ +/* linkcmds + * + * $Id$ + */ + +OUTPUT_ARCH(m68k) +STARTUP(except_vect_332_ROM.o) +__DYNAMIC = 0; + +/* + * ROM: + * +--------------------+ <- low memory + * | .text | + * | etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _endtext | + * | temporary .data | .data is moved to RAM by crt0 + * | | + * +--------------------+ <- high memory + * + * + * RAM: + * +--------------------+ <- low memory + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +MEMORY +{ + rom : ORIGIN = 0x90000, LENGTH = 0x70000 + ram : ORIGIN = 0x03000, LENGTH = 0x7d000 +} + +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x003000; +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x7d000; +_RamEnd = _RamBase + _RamSize; + +__end_of_ram = 0x080000; +_copy_data_from_rom = 1; +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000; +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; + +/* + * + */ +SECTIONS +{ + .text : + { + . = .; + CREATE_OBJECT_SYMBOLS + text_start = .; + _text_start = .; + *(.text) + . = ALIGN (16); + + + /* + * Initialization and finalization code. + * + * Various files can provide initialization and finalization + * functions. crtbegin.o and crtend.o are two instances. The + * body of these functions are in .init and .fini sections. We + * accumulate the bodies here, and prepend function prologues + * from crti.o and function epilogues from crtn.o. crti.o must + * be linked first; crtn.o must be linked last. Because these + * are wildcards, it doesn't matter if the user does not + * actually link against crti.o and crtn.o; the linker won't + * look for a file to match a wildcard. The wildcard also + * means that it doesn't matter which directory crti.o and + * crtn.o are in. + */ + PROVIDE (_init = .); + *crti.o(.init) + *(.init) + *crtn.o(.init) + PROVIDE (_fini = .); + *crti.o(.fini) + *(.fini) + *crtn.o(.fini) + + *(.eh_fram) + . = ALIGN (16); + + /* + * Read-only data + */ + . = ALIGN (16); + _rodata_start = . ; + *(.rodata) + *(.gnu.linkonce.r*) + + etext = ALIGN(0x10); + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.lit) + *(.shdata) + _etext = .; + _endtext = .; + } > rom + .gcc_exc : + AT ( ADDR(.text) + SIZEOF( .text ) ) + { + *(.gcc_exc) + } > ram + .data : + { + data_start = .; + _data_start = .; + _copy_start = .; + _sdata = . ; + *(.data) + CONSTRUCTORS + edata = ALIGN(0x10); + _edata = .; + } > ram + .shbss : + { + *(.shbss) + } > ram + .bss : + { + __bss_start = ALIGN(0x8); + bss_start = .; + _bss_start = .; + _clear_start = .; + *(.bss) + *(COMMON) + end = .; + _end = ALIGN(0x8); + __end = ALIGN(0x8); + + _WorkspaceBase = . + _StackSize; + } > ram + .stab . (NOLOAD) : + { + [ .stab ] + } + .stabstr . (NOLOAD) : + { + [ .stabstr ] + } +} |