annotate BSDmakefile @ 2:274e01fa5a4c

- Do console IO with RX IRQs. - Init tick counter (unused anyway). - Handle C-u and C-w. - Rejig NVIC setup for less duplication.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 08 Oct 2011 20:35:34 +1030
parents 7a08db98ae8b
children 74e9b3baac1e
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 PROG= main
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 SRCS= main.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
4 comm.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
5 syscalls.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
6 startup_stm32f10x_md_mthomas.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
7 core_cm3.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
8 system_stm32f10x.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
9 stm32f10x_usart.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
10 stm32f10x_flash.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
11 stm32f10x_gpio.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
12 stm32f10x_rcc.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
13 stm32f10x_spi.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
14 stm32f10x_rtc.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
15 stm32f10x_bkp.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
16 stm32f10x_pwr.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
17 stm32f10x_dma.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
18 stm32f10x_tim.c \
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
19 misc.c
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 # Linker file
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
22 LINKFILE= ${.CURDIR}/STM32F10x_512k_64k_flash.ld
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
23
1
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
24 # Set CPU type
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
25 COMMONFLAGS= -mcpu=cortex-m3
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
26 # 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
27 COMMONFLAGS+= -mthumb
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
28 # Debugging & optimisation
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
29 COMMONFLAGS+= -g -Os
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
30 # Put functions & data in individual sections to allow the linker to optimise (breaks debugging apparently)
1
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
31 #COMMONFLAGS+= -ffunction-sections -fdata-sections
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
32 # We aren't using exceptions
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
33 COMMONFLAGS+= -fno-exceptions
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 CFLAGS+= -I ${.CURDIR}
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 # Set device type
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
38 CFLAGS+= -DSTM32F10X_MD
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
39 # Set clocks
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
40 CFLAGS+= -DHSE_VALUE=8000000UL -DSYSCLK_FREQ_72MHz=72000000
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
41 # Enable STM peripheral drivers
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
42 CFLAGS+= -DUSE_STDPERIPH_DRIVER
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
43 # Enable startup delay
1
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
44 #CFLAGS+= -DSTARTUP_DELAY
0
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
45 # Vector table in flash
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
46 CFLAGS+= -DVECT_TAB_FLASH
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
47 # 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
48 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
49
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
50 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
51
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
52 # Location of STM32 library bits
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
53 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
54 PERIPHDIR= ${STMLIB}/Libraries/STM32F10x_StdPeriph_Driver
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
55 COREDIR= ${STMLIB}/Libraries/CMSIS/CM3/CoreSupport
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
56 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
57
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
58 CFLAGS+= -I ${PERIPHDIR}/inc
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
59 CFLAGS+= -I ${SYSDIR}
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
60 CFLAGS+= -I ${COREDIR}
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
61
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
62 .PATH: ${PERIPHDIR}/src
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
63 .PATH: ${COREDIR}
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
64 .PATH: ${SYSDIR}
c59513fd84fb Initial commit of STM32 test code.
Daniel O'Connor <darius@dons.net.au>
parents:
diff changeset
65
1
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
66 debug:
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
67 ${GDB} --eval-command="target remote 10.211.55.3:61234" --eval-command "load" ${PROG}.elf
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
68
7a08db98ae8b Split out compile flags for easier editing.
Daniel O'Connor <darius@dons.net.au>
parents: 0
diff changeset
69 .include "${.CURDIR}/BSDmakefile.arm"