From a248b071b36f8a65d84d4e5501976c716afb768a Mon Sep 17 00:00:00 2001 From: Christophe Favergeon Date: Tue, 14 Jun 2022 07:57:39 +0200 Subject: [PATCH] Improved SDF documentation and updated for new cmake files. New repository of CMSIS-DSP is now referring to the outside CMSIS Core include folder. SDF examples had to be modified to support this. --- README.md | 9 +++++-- SDFTools/README.md | 38 +++++++++++++++++++++++++----- SDFTools/examples/CMakeLists.txt | 7 +++--- SDFTools/examples/build/create.bat | 2 +- SDFTools/examples/build/create.sh | 2 +- 5 files changed, 45 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e3cbe926..86082cdb 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # CMSIS-DSP +[![Version](https://img.shields.io/github/v/release/arm-software/CMSIS-DSP)](https://github.com/ARM-software/CMSIS-DSP/releases/latest) [![License](https://img.shields.io/github/license/ARM-software/CMSIS-DSP)](https://github.com/ARM-software/CMSIS-DSP) + + ## About CMSIS-DSP is an optimized compute library for embedded systems (DSP is in the name for legacy reasons). @@ -8,6 +11,8 @@ It provides optimized compute kernels for Cortex-M and for Cortex-A. On Cortex-M, different variants are available according to the core and most of the functions are using a vectorized version when the Helium extension is available. +[Documentation](https://arm-software.github.io/CMSIS_5/DSP/html/index.html) is available as part of [CMSIS](https://github.com/ARM-software/CMSIS_5) repository. + ### Kernels Kernels provided by CMSIS-DSP (list not exhaustive): @@ -32,7 +37,7 @@ The goal is to make it easier to move from a design to a final implementation in ### Synchronous Data Flow -CMSIS-DSP is also providing an experimental synchronous data flow scheduler: +CMSIS-DSP is also providing an experimental [synchronous data flow scheduler](SDFTools/README.md): * You define your compute graph in Python * A static schedule (computed by the Python script is generated) @@ -120,7 +125,7 @@ include(configLib) configLib(CMSISDSP) ``` -A typical `cmake` command may be: +A typical `cmake` command (when using CMSIS-DSP test framework) may be: ``` cmake -DCMAKE_PREFIX_PATH="path to compiler" \ diff --git a/SDFTools/README.md b/SDFTools/README.md index d24ea4d3..ff2a5723 100755 --- a/SDFTools/README.md +++ b/SDFTools/README.md @@ -22,7 +22,7 @@ In blue, the amount of samples generated or consumed by a node each time it is c When the processing is applied to a stream of samples then the problem to solve is : -**how the blocks must be scheduled and the FIFOs connecting the block dimensioned** +> **how the blocks must be scheduled and the FIFOs connecting the block dimensioned** The general problem can be very difficult. But, if some constraints are applied to the graph then some algorithms can compute a static schedule. @@ -87,7 +87,7 @@ The schedule is (the size of the FIFOs after the execution of the node displayed At the end, both FIFOs are empty so the schedule can be run again : it is periodic ! -## How to build the examples +## How to use the Synchronous Data Flow (SDF) First, you must install the `CMSIS-DSP` PythonWrapper: @@ -95,16 +95,42 @@ First, you must install the `CMSIS-DSP` PythonWrapper: pip install cmsisdsp ``` +The script inside the cmsisdsp wrapper can be used to describe and generate the schedule. + +You can create a `graph.py` and include : + +```python +from cmsisdsp.sdf.scheduler import * +``` + +Then you can describe the blocks that you need in the compute graph if they are not provided by the SDF. + +Finally, you can execute `graph.py` to generate the C++ files. + +Those files need to include the `sdf/src/GenericNodes.h` and the nodes used in the graph and which can be found in `sdf/nodes/cpp`. + +If you have declared new nodes in `graph.py` then you'll need to provide an implementation. + +More details and explanations can be found in the documentation for the examples: + +* [Example 1](documentation/example1.md) +* [Example 2](documentation/example2.md) +* [Example 3](documentation/example3.md) +* [Example 4](documentation/example4.md) + +### How to build the examples + In folder `SDFTools/example/build`, type the `cmake` command: ```bash -cmake -DHOST=YES -DDOT="path to dot tool" -DCMSIS="path to cmsis" -G "Unix Makefiles" .. +cmake -DHOST=YES \ + -DDOT="path to dot.EXE" \ + -DCMSISCORE="path to cmsis core include directory" \ + -G "Unix Makefiles" .. ``` The Graphviz dot tool is requiring a recent version supporting the HTML-like labels. -The path to cmsis must be the root folder containing CMSIS and Device folders. - If cmake is successful, you can type `make` to build the examples. It will also build CMSIS-DSP for the host. If you don't have graphviz, the option -DDOT can be removed. @@ -126,7 +152,7 @@ To build the C examples: * the .cpp file contained in the example must be built * the include folder `sdf/src` must be added -For `example3` which is using an input file, cmake should have copied the input test pattern `input_example3.txt` inside the build folder. The output file will also be generated in the build folder. +For `example3` which is using an input file, `cmake` should have copied the input test pattern `input_example3.txt` inside the build folder. The output file will also be generated in the build folder. `example4` is like `example3` but in pure Python and using the CMSIS-DSP Python wrapper (which must already be installed before trying the example). `example4` is not built by the cmake. You'll need to go to the `example4` folder and type: diff --git a/SDFTools/examples/CMakeLists.txt b/SDFTools/examples/CMakeLists.txt index 9642067e..e0ac9db5 100755 --- a/SDFTools/examples/CMakeLists.txt +++ b/SDFTools/examples/CMakeLists.txt @@ -28,16 +28,17 @@ endfunction() set(SDFDIR ${CMAKE_CURRENT_SOURCE_DIR}/../sdf) +set(DSP ${CMAKE_CURRENT_SOURCE_DIR}/../..) + function(add_sdf_dir TARGET) target_include_directories(${TARGET} PRIVATE ${SDFDIR}/src) target_include_directories(${TARGET} PRIVATE ${SDFDIR}/nodes/cpp) - target_include_directories(${TARGET} PRIVATE ${ROOT}/CMSIS/Core) - target_include_directories(${TARGET} PRIVATE ${ROOT}/CMSIS/DSP/Include) + target_include_directories(${TARGET} PRIVATE ${CMSISCORE}) + target_include_directories(${TARGET} PRIVATE ${DSP}/Include) endfunction() project(Examples) -set(DSP ${ROOT}/CMSIS/DSP) # Add DSP folder to module path list(APPEND CMAKE_MODULE_PATH ${DSP}) diff --git a/SDFTools/examples/build/create.bat b/SDFTools/examples/build/create.bat index be11dd3c..1e167b9f 100755 --- a/SDFTools/examples/build/create.bat +++ b/SDFTools/examples/build/create.bat @@ -1,4 +1,4 @@ cmake -DHOST=YES ^ -DDOT="path to dot.EXE" ^ - -DROOT="path to cmsis" ^ + -DCMSISCORE="path to cmsis core" ^ -G "Unix Makefiles" .. \ No newline at end of file diff --git a/SDFTools/examples/build/create.sh b/SDFTools/examples/build/create.sh index ab181e68..ae2c2480 100755 --- a/SDFTools/examples/build/create.sh +++ b/SDFTools/examples/build/create.sh @@ -1,4 +1,4 @@ cmake -DHOST=YES \ -DDOT="path to dot.EXE" \ - -DCMSIS="path to cmsis" \ + -DCMSISCORE="path to cmsis core" \ -G "Unix Makefiles" .. \ No newline at end of file