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