Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # name of executable
- ELF=$(notdir $(CURDIR)).elf
- # Tool path
- TOOLROOT=/home/dsampson/arm-dev/arm-gcc/bin
- # Library path
- LIBROOT=/home/dsampson/arm-dev/STM32L1xx/lib/STM32L_Discovery_Firmware_Pack_V1.0.2
- # Tools
- GCC=$(TOOLROOT)/arm-none-linux-gnueabi-gcc
- LD=$(TOOLROOT)/arm-none-linux-gnueabi-gcc
- AR=$(TOOLROOT)/arm-none-linux-gnueabi-ar
- AS=$(TOOLROOT)/arm-none-linux-gnueabi-as
- # Code Paths
- DEVICE=$(LIBROOT)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32L1xx
- CORE=$(LIBROOT)/Libraries/CMSIS/CM3/CoreSupport
- PERIPH=$(LIBROOT)/Libraries/STM32L1xx_StdPeriph_Driver
- # Search path for standard files
- vpath %.c $(TEMPLATEROOT)
- vpath %.s $(TEMPLATEROOT)
- # Search path for perpheral library
- vpath %.c $(CORE)
- vpath %.c $(PERIPH)/src
- vpath %.c $(DEVICE)
- # Processor specific
- PTYPE = STM32L1XX_MD
- LDSCRIPT = $(TEMPLATEROOT)/stm32_flash.ld
- STARTUP= startup_stm32l1xx_md.o system_stm32l1xx.o
- # Compilation Flags
- FULLASSERT = -DUSE_FULL_ASSERT
- LDFLAGS+= -T$(LDSCRIPT) -mthumb -mcpu=cortex-m3
- CFLAGS+= -mcpu=cortex-m3 -mthumb
- CFLAGS+= -I$(TEMPLATEROOT) -I$(DEVICE) -I$(CORE) -I$(PERIPH)/inc -I.
- CFLAGS+= -D$(PTYPE) -DUSE_STDPERIPH_DRIVER $(FULLASSERT)
- # Build executable
- $(ELF) : $(OBJS)
- $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
- # compile and generate dependency info
- %.o: %.c
- $(GCC) -c $(CFLAGS) $< -o $@
- $(GCC) -MM $(CFLAGS) $< > $*.d
- %.o: %.s
- $(GCC) -c $(CFLAGS) $< -o $@
- clean:
- rm -f $(OBJS) $(OBJS:.o=.d) $(ELF) startup_stm32l* $(CLEANOTHER)
- debug: $(ELF)
- arm-none-eabi-gdb $(ELF)
- # pull in dependencies
- -include $(OBJS:.o=.d)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement