From 3ce51094aca41435daed335394c148c9e1d103bd Mon Sep 17 00:00:00 2001 From: jasper Date: Fri, 25 Jan 2013 10:06:33 +0000 Subject: [PATCH] - add a sample Makefile and README - add RUN_DEPENDS on devel/srecord as discussed with jj@ --- meta/msp430/Makefile | 10 ++++-- meta/msp430/files/Makefile | 62 ++++++++++++++++++++++++++++++++++++++ meta/msp430/pkg/PLIST | 5 ++- meta/msp430/pkg/README | 12 ++++++++ 4 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 meta/msp430/files/Makefile create mode 100644 meta/msp430/pkg/README diff --git a/meta/msp430/Makefile b/meta/msp430/Makefile index cffc4218237..05d12453d70 100644 --- a/meta/msp430/Makefile +++ b/meta/msp430/Makefile @@ -1,14 +1,20 @@ -# $OpenBSD: Makefile,v 1.3 2012/10/23 09:51:49 sthen Exp $ +# $OpenBSD: Makefile,v 1.4 2013/01/25 10:06:33 jasper Exp $ COMMENT= MSP430 meta-package PKGNAME= msp430-20120406# version equals the mspgcc LTS release +REVISION= 0 MAINTAINER= Jasper Lievisse Adriaanse RUN_DEPENDS= devel/msp430/gdb \ devel/msp430/msp430mcu \ devel/mspdebug \ - devel/naken430asm + devel/naken430asm \ + devel/srecord + +do-install: + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/msp430/ + ${INSTALL_DATA} ${FILESDIR}/Makefile ${PREFIX}/share/examples/msp430/ .include diff --git a/meta/msp430/files/Makefile b/meta/msp430/files/Makefile new file mode 100644 index 00000000000..721ce212dcc --- /dev/null +++ b/meta/msp430/files/Makefile @@ -0,0 +1,62 @@ +# $OpenBSD: Makefile,v 1.1 2013/01/25 10:06:33 jasper Exp $ +# +# Sample Makefile for developing MSP430 projects on OpenBSD. + +MCU= msp430 +MMCU= msp430g2231 # msp430f5529 + +CFLAGS = -mmcu=$(MMCU) -g -Os -Wall -Wunused -I../includes/ +ASFLAGS = -mmcu=$(MMCU) -x assembler-with-cpp -Wa,-gstabs +LDFLAGS = -mmcu=$(MMCU) -Wl,-Map=$(TARGET).map +CC = $(MCU)-gcc +LD = $(MCU)-ld +AR = $(MCU)-ar +AS = $(MCU)-gcc +GASP = $(MCU)-gasp +NM = $(MCU)-nm +OBJCOPY = $(MCU)-objcopy +RANLIB = $(MCU)-ranlib +STRIP = $(MCU)-strip +SIZE = $(MCU)-size +READELF = $(MCU)-readelf +MAKETXT = srec_cat + +TARGET= main + +SOURCES = main.c +OBJECTS = $(SOURCES:.c=.o) + +all: $(TARGET).elf $(TARGET).hex $(TARGET).txt + +$(TARGET).elf: $(OBJECTS) + @echo "Linking $@" + $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@ + @echo + @echo ">>>> Size of Firmware <<<<" + $(SIZE) $(TARGET).elf + @echo + +$(TARGET).hex: $(TARGET).elf + $(OBJCOPY) -O ihex $(TARGET).elf $(TARGET).hex + +%.txt: %.hex + $(MAKETXT) -O $@ -TITXT $< -I + +%.o: %.c + @echo "Compiling $<" + $(CC) -c $(CFLAGS) -o $@ $< + +%.lst: %.c + $(CC) -c $(CFLAGS) -Wa,-anlhd $< > $@ + +$(TARGET).txt: $(TARGET).hex + $(MAKETXT) -O $(TARGET).txt -TITXT $(TARGET).hex -I + +program: $(TARGET).elf + mspdebug rf2500 prog $(TARGET).elf exit + +clean: + rm -fr $(TARGET).elf $(TARGET).hex $(OBJECTS) + +asm: + ${OBJDUMP} -d ${OBJECTS} diff --git a/meta/msp430/pkg/PLIST b/meta/msp430/pkg/PLIST index bc99eedc8a7..0366496422b 100644 --- a/meta/msp430/pkg/PLIST +++ b/meta/msp430/pkg/PLIST @@ -1 +1,4 @@ -@comment $OpenBSD: PLIST,v 1.1.1.1 2011/11/14 13:25:50 jasper Exp $ +@comment $OpenBSD: PLIST,v 1.2 2013/01/25 10:06:33 jasper Exp $ +share/doc/pkg-readmes/${FULLPKGNAME} +share/examples/msp430/ +share/examples/msp430/Makefile diff --git a/meta/msp430/pkg/README b/meta/msp430/pkg/README new file mode 100644 index 00000000000..18d0867148b --- /dev/null +++ b/meta/msp430/pkg/README @@ -0,0 +1,12 @@ +$OpenBSD: README,v 1.1 2013/01/25 10:06:33 jasper Exp $ + ++----------------------------------------------------------------------- +| Running ${FULLPKGNAME} on OpenBSD ++----------------------------------------------------------------------- + +To aid development with MSP430 on OpenBSD, a sample Makefile has been +installed into ${PREFIX}/share/examples/msp430/Makefile . + +Using the provided Makefile template, $SOURCES will default to +'main.c'. This can be compiled with the default 'all' target, and +uploaded to the device using the 'program' target.