blob: ed24432ddf14a89f23a42828be2d53c0cf8206e1 [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
Christophe Favergeone0181322019-05-20 13:25:14 +020016function(configdsp PROJECTNAME DSP)
17 target_compile_options(${PROJECTNAME} PUBLIC "-mfloat-abi=hard;-mlittle-endian")
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020018
Christophe Favergeone0181322019-05-20 13:25:14 +020019 if (CONFIGTABLE)
20 # Public because initialization for FFT may be defined in client code
21 # and needs access to the table.
22 target_compile_definitions(${PROJECTNAME} PUBLIC ARM_DSP_CONFIG_TABLES)
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020023 endif()
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020024
Christophe Favergeone0181322019-05-20 13:25:14 +020025 if (FASTMATH)
26 target_compile_options(${PROJECTNAME} PUBLIC "-ffast-math")
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020027 endif()
Christophe Favergeone0181322019-05-20 13:25:14 +020028
29 if (LOOPUNROLL)
30 target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_LOOPUNROLL)
31 endif()
32
33 if (ROUNDING)
34 target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_ROUNDING)
35 endif()
36
37 if (MATRIXCHECK)
38 target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_MATRIX_CHECK)
39 endif()
40
41
42 ###################
43 #
44 # CORTEX-A
45 #
46
47 # CORTEX-A9
48 if (ARM_CPU STREQUAL "cortex-a9" )
49 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core_A/Include")
50 SET(CORTEXM OFF)
51
52 if (NOT (NEON OR NEONEXPERIMENTAL))
53 target_compile_options(${PROJECTNAME} PUBLIC "-mfpu=vfpv3-d16-fp16")
54 endif()
55
56 endif()
57
58 # CORTEX-A7
59 if (ARM_CPU STREQUAL "cortex-a7" )
60 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core_A/Include")
61 SET(CORTEXM OFF)
62
63 if (NOT (NEON OR NEONEXPERIMENTAL))
64 target_compile_options(${PROJECTNAME} PUBLIC "-mfpu=vfpv4-d16")
65 endif()
66
67 endif()
68
69 # CORTEX-A5
70 if (ARM_CPU STREQUAL "cortex-a5" )
71 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core_A/Include")
72 SET(CORTEXM OFF)
73
74 if ((NEON OR NEONEXPERIMENTAL))
75 target_compile_options(${PROJECTNAME} PUBLIC "-mfpu=neon-vfpv4")
76 else()
77 target_compile_options(${PROJECTNAME} PUBLIC "-mfpu=vfpv4-d16")
78 endif()
79 endif()
80
81
82 ###################
83 #
84 # CORTEX-M
85 #
86
87 # CORTEX-M35
88 if (ARM_CPU STREQUAL "cortex-m35")
89 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
90 endif()
91
92 # CORTEX-M33
93 if (ARM_CPU STREQUAL "cortex-m33")
94 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
95 endif()
96
97 # CORTEX-M23
98 if (ARM_CPU STREQUAL "cortex-m23")
99 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
100 endif()
101
102 # CORTEX-M7
103 if (ARM_CPU STREQUAL "cortex-m7")
104 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
105 endif()
106
107 # CORTEX-M4
108 if (ARM_CPU STREQUAL "cortex-m4")
109 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
110
111 endif()
112
113 # CORTEX-M3
114 if (ARM_CPU STREQUAL "cortex-m3")
115 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
116 endif()
117
118 # CORTEX-M0plus
119 if (ARM_CPU STREQUAL "cortex-m0p")
120 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
121 endif()
122
123 # CORTEX-M0
124 if (ARM_CPU STREQUAL "cortex-m0")
125 target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
126 endif()
127
128 ###################
129 #
130 # FEATURES
131 #
132
133 if (NEON AND NOT CORTEXM)
134 target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_NEON __FPU_PRESENT)
135 endif()
136
137 if (NEONEXPERIMENTAL AND NOT CORTEXM)
138 target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_NEON_EXPERIMENTAL __FPU_PRESENT)
139 endif()
140endfunction()