[m68k] linker scripts for cf bsps
Jeff Johnston
jjohnstn@redhat.com
Tue Feb 21 21:57:00 GMT 2006
I would prefer to call these CF_SCRIPTS (i.e. something more meaningful
than DBUG_SCRIPTS), even though you are using the DBUG_BSP.
I can do this for you if you would like.
-- Jeff J.
Nathan Sidwell wrote:
> this patch adds libgloss support for five coldfire bsps -- m5208evb.ld,
> m5213evb.ld, m5235evb.ld, m5272c3.ld, m5282evb.ld.
>
> ok?
>
> nathan
>
>
> ------------------------------------------------------------------------
>
> 2006-02-21 Nathan Sidwell <nathan@codesourcery.com>
>
> * m68k/Makefile.in (DBUG_SCRIPTS): New.
> (all): Add DEBUG_SCRIPTS.
> (m5208evb.ld, m5213evb.ld, m5235evb.ld, m5272c3.ld,
> m5282evb.ld): New targets
> (install): Iterate over DBUG_SCRIPTS.
> * m68k/crt0.S: Don't use dbra on any cf chips.
> * m68k/dbug-cf.sc: New.
>
> Index: m68k/Makefile.in
> ===================================================================
> RCS file: /cvs/src/src/libgloss/m68k/Makefile.in,v
> retrieving revision 1.4
> diff -c -3 -p -r1.4 Makefile.in
> *** m68k/Makefile.in 28 Jun 2004 22:42:20 -0000 1.4
> --- m68k/Makefile.in 21 Feb 2006 14:57:02 -0000
> *************** IDPGDB_OBJS= leds.o idp-inbyte.o idp-gdb
> *** 122,127 ****
> --- 122,128 ----
> #
> DBUG_BSP= libdbug.a
> DBUG_OBJS= dbug-exit.o dbug-inbyte.o dbug-outbyte.o
> + DBUG_SCRIPTS= m5208evb.ld m5213evb.ld m5235evb.ld m5272c3.ld m5282evb.ld
>
> # Host specific makefile fragment comes in here.
> @host_makefile_frag@
> *************** DBUG_OBJS= dbug-exit.o dbug-inbyte.o dbu
> *** 130,136 ****
> # build a test program for each target board. Just trying to get
> # it to link is a good test, so we ignore all the errors for now.
> #
> ! all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} ${MVME135_BSP} ${MVME162_BSP} ${DBUG_BSP}
>
> #
> # here's where we build the board support packages for each target
> --- 131,137 ----
> # build a test program for each target board. Just trying to get
> # it to link is a good test, so we ignore all the errors for now.
> #
> ! all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} ${MVME135_BSP} ${MVME162_BSP} ${DBUG_BSP} ${DBUG_SCRIPTS}
>
> #
> # here's where we build the board support packages for each target
> *************** ${MVME162_BSP}: $(OBJS) ${MVME162_OBJS}
> *** 163,168 ****
> --- 164,184 ----
> ${AR} ${ARFLAGS} $@ $(OBJS) ${MVME162_OBJS}
> ${RANLIB} $@
>
> + m5208evb.ld: dbug-cf.sc Makefile
> + RAMSTART=1024M RAMSIZE=16M RAMDBUG=128K ${SHELL} $< > $@
> +
> + m5213evb.ld: dbug-cf.sc Makefile
> + RAMSTART=512M RAMSIZE=32K RAMDBUG=8K ${SHELL} $< > $@
> +
> + m5235evb.ld: dbug-cf.sc Makefile
> + RAMSTART=0M RAMSIZE=16M RAMDBUG=64K ${SHELL} $< > $@
> +
> + m5272c3.ld: dbug-cf.sc Makefile
> + RAMSTART=0M RAMSIZE=4M RAMDBUG=128K ${SHELL} $< > $@
> +
> + m5282evb.ld: dbug-cf.sc Makefile
> + RAMSTART=0M RAMSIZE=16M RAMDBUG=64K ${SHELL} $< > $@
> +
> leds.o: ${srcdir}/leds.c
> $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
>
> *************** install:
> *** 283,288 ****
> --- 299,307 ----
> $(INSTALL_PROGRAM) $(DBUG_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(DBUG_BSP)
> $(INSTALL_DATA) ${srcdir}/sbc5204.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5204.ld
> $(INSTALL_DATA) ${srcdir}/sbc5206.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5206.ld
> + for script in $(DBUG_SCRIPTS) ; \
> + do $(INSTALL_DATA) $$script $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$script ; \
> + done
>
> # target specific makefile fragment comes in here.
> @target_makefile_frag@
> Index: m68k/crt0.S
> ===================================================================
> RCS file: /cvs/src/src/libgloss/m68k/crt0.S,v
> retrieving revision 1.2
> diff -c -3 -p -r1.2 crt0.S
> *** m68k/crt0.S 27 Oct 2003 20:03:10 -0000 1.2
> --- m68k/crt0.S 21 Feb 2006 14:57:02 -0000
> *************** SYM (start):
> *** 84,90 ****
> subql IMM(1), d0
> 2:
> clrb (a0)+
> ! #if !defined(__mcoldfire__) && !defined(__mcf5200__)
> dbra d0, 2b
> clrw d0
> subql IMM(1), d0
> --- 84,90 ----
> subql IMM(1), d0
> 2:
> clrb (a0)+
> ! #if !defined(__mcoldfire__)
> dbra d0, 2b
> clrw d0
> subql IMM(1), d0
> Index: m68k/dbug-cf.sc
> ===================================================================
> RCS file: m68k/dbug-cf.sc
> diff -N m68k/dbug-cf.sc
> *** /dev/null 1 Jan 1970 00:00:00 -0000
> --- m68k/dbug-cf.sc 21 Feb 2006 14:57:02 -0000
> ***************
> *** 0 ****
> --- 1,112 ----
> + # a linker script template.
> + # RAMSTART - start of board's ram
> + # RAMSIZE - size of board's ram
> + # RAMDBUG - bytes at start of RAM for DBUG use
> +
> + cat <<EOF
> + STARTUP(crt0.o)
> + OUTPUT_ARCH(m68k)
> + /* DBUG loads SREC files */
> + /*OUTPUT_FORMAT(srec)*/
> + ENTRY(start)
> + SEARCH_DIR(.)
> + GROUP(-ldbug -lc -lgcc -ldbug)
> + __DYNAMIC = 0;
> +
> + MEMORY
> + {
> + ram (rwx) : ORIGIN = ${RAMSTART} + ${RAMDBUG:-0},
> + LENGTH = ${RAMSIZE} - ${RAMDBUG:-0}
> + }
> +
> + PROVIDE (__stack = ${RAMSTART} + ${RAMSIZE});
> +
> + /*
> + * Initalize some symbols to be zero so we can reference them in the
> + * crt0 without core dumping. These functions are all optional, but
> + * we do this so we can have our crt0 always use them if they exist.
> + * This is so BSPs work better when using the crt0 installed gcc.
> + * We have to initalize them twice, so we cover a.out (which prepends
> + * an underscore) and coff object file formats.
> + */
> + PROVIDE (hardware_init_hook = 0);
> + PROVIDE (_hardware_init_hook = 0);
> + PROVIDE (software_init_hook = 0);
> + PROVIDE (_software_init_hook = 0);
> + /*
> + * stick everything in ram (of course)
> + */
> + SECTIONS
> + {
> + .text :
> + {
> + CREATE_OBJECT_SYMBOLS
> + *(.text .text.*)
> +
> + . = ALIGN(0x4);
> + /* These are for running static constructors and destructors under ELF. */
> + KEEP (*crtbegin.o(.ctors))
> + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
> + KEEP (*(SORT(.ctors.*)))
> + KEEP (*(.ctors))
> + KEEP (*crtbegin.o(.dtors))
> + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
> + KEEP (*(SORT(.dtors.*)))
> + KEEP (*(.dtors))
> +
> + *(.rodata .rodata.*)
> +
> + . = ALIGN(0x4);
> + *(.gcc_except_table)
> +
> + . = ALIGN(0x4);
> + *(.eh_frame)
> +
> + . = ALIGN(0x4);
> + __INIT_SECTION__ = . ;
> + LONG (0x4e560000) /* linkw %fp,#0 */
> + *(.init)
> + SHORT (0x4e5e) /* unlk %fp */
> + SHORT (0x4e75) /* rts */
> +
> + . = ALIGN(0x4);
> + __FINI_SECTION__ = . ;
> + LONG (0x4e560000) /* linkw %fp,#0 */
> + *(.fini)
> + SHORT (0x4e5e) /* unlk %fp */
> + SHORT (0x4e75) /* rts */
> +
> + _etext = .;
> + *(.lit)
> + } > ram
> +
> + .data :
> + {
> + *(.got.plt) *(.got)
> + *(.shdata)
> + *(.data .data.*)
> + _edata = .;
> + } > ram
> +
> + .bss :
> + {
> + . = ALIGN(0x4);
> + __bss_start = . ;
> + *(.shbss)
> + *(.bss .bss.*)
> + *(COMMON)
> + _end = ALIGN (0x8);
> + __end = _end;
> + } > ram
> +
> + .stab 0 (NOLOAD) :
> + {
> + *(.stab)
> + }
> +
> + .stabstr 0 (NOLOAD) :
> + {
> + *(.stabstr)
> + }
> + }
> + EOF
More information about the Newlib
mailing list