Teensy 4.1 core updated for C++20
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 -DARDUINO_TEENSY40
  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
  42. #
  43. # https://forum.pjrc.com/threads/57251?p=213332&viewfull=1#post213332
  44. # https://github.com/apmorton/teensy-template
  45. # https://github.com/xxxajk/Arduino_Makefile_master
  46. # https://github.com/JonHylands/uCee
  47. #************************************************************************
  48. # Location of Teensyduino utilities, Toolchain, and Arduino Libraries.
  49. # To use this makefile without Arduino, copy the resources from these
  50. # locations and edit the pathnames. The rest of Arduino is not needed.
  51. #************************************************************************
  52. # Those that specify a NO_ARDUINO environment variable will
  53. # be able to use this Makefile with no Arduino dependency.
  54. # Please note that if ARDUINOPATH was set, it will override
  55. # the NO_ARDUINO behaviour.
  56. ifndef NO_ARDUINO
  57. # Path to your arduino installation
  58. ARDUINOPATH ?= ../../../../..
  59. endif
  60. ifdef ARDUINOPATH
  61. # path location for Teensy Loader, teensy_post_compile and teensy_reboot (on Linux)
  62. TOOLSPATH = $(abspath $(ARDUINOPATH)/hardware/tools)
  63. # path location for Arduino libraries (currently not used)
  64. LIBRARYPATH = $(abspath $(ARDUINOPATH)/libraries)
  65. # path location for the arm-none-eabi compiler
  66. COMPILERPATH = $(abspath $(ARDUINOPATH)/hardware/tools/arm/bin)
  67. else
  68. # Default to the normal GNU/Linux compiler path if NO_ARDUINO
  69. # and ARDUINOPATH was not set.
  70. COMPILERPATH ?= /usr/bin
  71. endif
  72. #************************************************************************
  73. # Settings below this point usually do not need to be edited
  74. #************************************************************************
  75. # CPPFLAGS = compiler options for C and C++
  76. CPPFLAGS = -Wall -g -O2 $(CPUOPTIONS) -MMD $(OPTIONS) -I. -ffunction-sections -fdata-sections
  77. # compiler options for C++ only
  78. CXXFLAGS = -std=gnu++14 -felide-constructors -fno-exceptions -fpermissive -fno-rtti -Wno-error=narrowing
  79. # compiler options for C only
  80. CFLAGS =
  81. # linker options
  82. LDFLAGS = -Os -Wl,--gc-sections,--relax $(SPECS) $(CPUOPTIONS) -T$(MCU_LD)
  83. # additional libraries to link
  84. LIBS = -larm_cortexM7lfsp_math -lm -lstdc++
  85. # names for the compiler programs
  86. CC = $(COMPILERPATH)/arm-none-eabi-gcc
  87. CXX = $(COMPILERPATH)/arm-none-eabi-g++
  88. OBJCOPY = $(COMPILERPATH)/arm-none-eabi-objcopy
  89. SIZE = $(COMPILERPATH)/arm-none-eabi-size
  90. # automatically create lists of the sources and objects
  91. # TODO: this does not handle Arduino libraries yet...
  92. C_FILES := $(wildcard *.c)
  93. CPP_FILES := $(wildcard *.cpp)
  94. OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
  95. # the actual makefile rules (all .o files built by GNU make's default implicit rules)
  96. all: $(TARGET).hex
  97. $(TARGET).elf: $(OBJS) $(MCU_LD)
  98. $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  99. %.hex: %.elf
  100. $(SIZE) $<
  101. $(OBJCOPY) -O ihex -R .eeprom $< $@
  102. ifneq (,$(wildcard $(TOOLSPATH)))
  103. $(TOOLSPATH)/teensy_post_compile -file=$(basename $@) -path=$(shell pwd) -tools=$(TOOLSPATH)
  104. -$(TOOLSPATH)/teensy_reboot
  105. endif
  106. # compiler generated dependency info
  107. -include $(OBJS:.o=.d)
  108. # make "MCU" lower case
  109. 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)))))))))))))))))))))))))))
  110. MCU_LD = $(LOWER_MCU).ld
  111. clean:
  112. rm -f *.o *.d $(TARGET).elf $(TARGET).hex