view BSDmakefile @ 0:c59513fd84fb

Initial commit of STM32 test code.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 03 Oct 2011 21:19:15 +1030
parents
children 7a08db98ae8b
line wrap: on
line source

PROG=		main

SRCS=		main.c \
		comm.c \
		syscalls.c \
		startup_stm32f10x_md_mthomas.c \
		core_cm3.c \
		system_stm32f10x.c \
		stm32f10x_usart.c \
		stm32f10x_flash.c \
		stm32f10x_gpio.c \
		stm32f10x_rcc.c \
		stm32f10x_spi.c \
		stm32f10x_rtc.c \
		stm32f10x_bkp.c \
		stm32f10x_pwr.c \
		stm32f10x_dma.c \
		stm32f10x_tim.c \
		misc.c

# Linker file
LINKFILE=	${.CURDIR}/STM32F10x_512k_64k_flash.ld

# Set CPU type, enable thumb code, thumb interwork debugging & optimisation
COMMONFLAGS=	-mthumb -mthumb-interwork -ggdb -Os -mcpu=cortex-m3
# Put functions & data in individual sections to allow the linker to optimise (breaks debugging apparently)
COMMONFLAGS+=	-ffunction-sections -fdata-sections
# We aren't using exceptions
COMMONFLAGS+=	-fno-exceptions

CFLAGS+=	-I ${.CURDIR}

# Set device type
CFLAGS+=	-DSTM32F10X_MD
# Set clocks
CFLAGS+=	-DHSE_VALUE=8000000UL -DSYSCLK_FREQ_72MHz=72000000 
# Enable STM peripheral drivers
CFLAGS+=	-DUSE_STDPERIPH_DRIVER
# Enable startup delay
CFLAGS+=	-DSTARTUP_DELAY
# Vector table in flash
CFLAGS+=	-DVECT_TAB_FLASH 
# Enable warnings (disable char-subscripts otherwise ctypes.h generates warnings
CFLAGS+=	-Wall -Wextra -pedantic -Wimplicit -Wcast-align -Wpointer-arith -Wredundant-decls -Wshadow -Wcast-qual -Wcast-align -Wnested-externs -Wno-char-subscripts -std=gnu99

LDFLAGS= 	-nostartfiles -Wl,--gc-sections -lc -lm -lgcc

# Location of STM32 library bits
STMLIB=		${.CURDIR}/libs/STM32F10x_StdPeriph_Lib_V3.5.0
PERIPHDIR=	${STMLIB}/Libraries/STM32F10x_StdPeriph_Driver
COREDIR=	${STMLIB}/Libraries/CMSIS/CM3/CoreSupport
SYSDIR=		${STMLIB}/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x

CFLAGS+=	-I ${PERIPHDIR}/inc
CFLAGS+=	-I ${SYSDIR}
CFLAGS+=	-I ${COREDIR}

.PATH:		${PERIPHDIR}/src
.PATH:		${COREDIR}
.PATH:		${SYSDIR}

.include "${.CURDIR}/BSDmakefile.arm"