Mercurial > ~darius > hgwebdir.cgi > stm32temp
annotate BSDmakefile.arm @ 70:aaf0603d7f88
Add routine to CRC a block of flash. Use it to verify a flash block write.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Sun, 14 Apr 2013 22:53:50 +0930 |
parents | 7e5916574d5e |
children | 3f1c101f89bc |
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 | 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 | 7 #TCHAIN= ${HOME}/arm/arm-none-eabi-gcc-4_6/bin/arm-none-eabi |
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 | 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 | 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 | 49 depend: .depend |
50 | |
51 .depend: ${SRCS} | |
52 CC='${CC}' ${MKDEPCMD} ${CFLAGS} ${.ALLSRC} | |
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: *** |