Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

Makefile 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # The name of your project (used to name the compiled .hex file)
  2. TARGET = main
  3. # Path to your arduino installation
  4. ARDUINOPATH ?= ../../../..
  5. # configurable options
  6. OPTIONS = -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH
  7. # options needed by many Arduino libraries to configure for Teensy 3.0
  8. OPTIONS += -D__MK20DX128__ -DARDUINO=105 -DTEENSYDUINO=120
  9. # Other Makefiles and project templates for Teensy 3.x:
  10. #
  11. # https://github.com/apmorton/teensy-template
  12. # https://github.com/xxxajk/Arduino_Makefile_master
  13. # https://github.com/JonHylands/uCee
  14. #************************************************************************
  15. # Location of Teensyduino utilities, Toolchain, and Arduino Libraries.
  16. # To use this makefile without Arduino, copy the resources from these
  17. # locations and edit the pathnames. The rest of Arduino is not needed.
  18. #************************************************************************
  19. # path location for Teensy Loader, teensy_post_compile and teensy_reboot
  20. TOOLSPATH = $(ARDUINOPATH)/hardware/tools # on Linux
  21. #TOOLSPATH = $(ARDUINOPATH)/hardware/tools/tools/avr/bin # on Mac or Windows
  22. # path location for Arduino libraries (currently not used)
  23. LIBRARYPATH = $(ARDUINOPATH)/libraries
  24. # path location for the arm-none-eabi compiler
  25. COMPILERPATH = $(ARDUINOPATH)/hardware/tools/arm-none-eabi/bin
  26. #************************************************************************
  27. # Settings below this point usually do not need to be edited
  28. #************************************************************************
  29. # CPPFLAGS = compiler options for C and C++
  30. CPPFLAGS = -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD $(OPTIONS) -I.
  31. # compiler options for C++ only
  32. CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
  33. # compiler options for C only
  34. CFLAGS =
  35. # linker options
  36. LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -Tmk20dx128.ld
  37. # additional libraries to link
  38. LIBS = -lm
  39. # names for the compiler programs
  40. CC = $(abspath $(COMPILERPATH))/arm-none-eabi-gcc
  41. CXX = $(abspath $(COMPILERPATH))/arm-none-eabi-g++
  42. OBJCOPY = $(abspath $(COMPILERPATH))/arm-none-eabi-objcopy
  43. SIZE = $(abspath $(COMPILERPATH))/arm-none-eabi-size
  44. # automatically create lists of the sources and objects
  45. # TODO: this does not handle Arduino libraries yet...
  46. C_FILES := $(wildcard *.c)
  47. CPP_FILES := $(wildcard *.cpp)
  48. OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
  49. # the actual makefile rules (all .o files built by GNU make's default implicit rules)
  50. all: $(TARGET).hex
  51. $(TARGET).elf: $(OBJS) mk20dx128.ld
  52. $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  53. %.hex: %.elf
  54. $(SIZE) $<
  55. $(OBJCOPY) -O ihex -R .eeprom $< $@
  56. $(abspath $(TOOLSPATH))/teensy_post_compile -file=$(basename $@) -path=$(shell pwd) -tools=$(abspath $(TOOLSPATH))
  57. -$(abspath $(TOOLSPATH))/teensy_reboot
  58. # compiler generated dependency info
  59. -include $(OBJS:.o=.d)
  60. clean:
  61. rm -f *.o *.d $(TARGET).elf $(TARGET).hex