Teensy 4.1 core updated for C++20
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

89 lines
2.7KB

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