Teensy 4.1 core updated for C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.5KB

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