diff BSDmakefile @ 3:74e9b3baac1e

Jumbo commit to make things work. Note I have t
author Daniel O'Connor <darius@dons.net.au>
date Sun, 01 Jan 2012 11:01:13 +1030
parents 7a08db98ae8b
children 2c87e30c982d
line wrap: on
line diff
--- a/BSDmakefile	Sat Oct 08 20:35:34 2011 +1030
+++ b/BSDmakefile	Sun Jan 01 11:01:13 2012 +1030
@@ -1,22 +1,20 @@
 PROG=		main
 
-SRCS=		main.c \
-		comm.c \
+SRCS=		comm.c \
+		core_cm3.c \
+		lcd.c \
+		main.c \
+		misc.c \
+		startup_stm32f10x_md_mthomas.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
+
+STM32LIBS=	usart gpio rcc rtc pwr bkp fsmc
+
+.for f in ${STM32LIBS}
+SRCS+=		stm32f10x_${f}.c
+CFLAGS+=	-DSTM32F10X_${f:U}_EN
+.endfor
 
 # Linker file
 LINKFILE=	${.CURDIR}/STM32F10x_512k_64k_flash.ld
@@ -26,7 +24,7 @@
 # Enable thumb code (since the Cortex M3 only does thumb)
 COMMONFLAGS+=	-mthumb
 # Debugging & optimisation
-COMMONFLAGS+= -g -Os
+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
@@ -35,15 +33,16 @@
 CFLAGS+=	-I ${.CURDIR}
 
 # Set device type
-CFLAGS+=	-DSTM32F10X_MD
+CFLAGS+=	-DSTM32F10X_HD
 # Set clocks
-CFLAGS+=	-DHSE_VALUE=8000000UL -DSYSCLK_FREQ_72MHz=72000000 
+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
 
@@ -64,6 +63,9 @@
 .PATH:		${SYSDIR}
 
 debug:
-	${GDB} --eval-command="target remote 10.211.55.3:61234" --eval-command "load" ${PROG}.elf
+	${GDB} --eval-command="target remote 127.0.0.1:61234" ${PROG}.elf
+
+load:
+	${GDB} --eval-command="target remote 127.0.0.1:61234" --eval-command "load" ${PROG}.elf
 
 .include "${.CURDIR}/BSDmakefile.arm"