Now you can build targets with or without the reserved ROM var space.

This commit is contained in:
Mariano Alvira 2010-03-02 10:38:32 -05:00
parent d5b20ddce5
commit 0187cfbf93
4 changed files with 22 additions and 4 deletions

View file

@ -11,9 +11,12 @@ include $(MC1322X)/board/Makefile.board
include $(LIBMC1322X)/Makefile.lib
CFLAGS += -I$(MC1322X)/src -I.
ifdef USE_ROM_VARS
START = $(MC1322X)/src/start-romvars.o
endif
# default start and isr
ifndef START
START = $(MC1322X)/src/start.o
@ -43,9 +46,10 @@ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
rm -f $(@:.o=.$$$$)
endef
$(START): $(START:.o=.s)
$(CC) $(AFLAGS) -c -o $@ $<
$(MC1322X)/src/start-romvars.s: $(MC1322X)/src/start.S
$(CPP) $(AFLAGS) -DUSE_ROM_VARS -o $@ $<
$(ISR): $(ISR:.o=.c)
$(CC) $(CFLAGS) $(ARM_FLAGS) -MMD $< -c -o $@
@ -67,6 +71,11 @@ $(ISR): $(ISR:.o=.c)
%.dis: %.elf
$(OBJDUMP) -SD $< > $@
%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<
%.o: %.S
$(CC) $(AFLAGS) -MMD -c -o $@ $<
@$(FINALIZE_DEPENDENCY)
%.o: %.c
$(CC) $(CFLAGS) $(THUMB_FLAGS) -MMD -c -o $@ $<
@$(FINALIZE_DEPENDENCY)
@ -108,6 +117,7 @@ endif
all: $(OBJDIR)/board.h
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
allboards:
for board in $(BOARDS); do make BOARD=$$board all; done

View file

@ -18,7 +18,7 @@ HEAP_SIZE = 1024;
PROVIDE (__executable_start = 0x00400000); . = 0x00400000;
.text :
{
*start.o (.text)
*start*.o (.text)
*(.irq)
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */

View file

@ -86,10 +86,13 @@ _RPTV_2_START:
_RPTV_3_START:
bx lr /* do nothing */
#ifdef USE_ROM_VARS
.org 0x120
ROM_var_start: .word 0
.org 0x7ff
ROM_var_end: .word 0
#endif
.code 32
.align
_begin:
@ -117,7 +120,9 @@ _begin:
// msr cpsr_c,#(USR_MODE | I_BIT | F_BIT)
#ifdef USE_ROM_VARS
bl _rom_data_init+.-base
#endif
msr cpsr_c,#(SVC_MODE) // turn on interrupts --- for debug only
// msr cpsr_c,#(USR_MODE) // turn on interrupts --- for debug only
// add r1,r1,#usr_stack_size

View file

@ -6,7 +6,7 @@ MC1322X := ..
COBJS := tests.o
# all of the target programs to build
TARGETS := blink-red blink-green blink-blue blink-white blink-allio \
TARGETS := blink-green blink-blue blink-white blink-allio \
uart1-loopback \
nvm-read nvm-write romimg flasher \
tmr tmr-ints \
@ -14,6 +14,9 @@ TARGETS := blink-red blink-green blink-blue blink-white blink-allio \
rftest-rx rftest-tx \
printf
# 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
TARGETS_WITH_ROM_VARS := blink-red
include $(MC1322X)/Makefile.include