diff options
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/ChangeLog | 22 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/start/Makefile.am | 38 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/start/except_vect_332_ROM.S (renamed from c/src/lib/libbsp/m68k/efi332/startup/except_vect_332_ROM.S) | 0 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/start/ram_init.ld | 22 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/start/ram_init.sed | 47 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/start/start.c | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/startup/Makefile.am | 12 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/startup/linkcmds | 8 | ||||
-rw-r--r-- | c/src/lib/libbsp/m68k/efi332/startup/linkcmds_ROM | 211 |
9 files changed, 285 insertions, 79 deletions
diff --git a/c/src/lib/libbsp/m68k/efi332/ChangeLog b/c/src/lib/libbsp/m68k/efi332/ChangeLog index 1f1e4128fb..12734f424b 100644 --- a/c/src/lib/libbsp/m68k/efi332/ChangeLog +++ b/c/src/lib/libbsp/m68k/efi332/ChangeLog @@ -1,3 +1,25 @@ +2000-10-12 John S Gwynne <jgwynne@mrcday.com> + + * start/start.c: Modified to support generation of ram_init. + * start/ram_init.ld, BSP/start/ram_init.sed: New files. + These changes enable RTEMS to automatically generate + the ram_init file used by gdb with the BDM patches. The 332 has + on-board chip select lines (for RAM and FLASH) that must be + configured before use of these peripherals. These patches parse + data from start.c where the chip select lines are configured in + the runtime executable and automatically generates the gdb + initialization file using the same settings. A great time saver. + A similar file, ram_init_FW (flash writable), is also generated + that the flash programming tool uses. + * start/Makefile.am: Modified to support above. + * CPU/sim.h: Modified to support above. + * startup/except_vect_332_ROM.S: Moved to start so it would not + be included in libbsp.a. Moving it to start ensures it is + available as a single object file. + * start/except_vect_332_ROM.S: Moved from startup. + * startup/linkcmds, startup/linkcmds_ROM: Fixes to the memory map + shown in the comments. + 2000-09-29 Charles-Antoine Gauthier <charles.gauthier@nrc.ca> * startup/linkcmds: Added lines so DWARF debug information diff --git a/c/src/lib/libbsp/m68k/efi332/start/Makefile.am b/c/src/lib/libbsp/m68k/efi332/start/Makefile.am index e827e0d79e..a310b4f1f2 100644 --- a/c/src/lib/libbsp/m68k/efi332/start/Makefile.am +++ b/c/src/lib/libbsp/m68k/efi332/start/Makefile.am @@ -22,12 +22,46 @@ include $(top_srcdir)/../../../../../../automake/lib.am $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o: $(PGM) $(INSTALL_DATA) $< $@ -TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o +$(PROJECT_RELEASE)/lib/except_vect_332_ROM$(LIB_VARIANT).o: \ + $(ARCH)/except_vect_332_ROM.o + $(INSTALL_DATA) $< $@ + +$(PROJECT_RELEASE)/lib/ram_init$(LIB_VARIANT): \ + $(ARCH)/ram_init + $(INSTALL_DATA) $< $@ + +$(PROJECT_RELEASE)/lib/ram_init_FW$(LIB_VARIANT): \ + $(ARCH)/ram_init_FW + $(INSTALL_DATA) $< $@ + +$(ARCH)/ram_init: $(srcdir)/start.c $(srcdir)/ram_init.ld \ + $(srcdir)/ram_init.sed + sed -f $(srcdir)/ram_init.sed $(srcdir)/start.c >$(ARCH)/ram_init.S + $(CC) -D SIM_CRB=0x0000 -E $(ARCH)/ram_init.S >$(ARCH)/ram_init1.S + sed "/.org/ {N; s/\n/%/; P;}; /\.text/P; D;" $(ARCH)/ram_init1.S | \ + sort | sed "h;1{s/.*/.data/;P;g;};s/%.*//;P;g;s/.*%//;" \ + >$(ARCH)/ram_init2.S + $(CC) -nostdlib -Wl,-T$(srcdir)/ram_init.ld $(ARCH)/ram_init2.S \ + -o $(ARCH)/ram_init + +$(ARCH)/ram_init_FW: $(srcdir)/ram_init.ld $(ARCH)/ram_init.S + $(CC) -D FLASHWRITE -D SIM_CRB=0x0000 -E $(ARCH)/ram_init.S \ + >$(ARCH)/ram_init_FW1.S + sed "/.org/ {N; s/\n/%/; P;}; /\.text/P; D;" $(ARCH)/ram_init_FW1.S | \ + sort | sed "h;1{s/.*/.data/;P;g;};s/%.*//;P;g;s/.*%//;" \ + >$(ARCH)/ram_init_FW2.S + $(CC) -nostdlib -Wl,-T$(srcdir)/ram_init.ld $(ARCH)/ram_init_FW2.S \ + -o $(ARCH)/ram_init_FW + +TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o \ + $(PROJECT_RELEASE)/lib/ram_init$(LIB_VARIANT) \ + $(PROJECT_RELEASE)/lib/ram_init_FW$(LIB_VARIANT) \ + $(PROJECT_RELEASE)/lib/except_vect_332_ROM$(LIB_VARIANT).o all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES) .PRECIOUS: $(PGM) -EXTRA_DIST = start.c +EXTRA_DIST = start.c except_vect_332_ROM.S ram_init.ld ram_init.sed include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/efi332/startup/except_vect_332_ROM.S b/c/src/lib/libbsp/m68k/efi332/start/except_vect_332_ROM.S index 9eb2f20556..9eb2f20556 100644 --- a/c/src/lib/libbsp/m68k/efi332/startup/except_vect_332_ROM.S +++ b/c/src/lib/libbsp/m68k/efi332/start/except_vect_332_ROM.S diff --git a/c/src/lib/libbsp/m68k/efi332/start/ram_init.ld b/c/src/lib/libbsp/m68k/efi332/start/ram_init.ld new file mode 100644 index 0000000000..d469431027 --- /dev/null +++ b/c/src/lib/libbsp/m68k/efi332/start/ram_init.ld @@ -0,0 +1,22 @@ +OUTPUT_ARCH(m68k) +__DYNAMIC = 0; + +start = 0; + +MEMORY +{ + ram : ORIGIN = 0xfffa00, LENGTH = 256K +} + +SECTIONS +{ + .text : { + *(.text) + } >ram + .data : { + *(.data) + } >ram + .bss : { + *(.bss) + } >ram +} diff --git a/c/src/lib/libbsp/m68k/efi332/start/ram_init.sed b/c/src/lib/libbsp/m68k/efi332/start/ram_init.sed new file mode 100644 index 0000000000..ae664ca32d --- /dev/null +++ b/c/src/lib/libbsp/m68k/efi332/start/ram_init.sed @@ -0,0 +1,47 @@ +1 { +i\ +#include <efi332.h>\ +#define ASM\ +#include "sim.h"\ +\ +/* This file is automatically generated from EFI332_crt0.c -- DO NOT EDIT */\ +\ +/* note: For one reason or another, I could not get '|' (bit-or) to\ + work in the version of gas I'm using. I've replaced them with \ + '+' (addition) for this file. */\ +\ + .text\ +\ + +D; +}; +/include in ram_init.S/,/end include in ram_init.S/ { +/\*.*= *\(.*\)/ { +s/*/ .org / +h; +s/=.*// +P; +g; +/(.*short int)/ s/.*short int)/ .short / +/(.*char)/ s/.*char)/ .byte / +s/\/\*.*\*\/// +t dumby +:dumby +s/;//; +t next +N; +s/ *\/\*.*\*\/ *// +t dumby +b dumby +:next +s/ / /g +s/ / / +s/ *\n *//g +s/|/+/g +P; +D; +} +P; +D; +} +D; diff --git a/c/src/lib/libbsp/m68k/efi332/start/start.c b/c/src/lib/libbsp/m68k/efi332/start/start.c index 5394fb279c..03e98b8195 100644 --- a/c/src/lib/libbsp/m68k/efi332/start/start.c +++ b/c/src/lib/libbsp/m68k/efi332/start/start.c @@ -112,7 +112,7 @@ void dumby_start() { /* see section 7 of the SIM Reference Manual */ #ifdef FLASHWRITE *CSORBT = (unsigned short int) - ( BothBytes | ReadWrite | SyncAS | WaitStates_0 | UserSupSpace ); + ( BothBytes | ReadWrite | SyncAS | WaitStates_2 | UserSupSpace ); #else /* FLASHWRITE */ *CSORBT = (unsigned short int) ( BothBytes | ReadOnly | SyncAS | WaitStates_0 | UserSupSpace ); @@ -185,7 +185,7 @@ void dumby_start() { /* Port E and F Pin Assignment Register */ /* see section 9 of the SIM Reference Manual */ - *PEPAR = (unsigned char) 0; + *PEPAR = (unsigned char) 0xc3; /* siz1|siz0|dsack1|dsack0 */ *PFPAR = (unsigned char) 0; /* end of SIM initalization code */ diff --git a/c/src/lib/libbsp/m68k/efi332/startup/Makefile.am b/c/src/lib/libbsp/m68k/efi332/startup/Makefile.am index d8fa5fd721..30b383f156 100644 --- a/c/src/lib/libbsp/m68k/efi332/startup/Makefile.am +++ b/c/src/lib/libbsp/m68k/efi332/startup/Makefile.am @@ -12,7 +12,7 @@ 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_FILES = S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o) OBJS = $(C_O_FILES) $(S_O_FILES) @@ -37,20 +37,14 @@ $(PROJECT_RELEASE)/lib/linkcmds: linkcmds $(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 + $(PROJECT_RELEASE)/lib/linkcmds_ROM all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES) .PRECIOUS: $(PGM) -EXTRA_DIST = bspclean.c bspstart.c except_vect_332_ROM.S linkcmds \ - linkcmds_ROM +EXTRA_DIST = bspclean.c bspstart.c linkcmds linkcmds_ROM include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/m68k/efi332/startup/linkcmds b/c/src/lib/libbsp/m68k/efi332/startup/linkcmds index 2750cdaef8..921073d180 100644 --- a/c/src/lib/libbsp/m68k/efi332/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/efi332/startup/linkcmds @@ -9,6 +9,7 @@ __DYNAMIC = 0; /* * The memory map looks like this: * +--------------------+ <- low memory + * | _RamBase | * | .text | * | etext | * | ctor list | the ctor and dtor lists are for @@ -23,10 +24,11 @@ __DYNAMIC = 0; * | _clear_start| start of bss, cleared by crt0 * | _end | start of heap, used by sbrk() * +--------------------+ + * | _WorkspaceBase + * | work space | + * | heapStart | * | heap space | - * | _ENDHEAP | - * | stack space | - * | __stack | top of stack + * | _RamEnd | top of stack * +--------------------+ <- high memory */ diff --git a/c/src/lib/libbsp/m68k/efi332/startup/linkcmds_ROM b/c/src/lib/libbsp/m68k/efi332/startup/linkcmds_ROM index acfee4c07f..bdc7206975 100644 --- a/c/src/lib/libbsp/m68k/efi332/startup/linkcmds_ROM +++ b/c/src/lib/libbsp/m68k/efi332/startup/linkcmds_ROM @@ -8,6 +8,7 @@ STARTUP(except_vect_332_ROM.o) __DYNAMIC = 0; /* + * The memory map looks like this: * ROM: * +--------------------+ <- low memory * | .text | @@ -22,30 +23,38 @@ __DYNAMIC = 0; * * RAM: * +--------------------+ <- low memory + * | _RamBase | * | .data | initialized data goes here * | _sdata | * | _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() * +--------------------+ + * | _WorkspaceBase + * | work space | + * | heapStart | * | heap space | - * | _ENDHEAP | - * | stack space | - * | __stack | top of stack + * | _RamEnd | top of stack * +--------------------+ <- high memory */ +/* + * Declare some sizes. + */ +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x80000; +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x40000; +_RamEnd = _RamBase + _RamSize; +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000; +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; + MEMORY { rom : ORIGIN = 0x00000, LENGTH = 256K - ram : ORIGIN = 0x80000, LENGTH = 512K + ram : ORIGIN = 0x80000, LENGTH = 256K } -_RamBase = DEFINED(_RamBase) ? _RamBase : 0x080000; - -__end_of_ram = 0x100000; _copy_data_from_rom = 1; /* @@ -53,69 +62,145 @@ _copy_data_from_rom = 1; */ SECTIONS { - .text : - { - CREATE_OBJECT_SYMBOLS - text_start = .; - _text_start = .; + ram : { + . = .; + } >ram + + /* + * Text, data and bss segments + */ + .text : { *(.text) - . = ALIGN (16); - *(.eh_fram) - . = ALIGN (16); + /* + * 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) - etext = ALIGN(0x10); - _etext = .; - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + /* + * 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) - LONG(0) - __CTOR_END__ = .; - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *crtend.o(.ctors) + *crtbegin.o(.dtors) *(.dtors) - LONG(0) - __DTOR_END__ = .; - *(.lit) - *(.shdata) - _endtext = .; - } > rom - .gcc_exc : - AT ( ADDR(.text) + SIZEOF( .text ) ) - { - *(.gcc_exc) - } > ram + *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 = .); + } >rom .data : + AT ( ADDR(.text) + SIZEOF( .text ) ) { - data_start = .; - _data_start = .; - _sdata = . ; + PROVIDE (_copy_start = .); *(.data) - CONSTRUCTORS - edata = ALIGN(0x10); - _edata = .; - } > ram - .shbss : - { - *(.shbss) - } > ram - .bss : - { - __bss_start = ALIGN(0x8); - bss_start = .; - _bss_start = .; + *(.gnu.linkonce.d*) + *(.gcc_except_table) + . = ALIGN (16); + PROVIDE (_edata = .); + PROVIDE (_copy_end = .); + } >ram + .bss : { + _clear_start = .; *(.bss) *(COMMON) - end = .; - _end = ALIGN(0x8); - __end = ALIGN(0x8); - } > ram - .stab . (NOLOAD) : - { - [ .stab ] - } - .stabstr . (NOLOAD) : - { - [ .stabstr ] - } + . = ALIGN (16); + PROVIDE (end = .); + + . += _StackSize; + . = ALIGN (16); + _stack_init = .; + _clear_end = .; + + _WorkspaceBase = .; + } >ram + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ } |