changeset 1:7a08db98ae8b

Split out compile flags for easier editing. Allow toolchain suffixes (needed for when arm-elf works). Add debug target.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 08 Oct 2011 20:33:47 +1030
parents c59513fd84fb
children 274e01fa5a4c
files BSDmakefile BSDmakefile.arm
diffstat 2 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/BSDmakefile	Mon Oct 03 21:19:15 2011 +1030
+++ b/BSDmakefile	Sat Oct 08 20:33:47 2011 +1030
@@ -21,10 +21,14 @@
 # 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
+# Set CPU type
+COMMONFLAGS=	-mcpu=cortex-m3
+# Enable thumb code (since the Cortex M3 only does thumb)
+COMMONFLAGS+=	-mthumb
+# Debugging & optimisation
+COMMONFLAGS+= -g -Os
 # Put functions & data in individual sections to allow the linker to optimise (breaks debugging apparently)
-COMMONFLAGS+=	-ffunction-sections -fdata-sections
+#COMMONFLAGS+=	-ffunction-sections -fdata-sections
 # We aren't using exceptions
 COMMONFLAGS+=	-fno-exceptions
 
@@ -37,7 +41,7 @@
 # Enable STM peripheral drivers
 CFLAGS+=	-DUSE_STDPERIPH_DRIVER
 # Enable startup delay
-CFLAGS+=	-DSTARTUP_DELAY
+#CFLAGS+=	-DSTARTUP_DELAY
 # Vector table in flash
 CFLAGS+=	-DVECT_TAB_FLASH 
 # Enable warnings (disable char-subscripts otherwise ctypes.h generates warnings
@@ -59,4 +63,7 @@
 .PATH:		${COREDIR}
 .PATH:		${SYSDIR}
 
-.include "${.CURDIR}/BSDmakefile.arm"
\ No newline at end of file
+debug:
+	${GDB} --eval-command="target remote 10.211.55.3:61234" --eval-command "load" ${PROG}.elf
+
+.include "${.CURDIR}/BSDmakefile.arm"
--- a/BSDmakefile.arm	Mon Oct 03 21:19:15 2011 +1030
+++ b/BSDmakefile.arm	Sat Oct 08 20:33:47 2011 +1030
@@ -5,12 +5,15 @@
 .MAIN:		${PROG}.bin
 
 TCHAIN=		arm-none-eabi
+#TCHAIN=		arm-elf
+#TCHAINSF=	-4.6
 
-CC=		${TCHAIN}-gcc
-AS=		${TCHAIN}-gcc
-CXX=		${TCHAIN}-g++
-AR=		${TCHAIN}-ar
-OBJCOPY=	${TCHAIN}-objcopy
+CC=		${TCHAIN}-gcc${TCHAINSF}
+AS=		${TCHAIN}-gcc${TCHAINSF}
+CXX=		${TCHAIN}-g++${TCHAINSF}
+AR=		${TCHAIN}-ar${TCHAINSF}
+OBJCOPY=	${TCHAIN}-objcopy${TCHAINSF}
+GDB=		${TCHAIN}-gdb
 RM=		rm -f
 
 CFLAGS+=	${COMMONFLAGS}