Makefile 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # This is an example Makefile to show how to build the library
  2. COMPILER_ROOT =
  3. CMSIS_ROOT =
  4. # Compilation tools
  5. CC := $(COMPILER_ROOT)/ARMCompiler6.18/bin/armclang
  6. ARMAR := $(COMPILER_ROOT)/ARMCompiler6.18/bin/armar
  7. # Compilation flags (here for Cortex-M55)
  8. CFLAGS := -mcpu=cortex-m55 --target=arm-arm-none-eabi \
  9. -Wsign-compare \
  10. -Wdouble-promotion \
  11. -Ofast -ffast-math \
  12. -DNDEBUG \
  13. -Wall -Wextra -Werror \
  14. -fshort-enums -fshort-wchar \
  15. -mfloat-abi=hard
  16. # Path to CMSIS_5
  17. CMSIS_5 := $(CMSIS_ROOT)/CMSIS_5
  18. # Path to CMSIS_DSP
  19. CMSIS_DSP := $(CMSIS_ROOT)/CMSIS-DSP
  20. # Path to CMSIS Core includes for Cortex-M
  21. # For low end Cortex-A, use Core_A
  22. # For high end Cortex-A (aarch64), don't use CMSIS
  23. # Core Includes (Refer to the CMSIS-DSP README to
  24. # know how to build in that case)
  25. CMSIS_CORE_INCLUDES := $(CMSIS_5)/CMSIS/Core/Include
  26. # Sources
  27. SRCS := $(CMSIS_DSP)/Source/BasicMathFunctions/BasicMathFunctions.c \
  28. $(CMSIS_DSP)/Source/CommonTables/CommonTables.c \
  29. $(CMSIS_DSP)/Source/InterpolationFunctions/InterpolationFunctions.c \
  30. $(CMSIS_DSP)/Source/BayesFunctions/BayesFunctions.c \
  31. $(CMSIS_DSP)/Source/MatrixFunctions/MatrixFunctions.c \
  32. $(CMSIS_DSP)/Source/ComplexMathFunctions/ComplexMathFunctions.c \
  33. $(CMSIS_DSP)/Source/QuaternionMathFunctions/QuaternionMathFunctions.c \
  34. $(CMSIS_DSP)/Source/ControllerFunctions/ControllerFunctions.c \
  35. $(CMSIS_DSP)/Source/SVMFunctions/SVMFunctions.c \
  36. $(CMSIS_DSP)/Source/DistanceFunctions/DistanceFunctions.c \
  37. $(CMSIS_DSP)/Source/StatisticsFunctions/StatisticsFunctions.c \
  38. $(CMSIS_DSP)/Source/FastMathFunctions/FastMathFunctions.c \
  39. $(CMSIS_DSP)/Source/SupportFunctions/SupportFunctions.c \
  40. $(CMSIS_DSP)/Source/FilteringFunctions/FilteringFunctions.c \
  41. $(CMSIS_DSP)/Source/TransformFunctions/TransformFunctions.c \
  42. $(CMSIS_DSP)/Source/WindowFunctions/WindowFunctions.c
  43. # Includes
  44. DSP_INCLUDES := $(CMSIS_DSP)/Include \
  45. $(CMSIS_DSP)/PrivateInclude
  46. # If Neon and Cortex-A
  47. #DSP_INCLUDES += $(CMSIS_DSP)/ComputeLibrary/Include
  48. #SRCS += $(CMSIS_DSP)/ComputeLibrary/Source/arm_cl_tables.c
  49. # Compilation flags for include folders
  50. INC_FLAGS := $(addprefix -I,$(DSP_INCLUDES))
  51. INC_FLAGS += $(addprefix -I,$(CMSIS_CORE_INCLUDES))
  52. CFLAGS += $(INC_FLAGS)
  53. # Output folder for build products
  54. BUILDDIR := ./builddir
  55. OBJECTS := $(SRCS:%=$(BUILDDIR)/%.o)
  56. # Build rules
  57. $(BUILDDIR)/libCMSISDSP.a: $(OBJECTS)
  58. $(ARMAR) -rc $@ $(OBJECTS)
  59. $(BUILDDIR)/%.c.o: %.c
  60. mkdir -p $(dir $@)
  61. $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@