From 0187cfbf93067f6ab7a2797bece956808d6a3582 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Tue, 2 Mar 2010 10:38:32 -0500 Subject: [PATCH] Now you can build targets with or without the reserved ROM var space. --- Makefile.include | 14 ++++++++++++-- mc1322x.lds | 2 +- src/start.S | 5 +++++ tests/Makefile | 5 ++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Makefile.include b/Makefile.include index 1dbb873e6..92b565b06 100644 --- a/Makefile.include +++ b/Makefile.include @@ -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 diff --git a/mc1322x.lds b/mc1322x.lds index 88098a064..2b233bf64 100644 --- a/mc1322x.lds +++ b/mc1322x.lds @@ -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. */ diff --git a/src/start.S b/src/start.S index e9ebd561d..2474a4ead 100644 --- a/src/start.S +++ b/src/start.S @@ -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 diff --git a/tests/Makefile b/tests/Makefile index b1b9fc3a5..95f2a3afc 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -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