選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

92 行
2.9KB

  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. #ARDUINOPATH ?= ../../../..
  6. # configurable options
  7. OPTIONS = -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -DUSING_MAKEFILE
  8. # options needed by many Arduino libraries to configure for Teensy 3.0
  9. OPTIONS += -D__MK20DX256__ -DARDUINO=10600 -DTEENSYDUINO=121
  10. # Other Makefiles and project templates for Teensy 3.x:
  11. #
  12. # https://github.com/apmorton/teensy-template
  13. # https://github.com/xxxajk/Arduino_Makefile_master
  14. # https://github.com/JonHylands/uCee
  15. #************************************************************************
  16. # Location of Teensyduino utilities, Toolchain, and Arduino Libraries.
  17. # To use this makefile without Arduino, copy the resources from these
  18. # locations and edit the pathnames. The rest of Arduino is not needed.
  19. #************************************************************************
  20. # path location for Teensy Loader, teensy_post_compile and teensy_reboot
  21. TOOLSPATH = $(ARDUINOPATH)/hardware/tools # on Linux
  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/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,--defsym=__rtc_localtime=0 --specs=nano.specs -mcpu=cortex-m4 -mthumb -Tmk20dx256.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) mk20dx256.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