annotate BSDmakefile.arm @ 82:c0ff52b8e80c

Point to new toolchain
author Daniel O'Connor <darius@dons.net.au>
date Mon, 02 Mar 2015 14:31:16 +1030
parents 3f1c101f89bc
children
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
82
c0ff52b8e80c Point to new toolchain
Daniel O'Connor <darius@dons.net.au>
parents: 74
diff changeset
8 #TCHAIN= /usr/local/Cellar/gcc-arm-none-eabi/20120614/bin/arm-none-eabi
c0ff52b8e80c Point to new toolchain
Daniel O'Connor <darius@dons.net.au>
parents: 74
diff changeset
9 TCHAIN= /usr/local/gcc-arm-none-eabi-4_8-2014q2/bin/arm-none-eabi
1
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
74
3f1c101f89bc Tell make the resulting binary dependent is dependent on the linker script.
Daniel O'Connor <darius@dons.net.au>
parents: 63
diff changeset
34 ${PROG}.elf: ${OBJS} ${LINKFILE}
0
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:
63
7e5916574d5e Scan before attaching in case the BMP has been power cycled.
Daniel O'Connor <darius@dons.net.au>
parents: 28
diff changeset
44 ${GDB} -ex "target extended-remote ${DBGPORT}" -ex "mon jtag_scan" -ex "attach 1" ${PROG}.elf
20
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:
63
7e5916574d5e Scan before attaching in case the BMP has been power cycled.
Daniel O'Connor <darius@dons.net.au>
parents: 28
diff changeset
47 ${GDB} -ex "target extended-remote ${DBGPORT}" -ex "mon jtag_scan" -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: ***