blob: e985fb47dfe2ecbc0b5df1dbf97e6d4f78b31b5b [file] [log] [blame]
Christophe Favergeon6b604eb2019-05-17 13:46:33 +02001include(CMakePrintHelpers)
2
3SET(CORTEXM ON)
4option(FASTMATH "Fast Math enabled" ON)
5option(NEON "Neon acceleration" OFF)
6option(NEONEXPERIMENTAL "Neon experimental acceleration" OFF)
7option(LOOPUNROLL "Loop unrolling" ON)
8option(ROUNDING "Rounding" OFF)
9option(MATRIXCHECK "Matrix Checks" OFF)
10
11###################
12#
13# ALL CORTEX
14#
15
16target_compile_options(CMSISDSP PUBLIC "-mfloat-abi=hard;-mlittle-endian")
17
18if (FASTMATH)
19 target_compile_options(CMSISDSP PUBLIC "-ffast-math")
20endif()
21
22if (LOOPUNROLL)
23 target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_LOOPUNROLL)
24endif()
25
26if (ROUNDING)
27 target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_ROUNDING)
28endif()
29
30if (MATRIXCHECK)
31 target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_MATRIX_CHECK)
32endif()
33
34
35###################
36#
37# CORTEX-A
38#
39
40# CORTEX-A9
41if (ARM_CPU STREQUAL "cortex-a9" )
42 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core_A/Include")
43 SET(CORTEXM OFF)
44
45 if (NOT (NEON OR NEONEXPERIMENTAL))
46 target_compile_options(CMSISDSP PUBLIC "-mfpu=vfpv3-d16-fp16")
47 endif()
48
49endif()
50
51# CORTEX-A7
52if (ARM_CPU STREQUAL "cortex-a7" )
53 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core_A/Include")
54 SET(CORTEXM OFF)
55
56 if (NOT (NEON OR NEONEXPERIMENTAL))
57 target_compile_options(CMSISDSP PUBLIC "-mfpu=vfpv4-d16")
58 endif()
59
60endif()
61
62# CORTEX-A5
63if (ARM_CPU STREQUAL "cortex-a5" )
64 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core_A/Include")
65 SET(CORTEXM OFF)
66
67 if ((NEON OR NEONEXPERIMENTAL))
68 target_compile_options(CMSISDSP PUBLIC "-mfpu=neon-vfpv4")
69 else()
70 target_compile_options(CMSISDSP PUBLIC "-mfpu=vfpv4-d16")
71 endif()
72endif()
73
74
75###################
76#
77# CORTEX-M
78#
79
80# CORTEX-M35
81if (ARM_CPU STREQUAL "cortex-m35")
82 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include")
83endif()
84
85# CORTEX-M33
86if (ARM_CPU STREQUAL "cortex-m33")
87 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include")
88endif()
89
90# CORTEX-M23
91if (ARM_CPU STREQUAL "cortex-m23")
92 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include")
93endif()
94
95# CORTEX-M7
96if (ARM_CPU STREQUAL "cortex-m7")
97 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include")
98endif()
99
100# CORTEX-M4
101if (ARM_CPU STREQUAL "cortex-m4")
102 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include")
103
104endif()
105
106# CORTEX-M3
107if (ARM_CPU STREQUAL "cortex-m3")
108 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include")
109endif()
110
111# CORTEX-M0plus
112if (ARM_CPU STREQUAL "cortex-m0p")
113 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include")
114endif()
115
116# CORTEX-M0
117if (ARM_CPU STREQUAL "cortex-m0")
118 target_include_directories(CMSISDSP PUBLIC "${DSP}/../../Core/Include")
119endif()
120
121###################
122#
123# FEATURES
124#
125
126
127
128if (NEON AND NOT CORTEXM)
129 target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_NEON __FPU_PRESENT)
130endif()
131
132if (NEONEXPERIMENTAL AND NOT CORTEXM)
133 target_compile_definitions(CMSISDSP PRIVATE ARM_MATH_NEON_EXPERIMENTAL __FPU_PRESENT)
134endif()