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: 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 +} 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 772008da3e..29618d5aba 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.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 # ---------