Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
.github/ | 18-Mar-2025 | - | 304 | 236 | ||
ComputeLibrary/ | 18-Mar-2025 | - | 593 | 284 | ||
Documentation/ | 18-Mar-2025 | - | 7,791 | 6,152 | ||
Examples/ | 18-Mar-2025 | - | 81,912 | 65,370 | ||
Include/ | 18-Mar-2025 | - | 17,979 | 7,782 | ||
PrivateInclude/ | 18-Mar-2025 | - | 2,114 | 1,807 | ||
PythonWrapper/ | 18-Mar-2025 | - | 35,512 | 25,571 | ||
Scripts/ | 18-Mar-2025 | - | 1,174 | 822 | ||
Source/ | 18-Mar-2025 | - | 257,268 | 167,787 | ||
Testing/ | 18-Mar-2025 | - | 4,762,084 | 4,725,644 | ||
cmsisdsp/ | 18-Mar-2025 | - | 309 | 225 | ||
dsppp/ | 18-Mar-2025 | - | 38,876 | 24,756 | ||
zephyr/ | 18-Mar-2025 | - | 8 | 4 | ||
.gitignore | D | 18-Mar-2025 | 1 KiB | 44 | 41 | |
ARM.CMSIS-DSP.pdsc | D | 18-Mar-2025 | 12.5 KiB | 288 | 249 | |
CMakeLists.txt | D | 18-Mar-2025 | 502 | 10 | 8 | |
LICENSE | D | 18-Mar-2025 | 11.1 KiB | 202 | 169 | |
MANIFEST.in | D | 18-Mar-2025 | 221 | 7 | 5 | |
PythonWrapper_README.md | D | 18-Mar-2025 | 12.1 KiB | 292 | 160 | |
README.md | D | 18-Mar-2025 | 12 KiB | 281 | 173 | |
gen_pack.sh | D | 18-Mar-2025 | 2.5 KiB | 121 | 37 | |
pyproject.toml | D | 18-Mar-2025 | 126 | 9 | 7 | |
setup.py | D | 18-Mar-2025 | 9.2 KiB | 218 | 175 | |
vcpkg-configuration.json | D | 18-Mar-2025 | 514 | 21 | 19 |
README.md
1# CMSIS-DSP 2 3  4 5 6## About 7 8CMSIS-DSP is an optimized compute library for embedded systems (DSP is in the name for legacy reasons). 9 10It provides optimized compute kernels for Cortex-M and for Cortex-A. 11 12Different variants are available according to the core and most of the functions are using a vectorized version when the Helium or Neon extension is available. 13 14This repository contains the CMSIS-DSP library and several other projects: 15 16* Test framework for bare metal Cortex-M or Cortex-A 17* Examples for bare metal Cortex-M 18* ComputeGraph 19* PythonWrapper 20 21You don't need any of the other projects to build and use CMSIS-DSP library. Building the other projects may require installation of other libraries (CMSIS), other tools (Arm Virtual Hardware) or CMSIS build tools. 22 23### License Terms 24 25CMSIS-DSP is licensed under [Apache License 2.0](LICENSE). 26 27### CMSIS-DSP Kernels 28 29Kernels provided by CMSIS-DSP (list not exhaustive): 30 31* Basic mathematics (real, complex, quaternion, linear algebra, fast math functions) 32* DSP (filtering) 33* Transforms (FFT, MFCC, DCT) 34* Statistics 35* Classical ML (Support Vector Machine, Distance functions for clustering ...) 36 37Kernels are provided with several datatypes : f64, f32, f16, q31, q15, q7. 38 39### Python wrapper 40 41A [PythonWrapper](https://pypi.org/project/cmsisdsp/) is also available and can be installed with: 42 43`pip install cmsisdsp` 44 45With this wrapper you can design your algorithm in Python using an API as close as possible to the C API. The wrapper is compatible with NumPy. The wrapper is supporting fixed point arithmetic. This wrapper works in google colab. 46 47The goal is to make it easier to move from a design to a final implementation in C. 48 49## Support / Contact 50 51For any questions or to reach the CMSIS-DSP team, please create a new issue in https://github.com/ARM-software/CMSIS-DSP/issues 52 53## Table of content 54 55* [Building for speed](#building-for-speed) 56 * [Options to use](#options-to-use) 57 * [Options to avoid](#options-to-avoid) 58* [Half float support](#half-float-support) 59* [How to build](#how-to-build) 60 * [How to build with MDK or Open CMSIS-Pack](#how-to-build-with-mdk-or-open-cmsis-pack) 61 * [How to build with Make](#how-to-build-with-make) 62 * [How to build with cmake](#how-to-build-with-cmake) 63 * [How to build with any other build system](#how-to-build-with-any-other-build-system) 64 * [How to build for aarch64](#how-to-build-for-aarch64) 65* [Code size](#code-size) 66* [Folders and files](#folders-and-files) 67 * [Folders](#folders) 68 * [Files](#files) 69 70## Building for speed 71 72CMSIS-DSP is used when you need performance. As consequence CMSIS-DSP should be compiled with the options giving the best performance: 73 74### Options to use 75 76* `-Ofast` must be used for best performances. 77* When using Helium it is strongly advised to use `-Ofast` 78* `GCC` is currently not giving good performances when targeting Helium. You should use the Arm compiler 79 80When float are used, then the fpu should be selected to ensure that the compiler is not using a software float emulation. 81 82When building with Helium support, it will be automatically detected by CMSIS-DSP. For Neon, it is not the case and you must enable the option `-DARM_MATH_NEON` for the C compilation. With `cmake` this option is controlled with `-DNEON=ON`. 83 84* `-DLOOPUNROLL=ON` can also be used when compiling with cmake 85* It corresponds to the C options `-DARM_MATH_LOOPUNROLL` 86 87Compilers are doing unrolling. So this option may not be needed but it is highly dependent on the compiler. With some compilers, this option is needed to get better performances. 88 89Speed of memory is important. If you can map the data and the constant tables used by CMSIS-DSP in `DTCM` memory then it is better. If you have a cache, enable it. 90 91### Options to avoid 92 93* `-fno-builtin` 94* `-ffreestanding` because it enables previous options 95 96The library is doing some type [punning](https://en.wikipedia.org/wiki/Type_punning) to process word 32 from memory as a pair of `q15` or a quadruple of `q7`. Those type manipulations are done through `memcpy` functions. Most compilers should be able to optimize out those function calls when the length to copy is small (4 bytes). 97 98This optimization will **not** occur when `-fno-builtin` is used and it will have a **very bad** impact on the performances. 99 100Some compiler may also require the use of option `-munaligned-access` to specify that unaligned accesses are used. 101 102## Half float support 103 104`f16` data type (half float) has been added to the library. It is useful only if your Cortex has some half float hardware acceleration (for instance with Helium extension). If you don't need `f16`, you should disable it since it may cause compilation problems. Just define `-DDISABLEFLOAT16` when building. 105 106## How to build 107 108You can build CMSIS-DSP with the open CMSIS-Pack, or cmake, or Makefile and it is also easy to build if you use any other build tool. 109 110### How to build with MDK or Open CMSIS-Pack 111 112The standard way to build is by using the CMSIS pack technology. CMSIS-DSP is available as a pack. 113 114This pack technology is supported by some IDE like [Keil MDK](https://www.keil.com/download/product/) or [Keil studio](https://www.keil.arm.com/). 115 116You can also use those packs using the [Open CMSIS-Pack](https://www.open-cmsis-pack.org/) technology and from command line on any platform. 117 118You should first install the tools from https://github.com/Open-CMSIS-Pack/devtools/tree/main/tools 119 120You can get the CMSIS-Toolbox which is containing the package installer, cmsis build and cmsis project manager. Here is some documentation: 121 122* Documentation about [CMSIS Build](https://open-cmsis-pack.github.io/devtools/buildmgr/latest/index.html) 123* Documentation about [CMSIS Pack](https://open-cmsis-pack.github.io/Open-CMSIS-Pack-Spec/main/html/index.html) 124* Documentation about [CMSIS Project manager](https://github.com/Open-CMSIS-Pack/devtools/blob/main/tools/projmgr/docs/Manual/Overview.md) 125 126Once you have installed the tools, you'll need to download the pack index using the `cpackget` tool. 127 128Then, you'll need to convert a solution file into `.cprj`. For instance, for the CMSIS-DSP Examples, you can go to: 129 130`Examples/cmsis_build` 131 132and then type 133 134`csolution convert -s examples.csolution_ac6.yml` 135 136This command processes the `examples.csolution_ac6.yml` describing how to build the examples for several platforms. It will generate lots of `.cprj` files that can be built with `cbuild`. 137 138If you want to build the `FFT` example for the `Corstone-300` virtual hardware platform, you could just do: 139 140`cbuild "fftbin.Release+VHT-Corstone-300.cprj"` 141 142### How to build with Make 143 144There is an example `Makefile` in `Source`. 145 146In each source folder (like `BasicMathFunctions`), you'll see files with no `_datatype` suffix (like `BasicMathFunctions.c` and `BasicMathFunctionsF16.c`). 147 148Those files are all you need in your makefile. They are including all other C files from the source folders. 149 150Then, for the includes you'll need to add the paths: `Include`, `PrivateInclude` and, since there is a dependency to CMSIS Core, `Core/Include` from `CMSIS_5/CMSIS`. 151 152If you are building for `Cortex-A` and want to use Neon, you'll also need to include `ComputeLibrary/Include` and the source file in `ComputeLibrary/Source`. 153 154### How to build with cmake 155 156Create a `CMakeLists.txt` and inside add a project. 157 158Add CMSIS-DSP as a subdirectory. The variable `CMSISDSP` is the path to the CMSIS-DSP repository in below example. 159 160```cmake 161cmake_minimum_required (VERSION 3.14) 162 163# Define the project 164project (testcmsisdsp VERSION 0.1) 165 166add_subdirectory(${CMSISDSP}/Source bin_dsp) 167``` 168 169CMSIS-DSP is dependent on the CMSIS Core includes. So, you should define `CMSISCORE` on the cmake command line. The path used by CMSIS-DSP will be `${CMSISCORE}/Include`. 170 171You should also set the compilation options to use to build the library. 172 173If you build for Helium, you should use any of the option `MVEF`, `MVEI` or `HELIUM`. 174 175If you build for Neon, use `NEON` and/or `NEONEXPERIMENTAL`. 176 177#### Launching the build 178 179Once cmake has generated the makefiles, you can use a GNU Make to build. 180 181 make VERBOSE=1 182 183### How to build with any other build system 184 185You need the following folders: 186 187* Source 188* Include 189* PrivateInclude 190* ComputeLibrary (only if you target Neon) 191 192In `Source` subfolders, you may either build all of the source file with a datatype suffix (like `_f32.c`), or just compile the files without a datatype suffix. For instance for `BasicMathFunctions`, you can build all the C files except `BasicMathFunctions.c` and `BasicMathFunctionsF16.c`, or you can just build those two files (they are including all of the other C files of the folder). 193 194`f16` files are not mandatory. You can build with `-DDISABLEFLOAT16` 195 196### How to build for aarch64 197 198The intrinsics defined in `Core_A/Include` are not available on recent Cortex-A processors. 199 200But you can still build for those Cortex-A cores and benefit from the Neon intrinsics. 201 202You need to build with `-D__GNUC_PYTHON__` on the compiler command line. This flag was introduced for building the Python wrapper and is disabling the use of CMSIS Core includes. 203 204When this flag is enabled, CMSIS-DSP is defining a few macros used in the library for compiler portability: 205 206```C 207#define __ALIGNED(x) __attribute__((aligned(x))) 208#define __STATIC_FORCEINLINE static inline __attribute__((always_inline)) 209#define __STATIC_INLINE static inline 210``` 211 212If the compiler you are using is requiring different definitions, you can add them to `arm_math_types.h` in the `Include` folder of the library. MSVC and XCode are already supported and in those case, you don't need to define `-D__GNUC_PYTHON__` 213 214Then, you need to define `-DARM_MATH_NEON` 215 216For cmake the equivalent options are: 217 218* `-DHOST=ON` 219* `-DNEON=ON` 220 221cmake is automatically including the `ComputeLibrary` folder. If you are using a different build, you need to include this folder too to build with Neon support. 222 223## Code size 224 225Previous versions of the library were using compilation directives to control the code size. It was too complex and not available in case CMSIS-DSP is only delivered as a static library. 226 227Now, the library relies again on the linker to do the code size optimization. But, this implies some constraints on the code you write and new functions had to be introduced. 228 229If you know the size of your FFT in advance, use initializations functions like `arm_cfft_init_64_f32` instead of using the generic initialization functions `arm_cfft_init_f32`. Using the generic function will prevent the linker from being able to deduce which functions and tables must be kept for the FFT and everything will be included. 230 231There are similar functions for RFFT, MFCC ... 232 233If the flag `ARM_DSP_CONFIG_TABLES` is still set, you'll now get a compilation error to remind you that this flag no more have any effect on code size and that you may have to rework the initializations. 234 235## Folders and files 236 237The only folders required to build and use CMSIS-DSP Library are: 238 239* Source 240* Include 241* PrivateInclude 242* ComputeLibrary (only when using Neon) 243 244Other folders are part of different projects, tests or examples. 245 246### Folders 247 248* cmsisdsp 249 * Required to build the CMSIS-DSP PythonWrapper for the Python repository 250 * It contains all Python packages 251* ComputeLibrary: 252 * Some kernels required when building CMSIS-DSP with Neon acceleration 253* Examples: 254 * Examples of use of CMSIS-DSP on bare metal Cortex-M 255 * Require the use of CMSIS Build tools 256* Include: 257 * Include files for CMSIS-DSP 258* PrivateInclude: 259 * Some include needed to build CMSIS-DSP 260* PythonWrapper: 261 * C code for the CMSIS-DSP PythonWrapper 262 * Examples for the PythonWrapper 263* Scripts: 264 * Debugging scripts 265 * Script to generate some coefficient tables used by CMSIS-DSP 266* Source: 267 * CMSIS-DSP source 268* Testing: 269 * CMSIS-DSP Test framework for bare metal Cortex-M and Cortex-A 270 * Require the use of CMSIS build tools 271 272### Files 273 274Some files are needed to generate the PythonWrapper: 275 276* PythonWrapper_README.md 277* LICENSE 278* MANIFEST.in 279* pyproject.toml 280* setup.py 281