Skip to content

Commit

Permalink
[examples] Add CMSIS-DSP examples
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Jul 10, 2019
1 parent 552e0c2 commit 9cca259
Show file tree
Hide file tree
Showing 29 changed files with 453 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ make gdb

## Interesting Examples

We have a lot of examples, <!--examplecount-->178<!--/examplecount--> to be
We have a lot of examples, <!--examplecount-->189<!--/examplecount--> to be
exact, but here are some of our favorite examples for our supported development
boards:

Expand Down
27 changes: 27 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/class_marks/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#define main arm_cmsis_dsp_example
#define std var_std
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_class_marks_example/arm_class_marks_example_f32.c"
#undef main
#undef std

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
11 changes: 11 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/class_marks/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<library>
<extends>modm:nucleo-f429zi</extends>
<options>
<option name="modm:build:build.path">../../../../build/nucleo_f429zi/cmsis_dsp/class_marks</option>
</options>
<modules>
<module>modm:build:scons</module>
<module>modm:cmsis:dsp:matrix</module>
<module>modm:cmsis:dsp:statistics</module>
</modules>
</library>
30 changes: 30 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/convolution/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#define main arm_cmsis_dsp_example
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_convolution_example/math_helper.h"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_convolution_example/math_helper.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_convolution_example/arm_convolution_example_f32.c"
#undef main
#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
1 change: 1 addition & 0 deletions examples/nucleo_f429zi/cmsis_dsp/convolution/math_helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Empty file to satisfy CPP
12 changes: 12 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/convolution/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<library>
<extends>modm:nucleo-f429zi</extends>
<options>
<option name="modm:build:build.path">../../../../build/nucleo_f429zi/cmsis_dsp/convolution</option>
</options>
<modules>
<module>modm:build:scons</module>
<module>modm:cmsis:dsp:transform</module>
<module>modm:cmsis:dsp:support</module>
<module>modm:cmsis:dsp:complex_math</module>
</modules>
</library>
25 changes: 25 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/dotproduct/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#define main arm_cmsis_dsp_example
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_dotproduct_example/arm_dotproduct_example_f32.c"
#undef main

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
11 changes: 11 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/dotproduct/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<library>
<extends>modm:nucleo-f429zi</extends>
<options>
<option name="modm:build:build.path">../../../../build/nucleo_f429zi/cmsis_dsp/dotproduct</option>
</options>
<modules>
<module>modm:build:scons</module>
<module>modm:cmsis:dsp:transform</module>
<module>modm:cmsis:dsp:basic_math</module>
</modules>
</library>
26 changes: 26 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/fft_bin/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#define main arm_cmsis_dsp_example
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_fft_bin_example/arm_fft_bin_data.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_fft_bin_example/arm_fft_bin_example_f32.c"
#undef main

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
12 changes: 12 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/fft_bin/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<library>
<extends>modm:nucleo-f429zi</extends>
<options>
<option name="modm:build:build.path">../../../../build/nucleo_f429zi/cmsis_dsp/fft_bin</option>
</options>
<modules>
<module>modm:build:scons</module>
<module>modm:cmsis:dsp:transform</module>
<module>modm:cmsis:dsp:complex_math</module>
<module>modm:cmsis:dsp:statistics</module>
</modules>
</library>
31 changes: 31 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/fir/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#define main arm_cmsis_dsp_example
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_fir_example/math_helper.h"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_fir_example/math_helper.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_fir_example/arm_fir_data.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_fir_example/arm_fir_example_f32.c"
#undef main
#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
1 change: 1 addition & 0 deletions examples/nucleo_f429zi/cmsis_dsp/fir/math_helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Empty file to satisfy CPP
10 changes: 10 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/fir/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<library>
<extends>modm:nucleo-f429zi</extends>
<options>
<option name="modm:build:build.path">../../../../build/nucleo_f429zi/cmsis_dsp/fir</option>
</options>
<modules>
<module>modm:build:scons</module>
<module>modm:cmsis:dsp:filtering</module>
</modules>
</library>
31 changes: 31 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/graphic_equalizer/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#define main arm_cmsis_dsp_example
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_graphic_equalizer_example/math_helper.h"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_graphic_equalizer_example/math_helper.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_graphic_equalizer_example/arm_graphic_equalizer_data.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_graphic_equalizer_example/arm_graphic_equalizer_example_q31.c"
#undef main
#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Empty file to satisfy CPP
11 changes: 11 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/graphic_equalizer/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<library>
<extends>modm:nucleo-f429zi</extends>
<options>
<option name="modm:build:build.path">../../../../build/nucleo_f429zi/cmsis_dsp/graphic_equalizer</option>
</options>
<modules>
<module>modm:build:scons</module>
<module>modm:cmsis:dsp:filtering</module>
<module>modm:cmsis:dsp:basic_math</module>
</modules>
</library>
36 changes: 36 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/linear_interp/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#define main arm_cmsis_dsp_example
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_linear_interp_example/math_helper.h"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_linear_interp_example/math_helper.c"
/* `float arm_linear_interep_table[188495]` is 736kB large and MUST be placed in Flash
* memory NOT SRAM otherwise it won't fit on the device. Since we don't want (=cannot)
* to change the example, we need to take drastic measures... */
#define float const float
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_linear_interp_example/arm_linear_interp_data.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_linear_interp_example/arm_linear_interp_example_f32.c"
#undef float
#undef main
#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Empty file to satisfy CPP
14 changes: 14 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/linear_interp/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<library>
<extends>modm:nucleo-f429zi</extends>
<options>
<option name="modm:build:build.path">../../../../build/nucleo_f429zi/cmsis_dsp/linear_interp</option>
</options>
<collectors>
<!-- We need to cast `&arm_linear_interep_table[0]` to (float*), but cannot change the example... -->
<collect name="modm:build:cxxflags">-fpermissive</collect>
</collectors>
<modules>
<module>modm:build:scons</module>
<module>modm:cmsis:dsp:fast_math</module>
</modules>
</library>
30 changes: 30 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/matrix/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#define main arm_cmsis_dsp_example
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_matrix_example/math_helper.h"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_matrix_example/math_helper.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_matrix_example/arm_matrix_example_f32.c"
#undef main
#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
1 change: 1 addition & 0 deletions examples/nucleo_f429zi/cmsis_dsp/matrix/math_helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Empty file to satisfy CPP
10 changes: 10 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/matrix/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<library>
<extends>modm:nucleo-f429zi</extends>
<options>
<option name="modm:build:build.path">../../../../build/nucleo_f429zi/cmsis_dsp/matrix</option>
</options>
<modules>
<module>modm:build:scons</module>
<module>modm:cmsis:dsp:matrix</module>
</modules>
</library>
31 changes: 31 additions & 0 deletions examples/nucleo_f429zi/cmsis_dsp/signal_converge/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2019, Niklas Hauser
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <arm_math.h>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#define main arm_cmsis_dsp_example
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/math_helper.h"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/math_helper.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/arm_signal_converge_data.c"
#include "../../../../ext/arm/cmsis/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/arm_signal_converge_example_f32.c"
#undef main
#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
int main()
{
Board::initialize();
arm_cmsis_dsp_example();
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Empty file to satisfy CPP
Loading

0 comments on commit 9cca259

Please sign in to comment.