Makefile 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. BIN=sine_logger.out
  2. TOOLS_PATH=/usr
  3. TOOLS_PREFIX=arm-none-eabi-
  4. TOOLS_VERSION=4.9.2
  5. CFLAGS=-c -mcpu=cortex-m3 -mthumb -Wall -Os -mapcs-frame -D__thumb2__=1 -flto -flto-report -ggdb3
  6. CFLAGS+=-msoft-float -gdwarf-2 -mno-sched-prolog -fno-hosted -mtune=cortex-m3 -std=c99
  7. CFLAGS+=-march=armv7-m -mfix-cortex-m3-ldrd -ffunction-sections -fdata-sections
  8. CFLAGS+=-I./liball -I./ld -I./3rd
  9. ASFLAGS=-mcpu=cortex-m3 -I./cmsis -I./incall -I./ld -I./3rd -gdwarf-2 -gdwarf-2
  10. LDFLAGS=-static -mcpu=cortex-m3 -mthumb -mthumb-interwork -Wl,--start-group
  11. LDFLAGS+=-L$(TOOLS_PATH)/lib/gcc/arm-none-eabi/$(TOOLS_VERSION)/thumb2
  12. LDFLAGS+=-L$(TOOLS_PATH)/arm-none-eabi/lib/thumb2 -lc -lg -lstdc++ -lsupc++ -lgcc -lm -flto -flto-report -Os -ggdb3
  13. #LDFLAGS+=--section-start=.text=0x8000000
  14. LDFLAGS+=-Wl,--end-group -Xlinker -Map -Xlinker $(BIN).map -Xlinker
  15. LDFLAGS+=-T ./ld/stm32f100rb_flash.ld -o $(BIN).elf
  16. CC=$(TOOLS_PATH)/bin/$(TOOLS_PREFIX)gcc #-$(TOOLS_VERSION)
  17. AS=$(TOOLS_PATH)/bin/$(TOOLS_PREFIX)as
  18. SIZE=$(TOOLS_PATH)/bin/$(TOOLS_PREFIX)size
  19. CMSISSRC=./c/core_cm3.c
  20. STM32_LIBSRC=./c/system_stm32f10x.c ./c/stm32f10x_it.c
  21. STM32_LIBSRC+=./c/stm32f10x_rcc.c ./c/stm32f10x_gpio.c
  22. SRC=main.c
  23. OBJ=core_cm3.o system_stm32f10x.o stm32f10x_it.o startup_stm32f10x_md_vl.o main.o
  24. OBJ+=stm32f10x_rcc.o stm32f10x_gpio.o Debug/obj/stm32f10x_usart.o
  25. all: ccmsis cstm32_lib cc ldall
  26. $(SIZE) -B $(BIN).elf
  27. ccmsis: $(CMSISSRC)
  28. $(CC) $(CFLAGS) $(CMSISSRC)
  29. cstm32_lib: $(STM32_LIBSRC)
  30. $(CC) $(CFLAGS) $(STM32_LIBSRC)
  31. $(AS) $(ASFLAGS) ./system/device_support/gcc/startup_stm32f10x_md_vl.S -o startup_stm32f10x_md_vl.o
  32. cc: $(SRC)
  33. $(CC) $(CFLAGS) $(SRC)
  34. ldall:
  35. $(CC) $(OBJ) $(LDFLAGS)
  36. #.PHONY: clean load
  37. #clean:
  38. # rm -f $(OBJ) \
  39. # $(BIN).map \
  40. # $(BIN).elf
  41. # make clean -C ./stlink/build/
  42. #load: $(BIN).elf
  43. # ./flashing_stm32vldiscovery.sh $(BIN).elf