Makefile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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
  7. CFLAGS+=-march=armv7-m -mfix-cortex-m3-ldrd -ffunction-sections -fdata-sections
  8. CFLAGS+=-I./lib -I./inc -I./3rd
  9. ASFLAGS=-mcpu=cortex-m3 -I./inc -I./lib -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 ./startup/stm32f100rb_flash.ld -o $(BIN).elf
  16. #LDFLAGS+= -o $(BIN).elf
  17. CC=$(TOOLS_PATH)/bin/$(TOOLS_PREFIX)gcc #-$(TOOLS_VERSION)
  18. AS=$(TOOLS_PATH)/bin/$(TOOLS_PREFIX)as
  19. SIZE=$(TOOLS_PATH)/bin/$(TOOLS_PREFIX)size
  20. CMSISSRC=./lib/core_cm3.c
  21. STM32_LIBSRC=./lib/system_stm32f10x.c
  22. STM32_LIBSRC=./lib/stm32f10x_rcc.c ./lib/stm32f10x_gpio.c
  23. SRC=main.c
  24. OBJ= core_cm3.o system_stm32f10x.o stm32f10x_it.o startup_stm32f10x_md_vl.o main.o
  25. #OBJ+=stm32f10x_rcc.o stm32f10x_gpio.o stm32f10x_usart.o
  26. all: ccmsis cstm32_lib cc ldall
  27. $(SIZE) -B $(BIN).elf
  28. ccmsis: $(CMSISSRC)
  29. $(CC) $(CFLAGS) $(CMSISSRC)
  30. cstm32_lib: $(STM32_LIBSRC)
  31. $(CC) $(CFLAGS) $(STM32_LIBSRC)
  32. $(AS) $(ASFLAGS) ./startup/startup_stm32f10x_md_vl.S -o startup_stm32f10x_md_vl.o
  33. cc: $(SRC)
  34. $(CC) $(CFLAGS) $(SRC)
  35. ldall:
  36. $(CC) $(OBJ) $(LDFLAGS)
  37. #.PHONY: clean load
  38. #clean:
  39. # rm -f $(OBJ) \
  40. # $(BIN).map \
  41. # $(BIN).elf
  42. # make clean -C ./stlink/build/
  43. #load: $(BIN).elf
  44. # ./flashing_stm32vldiscovery.sh $(BIN).elf