makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. GCC_ARM_PATH := E:\gcc-arm-none-eabi-5_4-2016q3-20160926-win32
  2. THUMB_PATH := $(GCC_ARM_PATH)\arm-none-eabi\lib\thumb
  3. CROSS_COMPILE := $(GCC_ARM_PATH)\bin\arm-none-eabi-
  4. BT_PATH= ..\..\..\..\..\respin_1208
  5. PATCH_PATH = $(BT_PATH)\output
  6. UTIL_PATH = $(BT_PATH)\util
  7. OUT_PATH = .\output
  8. INC = .\$(GCC_ARM_PATH)\arm-none-eabi\include
  9. SDK_ROOT = ..\..\..\..\Librarier
  10. SRC_ROOT = ..\..\User
  11. INCLUDES = -I$(SDK_ROOT)/cmsis/ \
  12. -I$(SDK_ROOT)/device/ \
  13. -I$(SDK_ROOT)/drivers/hal/ \
  14. -I$(SDK_ROOT)/drivers/uart/ \
  15. -I$(SDK_ROOT)/drivers/gpio/ \
  16. -I$(SDK_ROOT)/drivers/it/ \
  17. -I$(SDK_ROOT)/drivers/timer/ \
  18. -I$(SDK_ROOT)/drivers/bt/ \
  19. -I$(SDK_ROOT)/patch/ \
  20. SRC_FILES = $(SRC_ROOT)/main.c \
  21. $(SDK_ROOT)/drivers/uart/yc11xx_uart.c \
  22. $(SDK_ROOT)/drivers/hal/yc_drv_common.c \
  23. $(SDK_ROOT)/libcore/sys/system.c \
  24. $(SDK_ROOT)/drivers/gpio/yc11xx_gpio.c \
  25. $(SDK_ROOT)/drivers/it/yc_it.c \
  26. $(SDK_ROOT)/drivers/timer/yc_timer.c \
  27. $(SDK_ROOT)/drivers/bt/yc11xx_bt.c \
  28. $(SDK_ROOT)/libcore/sys/systick.c
  29. OBJ = ${patsubst %.c, %.o, ${SRC_FILES}}
  30. LDSCRIPTS := -T gcc.ld -lgcc
  31. LIBFILES := -lm -I${INC} -l yc11xx -lc
  32. LIBDIR := -L.
  33. LIBDIR += -L "$(GCC_ARM_PATH)\lib\gcc\arm-none-eabi\5.4.1\armv6-m"
  34. LIBDIR += -L "$(GCC_ARM_PATH)\arm-none-eabi\lib\armv6-m"
  35. LIBDIR += -L "$(SDK_ROOT)\libcore"
  36. #$(warning OBJIEAT is $(OBJ))
  37. all : output\a.out
  38. $(CROSS_COMPILE)objdump -S $^ > output\disasm
  39. $(CROSS_COMPILE)objcopy $^ -O ihex output\out.hex
  40. perl .\tool\hex2rom.pl 0 80000 < output\out.hex > output\out.rom
  41. copy $(PATCH_PATH)\ramcode.rom .\output\ramcode.rom
  42. copy $(PATCH_PATH)\sched.rom .\output\sched.rom
  43. copy $(PATCH_PATH)\memmap.format .\output\memmap.format
  44. OBJS = startup_m0.o
  45. output\a.out : $(OBJ) $(OBJS)
  46. $(CROSS_COMPILE)ld $^ -o $@ $(LIBDIR) $(LIBFILES) $(LDSCRIPTS) -Map=./output\memmap
  47. $(OBJS) : ./startup/startup_m0.s
  48. $(CROSS_COMPILE)as $^ -o $@ -mthumb -mcpu=cortex-m0
  49. $(OBJ) : %.o : %.c
  50. $(CROSS_COMPILE)gcc $^ -c $(INCLUDES) -g -O0 -o $@ -mthumb -mcpu=cortex-m0 -msoft-float -fno-toplevel-reorder
  51. clean :
  52. del /Q output\*.*
  53. del /Q /S .\*.o
  54. del /Q /S ..\..\*.o