annotate BSDmakefile.arm @ 28:7f8e5780024b

- Add depend target. - Switch to Homebrew toolchain
author Daniel O'Connor <darius@dons.net.au>
date Tue, 27 Nov 2012 13:16:47 +1030
parents 35cf31794a42
children 7e5916574d5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
28
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
5 .MAIN: depend ${PROG}.bin
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
6
28
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
7 #TCHAIN= ${HOME}/arm/arm-none-eabi-gcc-4_6/bin/arm-none-eabi
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
8 TCHAIN= /usr/local/Cellar/gcc-arm-none-eabi/20120614/bin/arm-none-eabi
1
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
9 #TCHAIN= arm-elf
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
10 #TCHAINSF= -4.6
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
11
1
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
12 CC= ${TCHAIN}-gcc${TCHAINSF}
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
13 AS= ${TCHAIN}-gcc${TCHAINSF}
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
14 CXX= ${TCHAIN}-g++${TCHAINSF}
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
15 AR= ${TCHAIN}-ar${TCHAINSF}
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
16 OBJCOPY= ${TCHAIN}-objcopy${TCHAINSF}
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
17 GDB= ${TCHAIN}-gdb
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
18 RM= rm -f
28
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
19 MKDEPCMD= mkdep
0
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 CFLAGS+= ${COMMONFLAGS}
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
22
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
23 LDFLAGS+= ${COMMONFLAGS}
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
24 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
25
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
26 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
27
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
28 .c.o:
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
29 ${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
30
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
31 .s.o:
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
32 ${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
33
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
34 ${PROG}.elf: ${OBJS}
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
35 ${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
36
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
37 .elf.bin:
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
38 ${OBJCOPY} -O binary ${.ALLSRC} ${.TARGET}
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
39
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
40 clean:
28
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
41 ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.bin ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp .depend
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
42
20
35cf31794a42 Fix debug & load targets for BMP.
Daniel O'Connor <darius@dons.net.au>
parents: 17
diff changeset
43 debug:
35cf31794a42 Fix debug & load targets for BMP.
Daniel O'Connor <darius@dons.net.au>
parents: 17
diff changeset
44 ${GDB} -ex "target extended-remote ${DBGPORT}" -ex "attach 1" ${PROG}.elf
35cf31794a42 Fix debug & load targets for BMP.
Daniel O'Connor <darius@dons.net.au>
parents: 17
diff changeset
45
35cf31794a42 Fix debug & load targets for BMP.
Daniel O'Connor <darius@dons.net.au>
parents: 17
diff changeset
46 load:
35cf31794a42 Fix debug & load targets for BMP.
Daniel O'Connor <darius@dons.net.au>
parents: 17
diff changeset
47 ${GDB} -ex "target extended-remote ${DBGPORT}" -ex "attach 1" -ex "load" -ex "detach" -ex "quit" ${PROG}.elf
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
48
28
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
49 depend: .depend
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
50
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
51 .depend: ${SRCS}
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
52 CC='${CC}' ${MKDEPCMD} ${CFLAGS} ${.ALLSRC}
7f8e5780024b - Add depend target.
Daniel O'Connor <darius@dons.net.au>
parents: 20
diff changeset
53
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
54 #########################
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
55 #;;; Local Variables: ***
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
56 #;;; mode:makefile ***
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
57 #;;; End: ***