* msp430/Makefile.in (crt0-minrt.o, crtn-minrt.o): New. Build
from crt0.S with -DMINRT. (CRT_OBJS): Expand. (crt_%.o): New rule pattern. Build multiple objects from crt0.S. * msp430/crt0.S: Further break out functionality. Support -DMINRT that omits all init/fini logic. * msp430/crtn.S: Likewise. * msp430/msp430-sim.ld: Wildcard all .crt_* sections, sorted. * msp430/msp430.ld: Likewise. * msp430/msp430xl-sim.ld: Likewise.
This commit is contained in:
parent
25833f57c1
commit
ed94d4a4aa
@ -1,3 +1,16 @@
|
||||
2014-01-29 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* msp430/Makefile.in (crt0-minrt.o, crtn-minrt.o): New. Build
|
||||
from crt0.S with -DMINRT.
|
||||
(CRT_OBJS): Expand.
|
||||
(crt_%.o): New rule pattern. Build multiple objects from crt0.S.
|
||||
* msp430/crt0.S: Further break out functionality. Support -DMINRT
|
||||
that omits all init/fini logic.
|
||||
* msp430/crtn.S: Likewise.
|
||||
* msp430/msp430-sim.ld: Wildcard all .crt_* sections, sorted.
|
||||
* msp430/msp430.ld: Likewise.
|
||||
* msp430/msp430xl-sim.ld: Likewise.
|
||||
|
||||
2014-01-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
|
||||
|
||||
* aarch64/cpu-init/rdimon-aem-el3.S (flat_map): Use bic-immediate
|
||||
|
@ -61,7 +61,7 @@ SCRIPTS += $(srcdir)/msp430xl-sim.ld
|
||||
SCRIPTS += $(srcdir)/msp430F5438A-s.ld
|
||||
SCRIPTS += $(srcdir)/msp430F5438A-l.ld
|
||||
|
||||
CRT = gcrt0.o crt0.o crtn.o
|
||||
CRT = gcrt0.o crt0.o crt0-minrt.o crtn.o crtn-minrt.o
|
||||
SIM_BSP = libsim.a
|
||||
LIBNOSYS = libnosys.a
|
||||
|
||||
@ -79,17 +79,34 @@ SCRIPTS += $(srcdir)/intr_vectors.ld
|
||||
|
||||
LIB_CRT = libcrt.a
|
||||
|
||||
CRT_OBJS = crt_bss.o crt_movedata.o
|
||||
# Each crt_*.o is built from crt0.S using -DL*. crt0.o is built from
|
||||
# crt0.s with -DL0 via the default rule below.
|
||||
CRT_OBJS = \
|
||||
crt_bss.o \
|
||||
crt_movedata.o \
|
||||
crt_main.o \
|
||||
crt_main_minrt.o \
|
||||
crt_callexit.o \
|
||||
crt_init.o
|
||||
|
||||
#### Host specific Makefile fragment comes in here.
|
||||
@host_makefile_frag@
|
||||
|
||||
|
||||
all: $(CRT) $(SIM_BSP) $(LIBNOSYS) $(LIB_CRT) copy_scripts_to_objdir
|
||||
|
||||
crt_%.o : crt0.S
|
||||
$(CC) -DL$* -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< -o $@
|
||||
|
||||
crt0-minrt.o : crt0.S
|
||||
$(CC) -DL0 -DMINRT -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< -o $@
|
||||
|
||||
crtn-minrt.o : crtn.S
|
||||
$(CC) -DL0 -DMINRT -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< -o $@
|
||||
|
||||
# Override .S.o rule to pass assembler debugging flags
|
||||
.S.o:
|
||||
$(CC) -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
|
||||
|
||||
all: $(CRT) $(SIM_BSP) $(LIBNOSYS) $(LIB_CRT) copy_scripts_to_objdir
|
||||
$(CC) -DL0 -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
|
||||
|
||||
$(SIM_BSP): $(SIM_OBJS)
|
||||
$(AR) $(ARFLAGS) $@ $?
|
||||
|
@ -13,18 +13,38 @@
|
||||
|
||||
#include "memmodel.h"
|
||||
|
||||
;; The linker links all .crt_* sections in asciibetical order at the
|
||||
;; same place. So, the four digits in .crt_NNNN determine the link
|
||||
;; order, so, keep them in sequential order here. The first two
|
||||
;; digits are set here, the second two allow users to insert code
|
||||
;; between code fragments here.
|
||||
|
||||
#if L0
|
||||
.section ".resetvec", "a"
|
||||
__msp430_resetvec_hook:
|
||||
.word __start
|
||||
|
||||
.section ".lowtext", "ax", @progbits
|
||||
.section ".crt_0000init", "ax", @progbits
|
||||
.refsym __msp430_resetvec_hook
|
||||
#ifdef MINRT
|
||||
.refsym __crt0_call_just_main
|
||||
#else
|
||||
.refsym __crt0_call_init_then_main
|
||||
#endif
|
||||
.global __start
|
||||
__start:
|
||||
mov_ #__stack, R1
|
||||
|
||||
;; Disable watchdog timer.
|
||||
MOV #0x5a80, &0x15C
|
||||
#endif
|
||||
|
||||
#if Lbss
|
||||
.section ".crt_0100bss", "ax", @progbits
|
||||
|
||||
.global __crt0_init_bss
|
||||
__crt0_init_bss:
|
||||
|
||||
mov_ #__bssstart, R12
|
||||
clr.w R13
|
||||
mov.w #__bsssize, R14
|
||||
@ -32,7 +52,14 @@ __start:
|
||||
clr.w R15 ; We assume that __bsssize is never > 64M
|
||||
#endif
|
||||
call_ #memset
|
||||
#endif
|
||||
|
||||
#if Lmovedata
|
||||
.section ".crt_0200movedata", "ax", @progbits
|
||||
|
||||
.global __crt0_movedata
|
||||
__crt0_movedata:
|
||||
|
||||
mov_ #__datastart, R12
|
||||
mov_ #__romdatastart, R13
|
||||
|
||||
@ -46,17 +73,38 @@ __start:
|
||||
#endif
|
||||
call_ #memmove
|
||||
1:
|
||||
#endif
|
||||
|
||||
#if Lmain_minrt
|
||||
.section ".crt_0300main", "ax", @progbits
|
||||
.global __crt0_call_just_main
|
||||
__crt0_call_just_main:
|
||||
clr.w R12 ; Set argc == 0
|
||||
call_ #main
|
||||
#endif
|
||||
|
||||
#if Lmain
|
||||
.section ".crt_0300main", "ax", @progbits
|
||||
.global __crt0_call_init_then_main
|
||||
__crt0_call_init_then_main:
|
||||
call_ #__msp430_init
|
||||
|
||||
clr.w R12 ; Set argc == 0
|
||||
call_ #main
|
||||
#endif
|
||||
|
||||
#if Lcallexit
|
||||
.section ".crt_0400main_exit", "ax", @progbits
|
||||
.global __crt0_call_exit
|
||||
__crt0_call_exit:
|
||||
call_ #_exit
|
||||
|
||||
.word __msp430_resetvec_hook
|
||||
#endif
|
||||
|
||||
;----------------------------------------
|
||||
|
||||
#ifndef MINRT
|
||||
#if L0
|
||||
.section ".crt_0500main_init", "ax", @progbits
|
||||
.global _msp430_run_init_array
|
||||
.type _msp430_run_init_array,@function
|
||||
_msp430_run_init_array:
|
||||
@ -104,3 +152,6 @@ __msp430_init:
|
||||
.global __msp430_fini
|
||||
__msp430_fini:
|
||||
call_ #_msp430_run_fini_array
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "memmodel.h"
|
||||
|
||||
#ifndef MINRT
|
||||
.section .init,"ax"
|
||||
call_ #_msp430_run_preinit_array
|
||||
call_ #_msp430_run_init_array
|
||||
@ -28,3 +29,4 @@ __msp430_fini_end:
|
||||
|
||||
.text
|
||||
|
||||
#endif
|
||||
|
@ -80,12 +80,8 @@ SECTIONS
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (_start = .);
|
||||
KEEP (*(.crt_init))
|
||||
KEEP (*(.crt_bss))
|
||||
KEEP (*(.crt_movedata))
|
||||
KEEP (*(.crt_main))
|
||||
KEEP (*(.lowtext))
|
||||
*(.text .stub .text.* .gnu.linkonce.t.* .text:*)
|
||||
KEEP (*(SORT(.crt_*)))
|
||||
*(.lowtext .text .stub .text.* .gnu.linkonce.t.* .text:*)
|
||||
KEEP (*(.text.*personality*))
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
|
@ -79,12 +79,8 @@ SECTIONS
|
||||
{
|
||||
. = ALIGN(2);
|
||||
PROVIDE (_start = .);
|
||||
KEEP (*(.crt_init))
|
||||
KEEP (*(.crt_bss))
|
||||
KEEP (*(.crt_movedata))
|
||||
KEEP (*(.crt_main))
|
||||
KEEP (*(.lowtext))
|
||||
*(.text .stub .text.* .gnu.linkonce.t.* .text:*)
|
||||
KEEP (*(SORT(.crt_*)))
|
||||
*(.lowtext .text .stub .text.* .gnu.linkonce.t.* .text:*)
|
||||
KEEP (*(.text.*personality*))
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
|
@ -144,10 +144,7 @@ SECTIONS
|
||||
{
|
||||
PROVIDE (_start = .);
|
||||
. = ALIGN(2);
|
||||
KEEP (*(.crt_init))
|
||||
KEEP (*(.crt_bss))
|
||||
KEEP (*(.crt_movedata))
|
||||
KEEP (*(.crt_main))
|
||||
KEEP (*(SORT(.crt_*)))
|
||||
KEEP (*(.lowtext))
|
||||
} > LOWROM
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user