This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Makefile.common

By: a guest on Jan 31st, 2013  |  syntax: None  |  size: 1.62 KB  |  views: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # name of executable
  2.  
  3. ELF=$(notdir $(CURDIR)).elf                    
  4.  
  5. # Tool path
  6.  
  7. TOOLROOT=/home/dsampson/arm-dev/arm-gcc/bin
  8.  
  9. # Library path
  10.  
  11. LIBROOT=/home/dsampson/arm-dev/STM32L1xx/lib/STM32L_Discovery_Firmware_Pack_V1.0.2
  12.  
  13. # Tools
  14.  
  15. GCC=$(TOOLROOT)/arm-none-linux-gnueabi-gcc
  16. LD=$(TOOLROOT)/arm-none-linux-gnueabi-gcc
  17. AR=$(TOOLROOT)/arm-none-linux-gnueabi-ar
  18. AS=$(TOOLROOT)/arm-none-linux-gnueabi-as
  19.  
  20. # Code Paths
  21.  
  22. DEVICE=$(LIBROOT)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32L1xx
  23. CORE=$(LIBROOT)/Libraries/CMSIS/CM3/CoreSupport
  24. PERIPH=$(LIBROOT)/Libraries/STM32L1xx_StdPeriph_Driver
  25.  
  26. # Search path for standard files
  27.  
  28. vpath %.c $(TEMPLATEROOT)
  29. vpath %.s $(TEMPLATEROOT)
  30. # Search path for perpheral library
  31.  
  32. vpath %.c $(CORE)
  33. vpath %.c $(PERIPH)/src
  34. vpath %.c $(DEVICE)
  35.  
  36.  
  37. #  Processor specific
  38.  
  39. PTYPE = STM32L1XX_MD
  40. LDSCRIPT = $(TEMPLATEROOT)/stm32_flash.ld
  41. STARTUP= startup_stm32l1xx_md.o system_stm32l1xx.o
  42.  
  43. # Compilation Flags
  44.  
  45. FULLASSERT = -DUSE_FULL_ASSERT
  46.  
  47. LDFLAGS+= -T$(LDSCRIPT) -mthumb -mcpu=cortex-m3
  48. CFLAGS+= -mcpu=cortex-m3 -mthumb
  49. CFLAGS+= -I$(TEMPLATEROOT) -I$(DEVICE) -I$(CORE) -I$(PERIPH)/inc -I.
  50. CFLAGS+= -D$(PTYPE) -DUSE_STDPERIPH_DRIVER $(FULLASSERT)
  51.  
  52. # Build executable
  53.  
  54. $(ELF) : $(OBJS)
  55.         $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
  56.  
  57. # compile and generate dependency info
  58.  
  59.  
  60.  
  61. %.o: %.c
  62.         $(GCC) -c $(CFLAGS) $< -o $@
  63.         $(GCC) -MM $(CFLAGS) $< > $*.d
  64.  
  65. %.o: %.s
  66.         $(GCC) -c $(CFLAGS) $< -o $@
  67.  
  68. clean:
  69.         rm -f $(OBJS) $(OBJS:.o=.d) $(ELF) startup_stm32l* $(CLEANOTHER)
  70.  
  71. debug: $(ELF)
  72.         arm-none-eabi-gdb $(ELF)
  73.  
  74.  
  75. # pull in dependencies
  76.  
  77. -include $(OBJS:.o=.d)
clone this paste RAW Paste Data