Mercurial > ~darius > hgwebdir.cgi > stm32temp
annotate BSDmakefile @ 16:db6011aa94d6
Use new delay routine on pin 2 so it doesn't interfere with 1 wire.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Wed, 14 Nov 2012 12:30:05 +1030 |
parents | 96c345d304af |
children | afdd22502c2a |
rev | line source |
---|---|
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
1 PROG= main |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
2 |
13 | 3 SRCS= 1wire.c \ |
4 comm.c \ | |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
5 core_cm3.c \ |
8
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
6 delay.c \ |
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
7 flash.c \ |
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
8 hw.c \ |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
9 lcd.c \ |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
10 main.c \ |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
11 misc.c \ |
8
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
12 spi.c \ |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
13 startup_stm32f10x_md_mthomas.c \ |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
14 syscalls.c \ |
8
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
15 system_stm32f10x.c \ |
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
16 touch.c |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
17 |
4
2c87e30c982d
Add LCD init, touch screen writing etc..
Daniel O'Connor <darius@dons.net.au>
parents:
3
diff
changeset
|
18 STM32LIBS= usart gpio rcc rtc pwr bkp fsmc spi tim |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
19 |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
20 .for f in ${STM32LIBS} |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
21 SRCS+= stm32f10x_${f}.c |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
22 CFLAGS+= -DSTM32F10X_${f:U}_EN |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
23 .endfor |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
24 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
25 # Linker file |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
26 LINKFILE= ${.CURDIR}/STM32F10x_512k_64k_flash.ld |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
27 |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
28 # Set CPU type |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
29 COMMONFLAGS= -mcpu=cortex-m3 |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
30 # Enable thumb code (since the Cortex M3 only does thumb) |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
31 COMMONFLAGS+= -mthumb |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
32 # Debugging & optimisation |
7
9404b9869c27
Make the LCD panel work (timings, GPIOE clock needs to be on, etc)
Daniel O'Connor <darius@dons.net.au>
parents:
4
diff
changeset
|
33 COMMONFLAGS+= -g -O0 |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
34 # Put functions & data in individual sections to allow the linker to optimise (breaks debugging apparently) |
7
9404b9869c27
Make the LCD panel work (timings, GPIOE clock needs to be on, etc)
Daniel O'Connor <darius@dons.net.au>
parents:
4
diff
changeset
|
35 COMMONFLAGS+= -ffunction-sections -fdata-sections |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
36 # We aren't using exceptions |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
37 COMMONFLAGS+= -fno-exceptions |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
38 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
39 CFLAGS+= -I ${.CURDIR} |
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 # Set device type |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
42 CFLAGS+= -DSTM32F10X_HD |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
43 # Set clocks |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
44 CFLAGS+= -DHSE_VALUE=8000000UL -DSYSCLK_FREQ_72MHz=72000000 |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
45 # Enable STM peripheral drivers |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
46 CFLAGS+= -DUSE_STDPERIPH_DRIVER |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
47 # Enable startup delay |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
48 #CFLAGS+= -DSTARTUP_DELAY |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
49 # Vector table in flash |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
50 CFLAGS+= -DVECT_TAB_FLASH |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
51 CFLAGS+= -mthumb-interwork |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
52 # Enable warnings (disable char-subscripts otherwise ctypes.h generates warnings |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
53 CFLAGS+= -Wall -Wextra -pedantic -Wimplicit -Wcast-align -Wpointer-arith -Wredundant-decls -Wshadow -Wcast-qual -Wcast-align -Wnested-externs -Wno-char-subscripts -std=gnu99 |
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 LDFLAGS= -nostartfiles -Wl,--gc-sections -lc -lm -lgcc |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
56 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
57 # Location of STM32 library bits |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
58 STMLIB= ${.CURDIR}/libs/STM32F10x_StdPeriph_Lib_V3.5.0 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
59 PERIPHDIR= ${STMLIB}/Libraries/STM32F10x_StdPeriph_Driver |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
60 COREDIR= ${STMLIB}/Libraries/CMSIS/CM3/CoreSupport |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
61 SYSDIR= ${STMLIB}/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
62 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
63 CFLAGS+= -I ${PERIPHDIR}/inc |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
64 CFLAGS+= -I ${SYSDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
65 CFLAGS+= -I ${COREDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
66 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
67 .PATH: ${PERIPHDIR}/src |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
68 .PATH: ${COREDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
69 .PATH: ${SYSDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
70 |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
71 debug: |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
72 ${GDB} --eval-command="target remote 127.0.0.1:61234" ${PROG}.elf |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
73 |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
74 load: |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
75 ${GDB} --eval-command="target remote 127.0.0.1:61234" --eval-command "load" ${PROG}.elf |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
76 |
7
9404b9869c27
Make the LCD panel work (timings, GPIOE clock needs to be on, etc)
Daniel O'Connor <darius@dons.net.au>
parents:
4
diff
changeset
|
77 png2bin: png2bin.c |
9404b9869c27
Make the LCD panel work (timings, GPIOE clock needs to be on, etc)
Daniel O'Connor <darius@dons.net.au>
parents:
4
diff
changeset
|
78 gcc ${.CURDIR}/png2bin.c -o ${.OBJDIR}/png2bin -O2 -Wall -I/opt/local/include -L/opt/local/lib -lpng |
9404b9869c27
Make the LCD panel work (timings, GPIOE clock needs to be on, etc)
Daniel O'Connor <darius@dons.net.au>
parents:
4
diff
changeset
|
79 |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
80 .include "${.CURDIR}/BSDmakefile.arm" |