Permalink
Browse files

Saner common makefile.

  • Loading branch information...
balau committed Sep 4, 2011
1 parent 8e2cb62 commit fb7dcbab183d8c4ee48f3a43ac472dc68592179d
Showing with 37 additions and 42 deletions.
  1. +26 −0 common/common.mk
  2. +3 −17 cortex-m3-bkpt/Makefile
  3. +2 −20 cortex-m3-cs3/Makefile
  4. +6 −5 simplest-bare-metal/Makefile
View
@@ -0,0 +1,26 @@
+
+AS = $(CROSS_COMPILE)as
+CC = $(CROSS_COMPILE)gcc
+LD = $(CROSS_COMPILE)ld
+OBJCOPY = $(CROSS_COMPILE)objcopy
+OBJDUMP = $(CROSS_COMPILE)objdump
+GDB = $(CROSS_COMPILE)gdb
+
+%.bin: %
+ $(OBJCOPY) -O binary $< $@
+
+%.hex: %
+ $(OBJCOPY) -O ihex $< $@
+
+%.srec: %
+ $(OBJCOPY) -O srec $< $@
+
+%.hd: %.bin
+ hexdump $< > $@
+
+%.dis: %
+ $(OBJDUMP) -dS $< > $@
+
+%.sym: %
+ $(OBJDUMP) -t $< >$@
+
View
@@ -1,10 +1,7 @@
CROSS_COMPILE=arm-none-eabi-
#CROSS_COMPILE=arm-linux-gnueabi-
-CC = $(CROSS_COMPILE)gcc
-OC = $(CROSS_COMPILE)objcopy
-OD = $(CROSS_COMPILE)objdump
-AS = $(CROSS_COMPILE)as
-LD = $(CROSS_COMPILE)ld
+
+include ../common/common.mk
CFLAGS += -mthumb -march=armv7 -g
ASFLAGS += -mthumb -march=armv7 -g
@@ -27,16 +24,5 @@ gdb.init:
echo "file test_bkpt" > $@
echo "target remote localhost:1234" >> $@
-test_bkpt.bin: test_bkpt
-test_bkpt.dis: test_bkpt
-test_bkpt.sym: test_bkpt
-
-%.bin: %
- $(OC) -O binary $< $@
-
-%.dis: %
- $(OD) -dS $< >$@
-
-%.sym: %
- $(OD) -t $< >$@
+test_bkpt: test_bkpt.S
View
@@ -1,9 +1,6 @@
CROSS_COMPILE=arm-none-eabi-
-CC = $(CROSS_COMPILE)gcc
-OC = $(CROSS_COMPILE)objcopy
-OD = $(CROSS_COMPILE)objdump
-AS = $(CROSS_COMPILE)as
-LD = $(CROSS_COMPILE)ld
+
+include ../common/common.mk
CFLAGS += -mthumb -march=armv7 -mfix-cortex-m3-ldrd -g
ASFLAGS += -mthumb -march=armv7 -mfix-cortex-m3-ldrd -g
@@ -36,18 +33,3 @@ clean:
main: reset.S syscalls.c
-%.bin: %
- $(OC) -O binary $< $@
-
-%.dis: %
- $(OD) -dS $< >$@
-
-%.sym: %
- $(OD) -t $< >$@
-
-%.srec: %
- $(OC) -O srec $< $@
-
-%.hd: %.bin
- hexdump -C $< > $@
-
@@ -1,17 +1,19 @@
+CROSS_COMPILE=arm-none-eabi-
+include ../common/common.mk
ASFLAGS = -mcpu=arm926ej-s -g
CFLAGS = -mcpu=arm926ej-s -g
-LDFLAGS = -T $*.ld
+LDFLAGS = -T $*.ld -nostartfiles -nostdlib
APP = test
DEBUG_APP = test
-APP_TARGETS = $(addsuffix .hd,$(APP)) $(addsuffix .code, $(APP)) $(addsuffix .elf, $(APP))
+APP_TARGETS = $(APP) $(addsuffix .hd,$(APP)) $(addsuffix .dis, $(APP))
.PHONY: all
all: $(APP_TARGETS)
-test.elf: startup.o
+test: startup.o
.PHONY: clean
clean:
@@ -20,8 +22,7 @@ clean:
rm -rf $(addsuffix .map, $(APP))
rm -rf $(APP_TARGETS)
-debug: $(DEBUG_APP).elf
+debug: $(DEBUG_APP)
ddd --debugger $(GDB) --command $(DEBUG_APP).gdb $<
-include ../common/arm.mk

0 comments on commit fb7dcba

Please sign in to comment.