Mercurial > ~darius > hgwebdir.cgi > stm32temp
annotate BSDmakefile @ 83:05ba84c7da97
Add a flash layer for compatibility (in future).
Fix SPI flash block writing.
White space fixes.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 02 Mar 2015 14:32:08 +1030 |
parents | 1a4573062b37 |
children |
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 \ |
76
f1c9a51e368a
Add EEPROM emulation from AN2594.
Daniel O'Connor <darius@dons.net.au>
parents:
50
diff
changeset
|
7 eeprom.c \ |
49
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
8 fatfs_sd.c \ |
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
9 ff.c \ |
8
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
10 flash.c \ |
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
11 hw.c \ |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
12 lcd.c \ |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
13 main.c \ |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
14 misc.c \ |
49
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
15 sd.c \ |
8
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
16 spi.c \ |
45
6466e8720e04
Add sprinkler control stubs for testing
Daniel O'Connor <darius@dons.net.au>
parents:
37
diff
changeset
|
17 sprink.c \ |
80
1a4573062b37
Reshuffle in preparation for being able to have a common API for SPI flash and (emulated) EEPROM.
Daniel O'Connor <darius@dons.net.au>
parents:
76
diff
changeset
|
18 spiflash.c \ |
49
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
19 stm32_eval_sdio_sd.c \ |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
20 startup_stm32f10x_md_mthomas.c \ |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
21 syscalls.c \ |
8
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
22 system_stm32f10x.c \ |
31
03592ca4d37e
Port tempctrl.c from AVR. I removed the beep code as I don't have a
Daniel O'Connor <darius@dons.net.au>
parents:
29
diff
changeset
|
23 tempctrl.c \ |
8
58d76cf522ff
Split out code into separate files.
Daniel O'Connor <darius@dons.net.au>
parents:
7
diff
changeset
|
24 touch.c |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
25 |
50
d7207a9d3c3b
Add write support. LFN still broken though.
Daniel O'Connor <darius@dons.net.au>
parents:
49
diff
changeset
|
26 #SRCS+= ccsbcs.c |
d7207a9d3c3b
Add write support. LFN still broken though.
Daniel O'Connor <darius@dons.net.au>
parents:
49
diff
changeset
|
27 |
76
f1c9a51e368a
Add EEPROM emulation from AN2594.
Daniel O'Connor <darius@dons.net.au>
parents:
50
diff
changeset
|
28 STM32LIBS= usart gpio rcc rtc pwr bkp fsmc spi tim i2c crc sdio dma flash |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
29 |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
30 .for f in ${STM32LIBS} |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
31 SRCS+= stm32f10x_${f}.c |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
32 CFLAGS+= -DSTM32F10X_${f:U}_EN |
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
33 .endfor |
0
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 # Linker file |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
36 LINKFILE= ${.CURDIR}/STM32F10x_512k_64k_flash.ld |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
37 |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
38 # Set CPU type |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
39 COMMONFLAGS= -mcpu=cortex-m3 |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
40 # 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
|
41 COMMONFLAGS+= -mthumb |
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
42 # Debugging & optimisation |
47
7d4c25c288bb
Use -O2 to make debugging slightly less annoying.
Daniel O'Connor <darius@dons.net.au>
parents:
45
diff
changeset
|
43 COMMONFLAGS+= -g -O2 |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
44 # 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
|
45 COMMONFLAGS+= -ffunction-sections -fdata-sections |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
46 # We aren't using exceptions |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
47 COMMONFLAGS+= -fno-exceptions |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
48 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
49 CFLAGS+= -I ${.CURDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
50 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
51 # Set device type |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
52 CFLAGS+= -DSTM32F10X_HD |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
53 # Set clocks |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
54 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
|
55 # Enable STM peripheral drivers |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
56 CFLAGS+= -DUSE_STDPERIPH_DRIVER |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
57 # Enable startup delay |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
58 #CFLAGS+= -DSTARTUP_DELAY |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
59 # Vector table in flash |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
60 CFLAGS+= -DVECT_TAB_FLASH |
3
74e9b3baac1e
Jumbo commit to make things work.
Daniel O'Connor <darius@dons.net.au>
parents:
1
diff
changeset
|
61 CFLAGS+= -mthumb-interwork |
0
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
62 # 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
|
63 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
|
64 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
65 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
|
66 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
67 # Location of STM32 library bits |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
68 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
|
69 PERIPHDIR= ${STMLIB}/Libraries/STM32F10x_StdPeriph_Driver |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
70 COREDIR= ${STMLIB}/Libraries/CMSIS/CM3/CoreSupport |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
71 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
|
72 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
73 CFLAGS+= -I ${PERIPHDIR}/inc |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
74 CFLAGS+= -I ${SYSDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
75 CFLAGS+= -I ${COREDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
76 |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
77 .PATH: ${PERIPHDIR}/src |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
78 .PATH: ${COREDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
79 .PATH: ${SYSDIR} |
c59513fd84fb
Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff
changeset
|
80 |
49
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
81 # FatFS |
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
82 FATFS= ${.CURDIR}/fatfs |
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
83 CFLAGS+= -I${FATFS} |
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
84 .PATH: ${FATFS} |
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
85 .PATH: ${FATFS}/option |
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
86 |
ace431a0d0f5
Add SDIO code poached from STM. Use FatFS to read from SD card.
Daniel O'Connor <darius@dons.net.au>
parents:
47
diff
changeset
|
87 |
29
077cdff4662a
Updated BMP has a different port name.
Daniel O'Connor <darius@dons.net.au>
parents:
27
diff
changeset
|
88 DBGPORT= /dev/cu.usbmodem7FC58901 |
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
|
89 |
1
7a08db98ae8b
Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents:
0
diff
changeset
|
90 .include "${.CURDIR}/BSDmakefile.arm" |