- add a sample Makefile and README

- add RUN_DEPENDS on devel/srecord

as discussed with jj@
This commit is contained in:
jasper 2013-01-25 10:06:33 +00:00
parent 52770423f7
commit 3ce51094ac
4 changed files with 86 additions and 3 deletions

View File

@ -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 <jasper@openbsd.org>
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 <bsd.port.mk>

View File

@ -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}

View File

@ -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

12
meta/msp430/pkg/README Normal file
View File

@ -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.