Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

145 lines
5.3KB

  1. # Teensyduino Core Library
  2. # http://www.pjrc.com/teensy/
  3. # Copyright (c) 2019 PJRC.COM, LLC.
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining
  6. # a copy of this software and associated documentation files (the
  7. # "Software"), to deal in the Software without restriction, including
  8. # without limitation the rights to use, copy, modify, merge, publish,
  9. # distribute, sublicense, and/or sell copies of the Software, and to
  10. # permit persons to whom the Software is furnished to do so, subject to
  11. # the following conditions:
  12. #
  13. # 1. The above copyright notice and this permission notice shall be
  14. # included in all copies or substantial portions of the Software.
  15. #
  16. # 2. If the Software is incorporated into a build system that allows
  17. # selection among a list of target devices, then similar target
  18. # devices manufactured by PJRC.COM must be included in the list of
  19. # target devices and selectable in the same manner.
  20. #
  21. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  25. # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  26. # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  28. # SOFTWARE.
  29. # set your MCU type here, or make command line `make MCU=IMXRT1062`
  30. MCU=IMXRT1062
  31. # The name of your project (used to name the compiled .hex file)
  32. TARGET = main
  33. # configurable options
  34. OPTIONS = -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -DUSING_MAKEFILE
  35. # options needed by many Arduino libraries to configure for Teensy 4.0
  36. OPTIONS += -D__$(MCU)__ -DARDUINO=10810 -DTEENSYDUINO=149
  37. # for Cortex M7 with single & double precision FPU
  38. CPUOPTIONS = -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb
  39. # use this for a smaller, no-float printf
  40. #SPECS = --specs=nano.specs
  41. # Other Makefiles and project templates for Teensy 3.x:
  42. #
  43. # https://github.com/apmorton/teensy-template
  44. # https://github.com/xxxajk/Arduino_Makefile_master
  45. # https://github.com/JonHylands/uCee
  46. #************************************************************************
  47. # Location of Teensyduino utilities, Toolchain, and Arduino Libraries.
  48. # To use this makefile without Arduino, copy the resources from these
  49. # locations and edit the pathnames. The rest of Arduino is not needed.
  50. #************************************************************************
  51. # Those that specify a NO_ARDUINO environment variable will
  52. # be able to use this Makefile with no Arduino dependency.
  53. # Please note that if ARDUINOPATH was set, it will override
  54. # the NO_ARDUINO behaviour.
  55. ifndef NO_ARDUINO
  56. # Path to your arduino installation
  57. ARDUINOPATH ?= ../../../../..
  58. endif
  59. ifdef ARDUINOPATH
  60. # path location for Teensy Loader, teensy_post_compile and teensy_reboot (on Linux)
  61. TOOLSPATH = $(abspath $(ARDUINOPATH)/hardware/tools)
  62. # path location for Arduino libraries (currently not used)
  63. LIBRARYPATH = $(abspath $(ARDUINOPATH)/libraries)
  64. # path location for the arm-none-eabi compiler
  65. COMPILERPATH = $(abspath $(ARDUINOPATH)/hardware/tools/arm/bin)
  66. else
  67. # Default to the normal GNU/Linux compiler path if NO_ARDUINO
  68. # and ARDUINOPATH was not set.
  69. COMPILERPATH ?= /usr/bin
  70. endif
  71. #************************************************************************
  72. # Settings below this point usually do not need to be edited
  73. #************************************************************************
  74. # CPPFLAGS = compiler options for C and C++
  75. CPPFLAGS = -Wall -g -O2 $(CPUOPTIONS) -MMD $(OPTIONS) -I. -ffunction-sections -fdata-sections
  76. # compiler options for C++ only
  77. CXXFLAGS = -std=gnu++14 -felide-constructors -fno-exceptions -fpermissive -fno-rtti -Wno-error=narrowing
  78. # compiler options for C only
  79. CFLAGS =
  80. # linker options
  81. LDFLAGS = -Os -Wl,--gc-sections,--relax $(SPECS) $(CPUOPTIONS) -T$(MCU_LD)
  82. # additional libraries to link
  83. LIBS = -larm_cortexM7lfsp_math -lm -lstdc++
  84. # names for the compiler programs
  85. CC = $(COMPILERPATH)/arm-none-eabi-gcc
  86. CXX = $(COMPILERPATH)/arm-none-eabi-g++
  87. OBJCOPY = $(COMPILERPATH)/arm-none-eabi-objcopy
  88. SIZE = $(COMPILERPATH)/arm-none-eabi-size
  89. # automatically create lists of the sources and objects
  90. # TODO: this does not handle Arduino libraries yet...
  91. C_FILES := $(wildcard *.c)
  92. CPP_FILES := $(wildcard *.cpp)
  93. OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
  94. # the actual makefile rules (all .o files built by GNU make's default implicit rules)
  95. all: $(TARGET).hex
  96. $(TARGET).elf: $(OBJS) $(MCU_LD)
  97. $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  98. %.hex: %.elf
  99. $(SIZE) $<
  100. $(OBJCOPY) -O ihex -R .eeprom $< $@
  101. ifneq (,$(wildcard $(TOOLSPATH)))
  102. $(TOOLSPATH)/teensy_post_compile -file=$(basename $@) -path=$(shell pwd) -tools=$(TOOLSPATH)
  103. -$(TOOLSPATH)/teensy_reboot
  104. endif
  105. # compiler generated dependency info
  106. -include $(OBJS:.o=.d)
  107. # make "MCU" lower case
  108. LOWER_MCU := $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$(MCU)))))))))))))))))))))))))))
  109. MCU_LD = $(LOWER_MCU).ld
  110. clean:
  111. rm -f *.o *.d $(TARGET).elf $(TARGET).hex