mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
link objects in as archives so only what we need gets linked.
Add an option to build objects without space resevered for rom calls.
This commit is contained in:
parent
4a61c10879
commit
8bd9f182d4
@ -13,7 +13,7 @@ include $(LIBMC1322X)/Makefile.lib
|
|||||||
|
|
||||||
CFLAGS += -I$(MC1322X)/src -I.
|
CFLAGS += -I$(MC1322X)/src -I.
|
||||||
|
|
||||||
ifdef USE_ROM_VARS
|
ifdef TARGET_ROM_VARS
|
||||||
START = $(MC1322X)/src/start-romvars.o
|
START = $(MC1322X)/src/start-romvars.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ endif
|
|||||||
ifndef ISR
|
ifndef ISR
|
||||||
ISR = $(MC1322X)/src/isr.o
|
ISR = $(MC1322X)/src/isr.o
|
||||||
endif
|
endif
|
||||||
SRCOBJS += $(MC1322X)/src/default_lowlevel.o
|
SRCOBJS += $(MC1322X)/src/default_lowlevel.o $(ISR) $(START)
|
||||||
BOARDOBJS := $(addprefix $(OBJDIR)/,$(COBJS))
|
BOARDOBJS := $(addprefix $(OBJDIR)/,$(COBJS))
|
||||||
|
|
||||||
ARCH = arm
|
ARCH = arm
|
||||||
@ -49,15 +49,20 @@ endef
|
|||||||
$(START): $(START:.o=.s)
|
$(START): $(START:.o=.s)
|
||||||
$(CC) $(AFLAGS) -c -o $@ $<
|
$(CC) $(AFLAGS) -c -o $@ $<
|
||||||
$(MC1322X)/src/start-romvars.s: $(MC1322X)/src/start.S
|
$(MC1322X)/src/start-romvars.s: $(MC1322X)/src/start.S
|
||||||
$(CPP) $(AFLAGS) -DUSE_ROM_VARS -o $@ $<
|
$(CPP) $(AFLAGS) -DUSE_INTS -DUSE_ROM_VECTS -DUSE_ROM_VARS -o $@ $<
|
||||||
|
$(MC1322X)/src/start-romvects.s: $(MC1322X)/src/start.S
|
||||||
|
$(CPP) $(AFLAGS) -DUSE_INTS -DUSE_ROM_VECTS -o $@ $<
|
||||||
|
|
||||||
$(ISR): $(ISR:.o=.c)
|
$(ISR): $(ISR:.o=.c)
|
||||||
$(CC) $(CFLAGS) $(ARM_FLAGS) -MMD $< -c -o $@
|
$(CC) $(CFLAGS) $(ARM_FLAGS) -MMD $< -c -o $@
|
||||||
@$(FINALIZE_DEPENDENCY)
|
@$(FINALIZE_DEPENDENCY)
|
||||||
|
|
||||||
%_$(BOARD).elf: $(START) $(ISR) $(SRCOBJS) $(OBJDIR)/%.o $(BOARDOBJS) $(LINKERSCRIPT) $(LIBMC1322X)/libmc1322x.a
|
$(OBJDIR)/board.a: $(OBJDIR)/board.a($(OBJDIR)/$(COBJS))
|
||||||
$(CC) $(LDFLAGS) $(AOBJS) \
|
$(MC1322X)/src/src.a: $(MC1322X)/src/src.a($(SRCOBJS))
|
||||||
$(filter %.o %.a,$+) -o $@
|
|
||||||
|
%_$(BOARD).elf: $(OBJDIR)/%.o $(START) $(ISR) $(SRCOBJS) $(LINKERSCRIPT) $(LIBMC1322X)/libmc1322x.a $(OBJDIR)/board.a $(MC1322X)/src/src.a
|
||||||
|
$(CC) $(LDFLAGS) \
|
||||||
|
-L $(LIBMC1322X) -L $(MC1322X)/src -L $(OBJDIR) $< -o $@ $(START) $(MC1322X)/src/src.a $(LIBMC1322X)/libmc1322x.a $(OBJDIR)/board.a
|
||||||
|
|
||||||
%.srec: %.elf
|
%.srec: %.elf
|
||||||
$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
|
$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
|
||||||
@ -117,7 +122,7 @@ endif
|
|||||||
|
|
||||||
all: $(OBJDIR)/board.h
|
all: $(OBJDIR)/board.h
|
||||||
for target in $(TARGETS); do make $$target\_$(BOARD).bin; done
|
for target in $(TARGETS); do make $$target\_$(BOARD).bin; done
|
||||||
for target in $(TARGETS_WITH_ROM_VARS); do make USE_ROM_VARS=1 $$target\_$(BOARD).bin; done
|
for target in $(TARGETS_WITH_ROM_VARS); do make TARGET_ROM_VARS=1 $$target\_$(BOARD).bin; done
|
||||||
|
|
||||||
allboards:
|
allboards:
|
||||||
for board in $(BOARDS); do make BOARD=$$board all; done
|
for board in $(BOARDS); do make BOARD=$$board all; done
|
||||||
|
33
src/start.S
33
src/start.S
@ -57,7 +57,6 @@
|
|||||||
.set base, .
|
.set base, .
|
||||||
.set _rom_data_init, 0x108d0
|
.set _rom_data_init, 0x108d0
|
||||||
|
|
||||||
|
|
||||||
.globl _start
|
.globl _start
|
||||||
_start: b _begin
|
_start: b _begin
|
||||||
ldr pc, _undefined_instruction
|
ldr pc, _undefined_instruction
|
||||||
@ -67,7 +66,8 @@ _start: b _begin
|
|||||||
ldr pc, _not_used
|
ldr pc, _not_used
|
||||||
ldr pc, _irq
|
ldr pc, _irq
|
||||||
ldr pc, _fiq
|
ldr pc, _fiq
|
||||||
|
|
||||||
|
#ifdef USE_ROM_VARS
|
||||||
/* these vectors are used for rom patching */
|
/* these vectors are used for rom patching */
|
||||||
.org 0x20
|
.org 0x20
|
||||||
.code 16
|
.code 16
|
||||||
@ -85,13 +85,13 @@ _RPTV_2_START:
|
|||||||
.org 0xe0
|
.org 0xe0
|
||||||
_RPTV_3_START:
|
_RPTV_3_START:
|
||||||
bx lr /* do nothing */
|
bx lr /* do nothing */
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_ROM_VARS
|
|
||||||
.org 0x120
|
.org 0x120
|
||||||
ROM_var_start: .word 0
|
ROM_var_start: .word 0
|
||||||
.org 0x7ff
|
.org 0x7ff
|
||||||
ROM_var_end: .word 0
|
ROM_var_end: .word 0
|
||||||
#endif
|
#endif /*USE_ROM_VARS*/
|
||||||
|
|
||||||
.code 32
|
.code 32
|
||||||
.align
|
.align
|
||||||
@ -129,6 +129,7 @@ _begin:
|
|||||||
// mov sp,r1
|
// mov sp,r1
|
||||||
|
|
||||||
b main
|
b main
|
||||||
|
|
||||||
|
|
||||||
_undefined_instruction: .word undefined_instruction
|
_undefined_instruction: .word undefined_instruction
|
||||||
_software_interrupt: .word software_interrupt
|
_software_interrupt: .word software_interrupt
|
||||||
@ -177,29 +178,6 @@ _bss_end:
|
|||||||
_start_armboot: .word main
|
_start_armboot: .word main
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*************************************************************************
|
|
||||||
*
|
|
||||||
* CPU_init_critical registers
|
|
||||||
*
|
|
||||||
*************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
cpu_init_crit:
|
|
||||||
# actually do nothing for now!
|
|
||||||
mov pc, lr
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*************************************************************************
|
|
||||||
*
|
|
||||||
* Interrupt handling
|
|
||||||
*
|
|
||||||
*************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* exception handlers
|
* exception handlers
|
||||||
*/
|
*/
|
||||||
@ -233,4 +211,3 @@ fiq:
|
|||||||
.globl reset_cpu
|
.globl reset_cpu
|
||||||
reset_cpu:
|
reset_cpu:
|
||||||
mov pc, r0
|
mov pc, r0
|
||||||
|
|
||||||
|
@ -8,15 +8,13 @@ COBJS := tests.o
|
|||||||
# all of the target programs to build
|
# all of the target programs to build
|
||||||
TARGETS := blink-red blink-green blink-blue blink-white blink-allio \
|
TARGETS := blink-red blink-green blink-blue blink-white blink-allio \
|
||||||
uart1-loopback \
|
uart1-loopback \
|
||||||
nvm-read nvm-write romimg flasher \
|
|
||||||
tmr tmr-ints \
|
tmr tmr-ints \
|
||||||
sleep \
|
sleep \
|
||||||
rftest-rx rftest-tx \
|
printf
|
||||||
printf
|
|
||||||
|
|
||||||
# these targets are built with space reserved for variables needed by ROM services
|
# these targets are built with space reserved for variables needed by ROM services
|
||||||
# this space is initialized with a rom call to rom_data_init
|
# this space is initialized with a rom call to rom_data_init
|
||||||
TARGETS_WITH_ROM_VARS :=
|
TARGETS_WITH_ROM_VARS := nvm-read nvm-write romimg flasher rftest-rx rftest-tx
|
||||||
|
|
||||||
include $(MC1322X)/Makefile.include
|
include $(MC1322X)/Makefile.include
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user