Mercurial > ~darius > hgwebdir.cgi > stm32temp
annotate BSDmakefile.arm @ 1:7a08db98ae8b
Split out compile flags for easier editing.
Allow toolchain suffixes (needed for when arm-elf works).
Add debug target.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Sat, 08 Oct 2011 20:33:47 +1030 |
parents | c59513fd84fb |
children | 74e9b3baac1e |
rev | line source |
---|---|
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
1 # Cribbed from http://stm32.spacevs.com/index.php?option=com_content&view=category&id=9&Itemid=103 (and others) |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
2 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
3 .SUFFIXES: .bin .elf .hex .map .lst .dmp |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
4 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
5 .MAIN: ${PROG}.bin |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
6 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
7 TCHAIN= arm-none-eabi |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
8 #TCHAIN= arm-elf |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
9 #TCHAINSF= -4.6 |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
10 |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
11 CC= ${TCHAIN}-gcc${TCHAINSF} |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
12 AS= ${TCHAIN}-gcc${TCHAINSF} |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
13 CXX= ${TCHAIN}-g++${TCHAINSF} |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
14 AR= ${TCHAIN}-ar${TCHAINSF} |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
15 OBJCOPY= ${TCHAIN}-objcopy${TCHAINSF} |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
16 GDB= ${TCHAIN}-gdb |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
17 RM= rm -f |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
18 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
19 CFLAGS+= ${COMMONFLAGS} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
20 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
21 LDFLAGS+= ${COMMONFLAGS} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
22 LDFLAGS+= -L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-T${LINKFILE} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
23 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
24 OBJS+= ${SRCS:N*.h:R:S/$/.o/g} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
25 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
26 .c.o: |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
27 ${CC} ${CFLAGS} ${CPPFLAGS} -Wa,-adhlns=${.PREFIX}.lst -c ${.IMPSRC} -o ${.PREFIX}.o |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
28 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
29 .s.o: |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
30 ${AS} ${CFLAGS} ${ASFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
31 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
32 ${PROG}.elf: ${OBJS} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
33 ${CC} ${LDFLAGS} ${OBJS} -Wl,-Map=${PROG}.map,--cref -o ${PROG}.elf ${LDADD} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
34 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
35 .elf.bin: |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
36 ${OBJCOPY} -O binary ${.ALLSRC} ${.TARGET} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
37 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
38 clean: |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
39 ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.bin ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
40 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
41 prog: |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
42 /Users/darius/projects/stm32loader/stm32loader.py -p /dev/tty.usbserial -b 115200 -e -w -v ${PROG}.bin |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
43 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
44 ######################### |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
45 #;;; Local Variables: *** |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
46 #;;; mode:makefile *** |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
47 #;;; End: *** |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
48 |