summaryrefslogtreecommitdiff
path: root/DSP/config.cmake
blob: b6c84bed2872ff3f8f427ce3309eb6cfddcaac3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
include(CMakePrintHelpers)
cmake_policy(SET CMP0077 NEW)

SET(CORTEXM ON)
option(FASTMATHCOMPUTATIONS "Fast Math enabled" ON)
option(NEON "Neon acceleration" OFF)
option(NEONEXPERIMENTAL "Neon experimental acceleration" OFF)
option(LOOPUNROLL "Loop unrolling" ON)
option(ROUNDING "Rounding" OFF)
option(MATRIXCHECK "Matrix Checks" OFF)

###################
#
# ALL CORTEX
#

function(configdsp PROJECTNAME DSP)
  target_compile_options(${PROJECTNAME} PUBLIC "-mfloat-abi=hard;-mlittle-endian")

  if (CONFIGTABLE)
      # Public because initialization for FFT may be defined in client code 
      # and needs access to the table.
      target_compile_definitions(${PROJECTNAME} PUBLIC ARM_DSP_CONFIG_TABLES)
  endif()
  
  if (FASTMATHCOMPUTATIONS)
    target_compile_options(${PROJECTNAME} PUBLIC "-ffast-math")
  endif()
  
  if (LOOPUNROLL)
    target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_LOOPUNROLL)
  endif()
  
  if (ROUNDING)
    target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_ROUNDING)
  endif()
  
  if (MATRIXCHECK)
    target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_MATRIX_CHECK)
  endif()
  
  
  ###################
  #
  # CORTEX-A
  #
  
  # CORTEX-A9
  if (ARM_CPU STREQUAL "cortex-a9" )
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core_A/Include")
    SET(CORTEXM OFF)
  
    if (NOT (NEON OR NEONEXPERIMENTAL))
      target_compile_options(${PROJECTNAME} PUBLIC "-mfpu=vfpv3-d16-fp16")
    endif()
  
  endif()
  
  # CORTEX-A7
  if (ARM_CPU STREQUAL "cortex-a7" )
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core_A/Include")
    SET(CORTEXM OFF)
  
    if (NOT (NEON OR NEONEXPERIMENTAL))
      target_compile_options(${PROJECTNAME} PUBLIC "-mfpu=vfpv4-d16")
    endif()
  
  endif()
  
  # CORTEX-A5
  if (ARM_CPU STREQUAL "cortex-a5" )
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core_A/Include")
    SET(CORTEXM OFF)
    
    if ((NEON OR NEONEXPERIMENTAL))
      target_compile_options(${PROJECTNAME} PUBLIC "-mfpu=neon-vfpv4")
    else()
      target_compile_options(${PROJECTNAME} PUBLIC "-mfpu=vfpv4-d16")
    endif()
  endif()
  
  
  ###################
  #
  # CORTEX-M
  #
  
  # CORTEX-M35
  if (ARM_CPU STREQUAL "cortex-m35")
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
  endif()
  
  # CORTEX-M33
  if (ARM_CPU STREQUAL "cortex-m33")
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
  endif()
  
  # CORTEX-M23
  if (ARM_CPU STREQUAL "cortex-m23")
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
  endif()
  
  # CORTEX-M7
  if (ARM_CPU STREQUAL "cortex-m7")
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")  
  endif()
  
  # CORTEX-M4
  if (ARM_CPU STREQUAL "cortex-m4")
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
  
  endif()
  
  # CORTEX-M3
  if (ARM_CPU STREQUAL "cortex-m3")
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
  endif()
  
  # CORTEX-M0plus
  if (ARM_CPU STREQUAL "cortex-m0p")
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
  endif()
  
  # CORTEX-M0
  if (ARM_CPU STREQUAL "cortex-m0")
    target_include_directories(${PROJECTNAME} PUBLIC "${DSP}/../../Core/Include")
  endif()
  
  ###################
  #
  # FEATURES
  #
    
  if (NEON AND NOT CORTEXM)
    target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_NEON __FPU_PRESENT)
  endif()
  
  if (NEONEXPERIMENTAL AND NOT CORTEXM)
    target_compile_definitions(${PROJECTNAME} PRIVATE ARM_MATH_NEON_EXPERIMENTAL __FPU_PRESENT)
  endif()
endfunction()