Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Makefile 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. # Use these lines for Teensy 4.0
  30. MCU = IMXRT1062
  31. MCU_LD = imxrt1062.ld
  32. MCU_DEF = ARDUINO_TEENSY40
  33. # Use these lines for Teensy 4.1
  34. #MCU = IMXRT1062
  35. #MCU_LD = imxrt1062_t41.ld
  36. #MCU_DEF = ARDUINO_TEENSY41
  37. # The name of your project (used to name the compiled .hex file)
  38. TARGET = main
  39. # configurable options
  40. OPTIONS = -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -DUSING_MAKEFILE
  41. #
  42. # USB Type configuration:
  43. # -DUSB_SERIAL
  44. # -DUSB_DUAL_SERIAL
  45. # -DUSB_TRIPLE_SERIAL
  46. # -DUSB_KEYBOARDONLY
  47. # -DUSB_TOUCHSCREEN
  48. # -DUSB_HID_TOUCHSCREEN
  49. # -DUSB_HID
  50. # -DUSB_SERIAL_HID
  51. # -DUSB_MIDI
  52. # -DUSB_MIDI4
  53. # -DUSB_MIDI16
  54. # -DUSB_MIDI_SERIAL
  55. # -DUSB_MIDI4_SERIAL
  56. # -DUSB_MIDI16_SERIAL
  57. # -DUSB_AUDIO
  58. # -DUSB_MIDI_AUDIO_SERIAL
  59. # -DUSB_MIDI16_AUDIO_SERIAL
  60. # -DUSB_MTPDISK
  61. # -DUSB_RAWHID
  62. # -DUSB_FLIGHTSIM
  63. # -DUSB_FLIGHTSIM_JOYSTICK
  64. # options needed by many Arduino libraries to configure for Teensy model
  65. OPTIONS += -D__$(MCU)__ -DARDUINO=10813 -DTEENSYDUINO=154 -D$(MCU_DEF)
  66. # for Cortex M7 with single & double precision FPU
  67. CPUOPTIONS = -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -mthumb
  68. # use this for a smaller, no-float printf
  69. #SPECS = --specs=nano.specs
  70. # Other Makefiles and project templates for Teensy
  71. #
  72. # https://forum.pjrc.com/threads/57251?p=213332&viewfull=1#post213332
  73. # https://github.com/apmorton/teensy-template
  74. # https://github.com/xxxajk/Arduino_Makefile_master
  75. # https://github.com/JonHylands/uCee
  76. #************************************************************************
  77. # Location of Teensyduino utilities, Toolchain, and Arduino Libraries.
  78. # To use this makefile without Arduino, copy the resources from these
  79. # locations and edit the pathnames. The rest of Arduino is not needed.
  80. #************************************************************************
  81. # Those that specify a NO_ARDUINO environment variable will
  82. # be able to use this Makefile with no Arduino dependency.
  83. # Please note that if ARDUINOPATH was set, it will override
  84. # the NO_ARDUINO behaviour.
  85. ifndef NO_ARDUINO
  86. # Path to your arduino installation
  87. ARDUINOPATH ?= ../../../../..
  88. endif
  89. ifdef ARDUINOPATH
  90. # path location for Teensy Loader, teensy_post_compile and teensy_reboot (on Linux)
  91. TOOLSPATH = $(abspath $(ARDUINOPATH)/hardware/tools)
  92. # path location for Arduino libraries (currently not used)
  93. LIBRARYPATH = $(abspath $(ARDUINOPATH)/libraries)
  94. # path location for the arm-none-eabi compiler
  95. COMPILERPATH = $(abspath $(ARDUINOPATH)/hardware/tools/arm/bin)
  96. else
  97. # Default to the normal GNU/Linux compiler path if NO_ARDUINO
  98. # and ARDUINOPATH was not set.
  99. COMPILERPATH ?= /usr/bin
  100. endif
  101. #************************************************************************
  102. # Settings below this point usually do not need to be edited
  103. #************************************************************************
  104. # CPPFLAGS = compiler options for C and C++
  105. CPPFLAGS = -Wall -g -O2 $(CPUOPTIONS) -MMD $(OPTIONS) -I. -ffunction-sections -fdata-sections
  106. # compiler options for C++ only
  107. CXXFLAGS = -std=gnu++14 -felide-constructors -fno-exceptions -fpermissive -fno-rtti -Wno-error=narrowing
  108. # compiler options for C only
  109. CFLAGS =
  110. # linker options
  111. LDFLAGS = -Os -Wl,--gc-sections,--relax $(SPECS) $(CPUOPTIONS) -T$(MCU_LD)
  112. # additional libraries to link
  113. LIBS = -larm_cortexM7lfsp_math -lm -lstdc++
  114. # names for the compiler programs
  115. CC = $(COMPILERPATH)/arm-none-eabi-gcc
  116. CXX = $(COMPILERPATH)/arm-none-eabi-g++
  117. OBJCOPY = $(COMPILERPATH)/arm-none-eabi-objcopy
  118. SIZE = $(COMPILERPATH)/arm-none-eabi-size
  119. # automatically create lists of the sources and objects
  120. # TODO: this does not handle Arduino libraries yet...
  121. C_FILES := $(wildcard *.c)
  122. CPP_FILES := $(wildcard *.cpp)
  123. OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
  124. # the actual makefile rules (all .o files built by GNU make's default implicit rules)
  125. all: $(TARGET).hex
  126. $(TARGET).elf: $(OBJS) $(MCU_LD)
  127. $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  128. %.hex: %.elf
  129. $(SIZE) $<
  130. $(OBJCOPY) -O ihex -R .eeprom $< $@
  131. ifneq (,$(wildcard $(TOOLSPATH)))
  132. $(TOOLSPATH)/teensy_post_compile -file=$(basename $@) -path=$(shell pwd) -tools=$(TOOLSPATH)
  133. -$(TOOLSPATH)/teensy_reboot
  134. endif
  135. # compiler generated dependency info
  136. -include $(OBJS:.o=.d)
  137. clean:
  138. rm -f *.o *.d $(TARGET).elf $(TARGET).hex