From 46942257a41671dc5dc83cc888f06ec37d157d51 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 28 Oct 2020 14:36:03 +0100 Subject: [PATCH 1/5] Moved from CMSIS 5.5.1 to 5.6.0 https://github.com/stm32duino/ArduinoModule-CMSIS/releases/tag/5.6.0 Signed-off-by: Frederic.Pillon --- platform.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 772008da3e..8382196811 100644 --- a/platform.txt +++ b/platform.txt @@ -64,8 +64,8 @@ compiler.ar.extra_flags= compiler.elf2bin.extra_flags= compiler.elf2hex.extra_flags= -compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.5.1.path}/CMSIS/Core/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Source/Templates/gcc/" "-I{runtime.tools.CMSIS-5.5.1.path}/CMSIS/DSP/Include" -compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.5.1.path}/CMSIS/DSP/Lib/GCC/" -l{build.cmsis_lib_gcc} +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.6.0.path}/CMSIS/Core/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Source/Templates/gcc/" "-I{runtime.tools.CMSIS-5.6.0.path}/CMSIS/DSP/Include" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.6.0.path}/CMSIS/DSP/Lib/GCC/" -l{build.cmsis_lib_gcc} # USB Flags # --------- From a253e2b7a600403558bce16d7ae95e473ced13f4 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 28 Oct 2020 18:22:06 +0100 Subject: [PATCH 2/5] [CI] Add CMSIS DSP to example Signed-off-by: Frederic Pillon --- CI/build/examples/BareMinimum/BareMinimum.ino | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/CI/build/examples/BareMinimum/BareMinimum.ino b/CI/build/examples/BareMinimum/BareMinimum.ino index 1e39c262d8..ac299b56f9 100644 --- a/CI/build/examples/BareMinimum/BareMinimum.ino +++ b/CI/build/examples/BareMinimum/BareMinimum.ino @@ -15,6 +15,36 @@ #include #include +#include +/* ---------------------------------------------------------------------- + Defines each of the tests performed + ------------------------------------------------------------------- */ +#define MAX_BLOCKSIZE 2 +#define DELTA (0.0001f) +/* ---------------------------------------------------------------------- + Test input data for Floating point sin_cos example for 32-blockSize + Generated by the MATLAB randn() function + ------------------------------------------------------------------- */ +const float32_t testInput_f32[MAX_BLOCKSIZE] = +{ + -1.244916875853235400, -4.793533929171324800 +}; +const float32_t testRefOutput_f32 = 1.000000000; +/* ---------------------------------------------------------------------- + Declare Global variables + ------------------------------------------------------------------- */ +uint32_t blockSize = 2; +float32_t testOutput; +float32_t cosOutput; +float32_t sinOutput; +float32_t cosSquareOutput; +float32_t sinSquareOutput; +/* ---------------------------------------------------------------------- + Max magnitude FFT Bin test + ------------------------------------------------------------------- */ +arm_status status; +/* CMSIS_DSP */ + #ifndef USER_BTN #define USER_BTN 2 #endif @@ -103,6 +133,28 @@ void setup() { Wire.endTransmission(); Wire.requestFrom(2, 1); Wire.end(); + + // CMSIS DSP + float32_t diff; + for (uint32_t i = 0; i < blockSize; i++) { + cosOutput = arm_cos_f32(testInput_f32[i]); + sinOutput = arm_sin_f32(testInput_f32[i]); + arm_mult_f32(&cosOutput, &cosOutput, &cosSquareOutput, 1); + arm_mult_f32(&sinOutput, &sinOutput, &sinSquareOutput, 1); + arm_add_f32(&cosSquareOutput, &sinSquareOutput, &testOutput, 1); + /* absolute value of difference between ref and test */ + diff = fabsf(testRefOutput_f32 - testOutput); + /* Comparison of sin_cos value with reference */ + status = (diff > DELTA) ? ARM_MATH_TEST_FAILURE : ARM_MATH_SUCCESS; + if ( status == ARM_MATH_TEST_FAILURE) { + break; + } + } + if (status != ARM_MATH_SUCCESS) { + Serial.printf("FAILURE\n"); + } else { + Serial.printf("SUCCESS\n"); + } } void loop() { @@ -120,4 +172,4 @@ void receiveEvent(int) { // this function is registered as an event, see setup() void requestEvent() { Wire.write("x"); -} \ No newline at end of file +} From 62713cd736d628d9bcf10adcea6ddf32f9b8a6b6 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Wed, 28 Oct 2020 18:44:57 +0100 Subject: [PATCH 3/5] [CI] Launch build when examples are modified Signed-off-by: Frederic Pillon --- .github/workflows/Continuous-Integration.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Continuous-Integration.yml b/.github/workflows/Continuous-Integration.yml index 4787545e95..ed9ac3171c 100644 --- a/.github/workflows/Continuous-Integration.yml +++ b/.github/workflows/Continuous-Integration.yml @@ -10,6 +10,7 @@ on: - CI/** - '!CI/build/arduino-cli.py' - '!CI/build/platformio-builder.py' + - '!CI/build/examples/**' - tools/** - '!tools/platformio-build.py' pull_request: @@ -20,6 +21,7 @@ on: - CI/** - '!CI/build/arduino-cli.py' - '!CI/build/platformio-builder.py' + - '!CI/build/examples/**' - tools/** - '!tools/platformio-build.py' jobs: From 3ec6e37d42d9961a17494a3f6c28926977a460a9 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 29 Oct 2020 10:48:26 +0100 Subject: [PATCH 4/5] Moved from CMSIS 5.6.0 to 5.7.0 https://github.com/stm32duino/ArduinoModule-CMSIS/releases/tag/5.7.0 Signed-off-by: Frederic Pillon --- platform.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform.txt b/platform.txt index 8382196811..510ab6516f 100644 --- a/platform.txt +++ b/platform.txt @@ -64,8 +64,8 @@ compiler.ar.extra_flags= compiler.elf2bin.extra_flags= compiler.elf2hex.extra_flags= -compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.6.0.path}/CMSIS/Core/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Source/Templates/gcc/" "-I{runtime.tools.CMSIS-5.6.0.path}/CMSIS/DSP/Include" -compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.6.0.path}/CMSIS/DSP/Lib/GCC/" -l{build.cmsis_lib_gcc} +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Source/Templates/gcc/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -l{build.cmsis_lib_gcc} # USB Flags # --------- From 1ba347569703bb89cdc6bc72f83194439649e4f7 Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Thu, 29 Oct 2020 10:51:25 +0100 Subject: [PATCH 5/5] [CMSIS DSP] Update include path and source files Signed-off-by: Frederic Pillon --- libraries/CMSIS_DSP/src/BayesFunctions/BayesFunctions.c | 1 + libraries/CMSIS_DSP/src/DistanceFunctions/DistanceFunctions.c | 1 + libraries/CMSIS_DSP/src/SVMFunctions/SVMFunctions.c | 1 + platform.txt | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 libraries/CMSIS_DSP/src/BayesFunctions/BayesFunctions.c create mode 100644 libraries/CMSIS_DSP/src/DistanceFunctions/DistanceFunctions.c create mode 100644 libraries/CMSIS_DSP/src/SVMFunctions/SVMFunctions.c diff --git a/libraries/CMSIS_DSP/src/BayesFunctions/BayesFunctions.c b/libraries/CMSIS_DSP/src/BayesFunctions/BayesFunctions.c new file mode 100644 index 0000000000..bcdd1977ec --- /dev/null +++ b/libraries/CMSIS_DSP/src/BayesFunctions/BayesFunctions.c @@ -0,0 +1 @@ +#include "../Source/BayesFunctions/BayesFunctions.c" diff --git a/libraries/CMSIS_DSP/src/DistanceFunctions/DistanceFunctions.c b/libraries/CMSIS_DSP/src/DistanceFunctions/DistanceFunctions.c new file mode 100644 index 0000000000..181d6d6f4f --- /dev/null +++ b/libraries/CMSIS_DSP/src/DistanceFunctions/DistanceFunctions.c @@ -0,0 +1 @@ +#include "../Source/DistanceFunctions/DistanceFunctions.c" diff --git a/libraries/CMSIS_DSP/src/SVMFunctions/SVMFunctions.c b/libraries/CMSIS_DSP/src/SVMFunctions/SVMFunctions.c new file mode 100644 index 0000000000..01833a1a62 --- /dev/null +++ b/libraries/CMSIS_DSP/src/SVMFunctions/SVMFunctions.c @@ -0,0 +1 @@ +#include "../Source/SVMFunctions/SVMFunctions.c" diff --git a/platform.txt b/platform.txt index 510ab6516f..29618d5aba 100644 --- a/platform.txt +++ b/platform.txt @@ -64,7 +64,7 @@ compiler.ar.extra_flags= compiler.elf2bin.extra_flags= compiler.elf2hex.extra_flags= -compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Source/Templates/gcc/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include" +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Include/" "-I{build.system.path}/Drivers/CMSIS/Device/ST/{build.series}/Source/Templates/gcc/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/PrivateInclude" compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -l{build.cmsis_lib_gcc} # USB Flags