Advertisement
Guest User

msp430blink_debug_problem_make

a guest
Apr 16th, 2013
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 3.10 KB | None | 0 0
  1.  #
  2.  # Makefile for msp430
  3.  #
  4.  # 'make' builds everything
  5.  # 'make clean' deletes everything except source files and Makefile
  6.  # You need to set TARGET, MCU and SOURCES for your project.
  7.  # TARGET is the name of the executable file to be produced
  8.  # $(TARGET).elf $(TARGET).hex and $(TARGET).txt nad $(TARGET).map are all generated.
  9.  # The TXT file is used for BSL loading, the ELF can be used for JTAG use
  10.  #
  11.  TARGET     = main
  12.  MCU        = msp430f2619
  13.  
  14. NAME            = leds
  15.  
  16.  
  17.  
  18.  # List all the source files here
  19.  # eg if you have a source file foo.c then list it here
  20.  SOURCES = main.c
  21.  # Include are located in the Include directory
  22.  INCLUDES = -IC:\\mspgcc-20120406-p20120911\\msp430\\include
  23.  # Add or subtract whatever MSPGCC flags you want. There are plenty more
  24.  
  25.  PROGPATH = C:\\Olimex\\MSP430 Programmer\\
  26.  PROGGER = $(PROGPATH)mspprog-cli-v2
  27.  PROGFLAGS = /p=USB /d=$(MCU)  /eall /bc /w /v /f=main.hex /post=hr
  28.  #######################################################################################
  29.  CFLAGS   = -mmcu=$(MCU) -g -O0 -Wall -Wunused $(INCLUDES)  
  30.  ASFLAGS  = -mmcu=$(MCU) -x assembler-with-cpp -Wa,-gstabs
  31.  LDFLAGS  = -mmcu=$(MCU) -Wl,-Map=$(TARGET).map
  32.  ########################################################################################
  33.  CC       = msp430-gcc
  34.  LD       = msp430-ld
  35.  AR       = msp430-ar
  36.  AS       = msp430-gcc
  37.  GASP     = msp430-gasp
  38.  NM       = msp430-nm
  39.  OBJCOPY  = msp430-objcopy
  40.  RANLIB   = msp430-ranlib
  41.  STRIP    = msp430-strip
  42.  SIZE     = msp430-size
  43.  READELF  = msp430-readelf
  44.  MAKETXT  = srec_cat
  45.  CP       = cp -p
  46.  RM       = rm -f
  47.  MV       = mv
  48.  ########################################################################################
  49.  # the file which will include dependencies
  50.  DEPEND = $(SOURCES:.c=.d)
  51.  # all the object files
  52.  OBJECTS = $(SOURCES:.c=.o)
  53.  all: $(TARGET).elf $(TARGET).hex
  54.  $(TARGET).elf: $(OBJECTS)
  55.     echo "Linking $@"
  56.     $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@
  57.     echo
  58.     echo ">>>> Size of Firmware <<<<"
  59.     $(SIZE) $(TARGET).elf
  60.     echo
  61. # Program the device.  
  62. program: $(TARGET).hex
  63.     echo $(PROGGER) $(PROGFLAGS)
  64.     $(PROGGER) $(PROGFLAGS)
  65.    
  66.  %.hex: %.elf
  67.     $(OBJCOPY) -O ihex $< $@
  68.  %.txt: %.hex
  69.     $(MAKETXT) -O $@ -TITXT $< -I
  70.         unix2dos $(TARGET).txt
  71.  #  The above line is required for the DOS based TI BSL tool to be able to read the txt file generated from linux/unix systems.
  72.  %.o: %.c
  73.     echo "Compiling $<"
  74.     $(CC) -c $(CFLAGS) -o $@ $<
  75.  # rule for making assembler source listing, to see the code
  76.  %.lst: %.c
  77.     $(CC) -c $(ASFLAGS) -Wa,-anlhd $< > $@
  78.  # include the dependencies unless we're going to clean, then forget about them.
  79.  ifneq ($(MAKECMDGOALS), clean)
  80.  -include $(DEPEND)
  81.  endif
  82.  # dependencies file
  83.  # includes also considered, since some of these are our own
  84.  # (otherwise use -MM instead of -M)
  85.  %.d: %.c
  86.     echo "Generating dependencies $@ from $<"
  87.     $(CC) -M ${CFLAGS} $< >$@
  88.  .SILENT:
  89.  .PHONY:    clean
  90.  clean:
  91.     -$(RM) $(OBJECTS)
  92.     -$(RM) $(TARGET).d
  93.     -$(RM) $(TARGET).elf
  94.     -$(RM) $(TARGET).hex
  95.     -$(RM) $(TARGET).map   
  96.     -$(RM) $(SOURCES:.c=.lst)
  97.     -$(RM) $(DEPEND)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement