CVS: examples/iostructures README.txt,NONE,1.1 main.c,NONE,1.1 makefile,NONE,1.1
Chris Liechti <[email protected]>
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mspgcc/examples/iostructures In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25072/examples/iostructures Added Files: README.txt main.c makefile Log Message: add simple example that uses iostructures.h --- NEW FILE: README.txt --- iostructures ============ Overview -------- It is a simple example project for the MSP430 series MCU and the GCC port of the mspgcc project. The project contains a makefile and C sources. Features: - Just a plain ``main()`` that accesses the ports of the MSP using the declarations from iostructures.h - Makefile - compile and link - convert to intel hex format - generate a listing with mixed C / assembly Required hardware ----------------- - A MSP430F1121 or larger device (FET kits) - An array of eight LEDs on P1.0 (470 Ohms series resistor to GND) or better connected through a driver IC like a 74HC245 or 74HC244. Disclaimer ---------- This example is part of the mspgcc project http://mspgcc.sf.net. See license.txt_ for details. chris .. _license.txt: ../license.html --- NEW FILE: main.c --- /** * Show th euse of iostructures.h * see README.txt for details. * * chris <[email protected]> */ #include <io.h> // msp430 defs #include <msp430/iostructures.h> // must be inlcuded after io.h! #include <mspgcc/util.h> // delay() /** * Main function with a blinking led */ int main(void) { WDTCTL = WDTPW|WDTHOLD; // Init watchdog timer port1.dir.pin0 = IO_DIRPIN_OUTPUT; while (1) { // main loop, never ends... port1.out.pin0 ^= 1; delay(0x4fff); } } --- NEW FILE: makefile --- # makfile configuration NAME = iostructures_demo CSOURCES = main.c #~ ASOURCES = CPU = msp430x1121 ASFLAGS = -mmcu=${CPU} -D_GNU_ASSEMBLER_ -I . CFLAGS = -mmcu=${CPU} -O2 -Wall -g --std=gnu99 -I . LDFLAGS = -lmspgcc #switch the compiler (for the internal make rules) CC = msp430-gcc AS = msp430-gcc OBJECTS = ${CSOURCES:.c=.o} ${ASOURCES:.S=.o} .PHONY: all FORCE clean download download-jtag download-bsl #all should be the first target. it's built when make is run without args all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst dependencies.d #confgigure the next line if you want to use the serial download download: download-jtag #~ download: download-bsl #additional rules for files ${NAME}.elf: ${OBJECTS} ${CC} -mmcu=${CPU} -o $@ ${OBJECTS} $(LDFLAGS) ${NAME}.a43: ${NAME}.elf msp430-objcopy -O ihex $^ $@ ${NAME}.lst: ${NAME}.elf msp430-objdump -dSt $^ >$@ @echo "----- RAM/Flash Usage -----" msp430-size $^ download-jtag: all msp430-jtag -e ${NAME}.elf download-bsl: all msp430-bsl $(BSLOPT) -e ${NAME}.elf clean: rm -f ${NAME}.elf ${NAME}.a43 ${NAME}.lst ${OBJECTS} dependencies.d #dummy target as dependecy if something has to be build everytime FORCE: #project dependencies dependencies.d: $(CC) -MM ${CFLAGS} ${CSOURCES} > dependencies.d ifdef ASOURCES $(CC) -MM ${ASFLAGS} ${ASOURCES} >> dependencies.d endif -include dependencies.d ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642