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