Advertisement
nis

Make for stm32/example/00-enable-led

nis
Jan 26th, 2012
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.04 KB | None | 0 0
  1. # Compilator prefix
  2. CROSS_PREFIX=arm-softfloat-linux-gnueabi-
  3. # Compilators and utils
  4. CC=$(CROSS_PREFIX)gcc
  5. OBJCOPY=$(CROSS_PREFIX)objcopy
  6. # Paths
  7. STM_PATH=../../stlink/example
  8. LIBS_STM_PATH=$(STM_PATH)/libs_stm
  9. # Platform
  10. PLATFORM=stm32f10x
  11. # Primary compiler flags
  12. CFLAGS=-g -O2 -mlittle-endian -mthumb -ffreestanding -nostdlib -nostdinc
  13. CFLAGS+= -mcpu=cortex-m3 -DSTM32F10X_MD_VL
  14.  
  15. # Secondary compiler flags
  16. CFLAGS+= -I.
  17. CFLAGS+= -I$(LIBS_STM_PATH)/inc/base
  18. CFLAGS+= -I$(LIBS_STM_PATH)/inc/core_support
  19. CFLAGS+= -I$(LIBS_STM_PATH)/inc/device_support
  20. CFLAGS+= -Wl,-T,stm32f100xb_flash.ld
  21. # Linker flags
  22. LDFLAGS=-L.
  23.  
  24. # Sources and objects
  25. SRCS=$(wildcard *.c)
  26. OBJS=$(SRCS:.c=.o)
  27.  
  28. # Rules for compile
  29. all: firmware.bin
  30.  
  31. %bin: %elf
  32.     $(OBJCOPY) -O binary $^ $@
  33.  
  34. firmware.elf: $(OBJS)
  35.     $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
  36.  
  37. %.o: $.c
  38.     $(CC) $(CFLAGS) -c -o $@ $^
  39.  
  40. # Rules for clean
  41. clean:
  42.     rm -rf *.o *.elf *.bin
  43.  
  44. # Rules for write firmware to mcu
  45. write:
  46.     st-flash write v1 firmware.bin 0x8000000
  47.  
  48. .PHONY: all clean
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement