diff options
author | alexander <alexander.efremov@arm.com> | 2021-03-26 21:42:19 +0000 |
---|---|---|
committer | Kshitij Sisodia <kshitij.sisodia@arm.com> | 2021-03-29 16:29:55 +0100 |
commit | 3c79893217bc632c9b0efa815091bef3c779490c (patch) | |
tree | ad06b444557eb8124652b45621d736fa1b92f65d /scripts/cmake/cmsis-dsp.cmake | |
parent | 6ad6d55715928de72979b04194da1bdf04a4c51b (diff) | |
download | ml-embedded-evaluation-kit-21.03.tar.gz |
Opensource ML embedded evaluation kit21.03
Change-Id: I12e807f19f5cacad7cef82572b6dd48252fd61fd
Diffstat (limited to 'scripts/cmake/cmsis-dsp.cmake')
-rw-r--r-- | scripts/cmake/cmsis-dsp.cmake | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/scripts/cmake/cmsis-dsp.cmake b/scripts/cmake/cmsis-dsp.cmake new file mode 100644 index 0000000..cb0243b --- /dev/null +++ b/scripts/cmake/cmsis-dsp.cmake @@ -0,0 +1,74 @@ +#---------------------------------------------------------------------------- +# Copyright (c) 2021 Arm Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#---------------------------------------------------------------------------- + +# CMSIS-DSP library CMake helper script. + +# 1. We should be cross-compiling (non-native target) +if (TARGET_PLATFORM STREQUAL native) + message(FATAL_ERROR "No CMSIS-DSP support for native target.") +endif() + +# 2. Check if CMSIS sources have been defined +if (NOT DEFINED CMSIS_SRC_PATH) + message(FATAL_ERROR "CMSIS path should be defined for CMSIS-DSP library to be built") +endif() + +# 3. Form a list of all the sources we need in CSMS-DSP library +set(CMSIS_DSP_PATH_SUFFIX "CMSIS/DSP") +set(CMSIS_CORE_PATH_SUFFIX "CMSIS/Core") +set(CMSIS_DSP_SRC_DIR "${CMSIS_SRC_PATH}/${CMSIS_DSP_PATH_SUFFIX}/Source") +set(CMSIS_DSP_INC_DIR "${CMSIS_SRC_PATH}/${CMSIS_DSP_PATH_SUFFIX}/Include") +set(CMSIS_DSP_PRI_INC_DIR "${CMSIS_SRC_PATH}/${CMSIS_DSP_PATH_SUFFIX}/PrivateInclude") +set(CMSIS_CORE_INC_DIR "${CMSIS_SRC_PATH}/${CMSIS_CORE_PATH_SUFFIX}/Include") + +file(GLOB_RECURSE + CMSIS_DSP_SRC + "${CMSIS_DSP_SRC_DIR}/arm_*.c") + +# 4. Create static library +set(CMSIS_DSP_TARGET cmsis-dsp) + +add_library(${CMSIS_DSP_TARGET} STATIC ${CMSIS_DSP_SRC}) + +target_include_directories(${CMSIS_DSP_TARGET} PUBLIC + ${CMSIS_DSP_INC_DIR} + ${CMSIS_CORE_INC_DIR}) +target_include_directories(${CMSIS_DSP_TARGET} PRIVATE + ${CMSIS_DSP_PRI_INC_DIR}) + +# 5. Add any custom/conditional flags for compilation or linkage +if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL cortex-m55) + target_compile_definitions(${CMSIS_DSP_TARGET} PUBLIC + ARM_MATH_MVEI + ARM_MATH_DSP + ARM_MATH_LOOPUNROLL) +elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL cortex-m33) + # Placeholder, if building with Cortex-M33 +endif() + + +# 6. Provide the library path for the top level CMake to use: +set(CMSIS_DSP_LIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${CMSIS_DSP_TARGET}.a") +message(STATUS "CMSIS_DSP_LIB set to be generated here: ${CMSIS_DSP_LIB}") + +message(STATUS "CMAKE_CURRENT_SOURCE_DIR: " ${CMAKE_CURRENT_SOURCE_DIR}) +message(STATUS "*******************************************************") +message(STATUS "Library : " ${CMSIS_DSP_TARGET}) +message(STATUS "Build type : " ${CMAKE_BUILD_TYPE}) +message(STATUS "TARGET_PLATFORM : " ${TARGET_PLATFORM}) +message(STATUS "CMAKE_SYSTEM_PROCESSOR : " ${CMAKE_SYSTEM_PROCESSOR}) +message(STATUS "*******************************************************") |