view BSDmakefile.arm @ 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

# Cribbed from http://stm32.spacevs.com/index.php?option=com_content&view=category&id=9&Itemid=103 (and others)

.SUFFIXES:	.bin .elf .hex .map .lst .dmp

.MAIN:		${PROG}.bin

TCHAIN=		arm-none-eabi

CC=		${TCHAIN}-gcc
AS=		${TCHAIN}-gcc
CXX=		${TCHAIN}-g++
AR=		${TCHAIN}-ar
OBJCOPY=	${TCHAIN}-objcopy
RM=		rm -f

CFLAGS+=	${COMMONFLAGS}

LDFLAGS+=	${COMMONFLAGS}
LDFLAGS+=	-L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-T${LINKFILE}

OBJS+=  	${SRCS:N*.h:R:S/$/.o/g}

.c.o:
		${CC} ${CFLAGS} ${CPPFLAGS} -Wa,-adhlns=${.PREFIX}.lst -c ${.IMPSRC} -o ${.PREFIX}.o

.s.o:
		${AS} ${CFLAGS} ${ASFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o

${PROG}.elf: ${OBJS}
		${CC} ${LDFLAGS} ${OBJS} -Wl,-Map=${PROG}.map,--cref -o ${PROG}.elf ${LDADD}

.elf.bin:
		${OBJCOPY} -O binary ${.ALLSRC} ${.TARGET}

clean:
		${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.bin ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp

prog:
		/Users/darius/projects/stm32loader/stm32loader.py -p /dev/tty.usbserial -b 115200 -e -w -v ${PROG}.bin

#########################
#;;; Local Variables: ***
#;;; mode:makefile ***
#;;; End: ***