Makefile 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. CROSS_COMPILE:=arm-none-eabi-
  2. CC:=$(CROSS_COMPILE)gcc
  3. LD:=$(CROSS_COMPILE)gcc
  4. VERSION?=1
  5. OBJS=main.o
  6. UMX:=unicore-mx/lib/libucmx_stm32l0.a
  7. UMXFLAGS:=-Iunicore-mx/include/ -DSTM32L0
  8. LIBS+=$(UMX)
  9. LSCRIPT:=unicore-mx/lib/stm32/l0/stm32l0xx6.ld
  10. OBJCOPY:=$(CROSS_COMPILE)objcopy
  11. CFLAGS:=-mcpu=cortex-m0 -mthumb -Wall -Wno-main -Wstack-usage=320 \
  12. -ffreestanding -Wno-unused -DBLOCK_SIZE=4096 -I. -Iunicore-mx/include \
  13. -ffunction-sections -fdata-sections -DSTM32L0
  14. CFLAGS+=-specs=nano.specs -lc -lg
  15. CFLAGS+=$(UMXFLAGS)
  16. CFLAGS+=-O3
  17. #CFLAGS+=-g -ggdb3
  18. ASFLAGS:=$(CFLAGS)
  19. LDFLAGS:=-T $(LSCRIPT) -Wl,-gc-sections -Wl,-Map=image.map -mcpu=cortex-m0 -mthumb -nostartfiles
  20. #all: image.bin
  21. image.bin: image.elf
  22. $(OBJCOPY) -O binary $^ $@
  23. image.elf: $(LIBS) $(OBJS) $(LSCRIPT)
  24. $(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
  25. $(UMX):
  26. make -C unicore-mx FP_FLAGS="-O3 -mfloat-abi=soft" TARGETS=stm32/l0
  27. clean:
  28. @rm -f image.bin image.elf *.o image.map
  29. make -C unicore-mx clean