view 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
line wrap: on
line source

PROG=		main

SRCS=		1wire.c \
		comm.c \
		core_cm3.c \
		delay.c \
		eeprom.c \
		fatfs_sd.c \
		ff.c \
		flash.c \
		hw.c \
		lcd.c \
		main.c \
		misc.c \
		sd.c \
		spi.c \
		sprink.c \
		spiflash.c \
		stm32_eval_sdio_sd.c \
		startup_stm32f10x_md_mthomas.c \
		syscalls.c \
		system_stm32f10x.c \
		tempctrl.c \
		touch.c

#SRCS+=		ccsbcs.c

STM32LIBS=	usart gpio rcc rtc pwr bkp fsmc spi tim i2c crc sdio dma flash

.for f in ${STM32LIBS}
SRCS+=		stm32f10x_${f}.c
CFLAGS+=	-DSTM32F10X_${f:U}_EN
.endfor

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

# Set CPU type
COMMONFLAGS=	-mcpu=cortex-m3
# Enable thumb code (since the Cortex M3 only does thumb)
COMMONFLAGS+=	-mthumb
# Debugging & optimisation
COMMONFLAGS+= -g -O2
# 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_HD
# 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 
CFLAGS+=	-mthumb-interwork
# 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}

# FatFS
FATFS=		${.CURDIR}/fatfs
CFLAGS+=	-I${FATFS}
.PATH:		${FATFS}
.PATH:		${FATFS}/option


DBGPORT=	/dev/cu.usbmodem7FC58901

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