├── Drivers ├── CMSIS │ ├── NN │ │ ├── Examples │ │ │ └── ARM │ │ │ │ └── arm_nn_examples │ │ │ │ ├── gru │ │ │ │ ├── readme.txt │ │ │ │ └── RTE │ │ │ │ │ ├── _ARMCM3 │ │ │ │ │ └── RTE_Components.h │ │ │ │ │ ├── _ARMCM4_FP │ │ │ │ │ └── RTE_Components.h │ │ │ │ │ ├── _ARMCM7_SP │ │ │ │ │ └── RTE_Components.h │ │ │ │ │ ├── _ARMCM0 │ │ │ │ │ └── RTE_Components.h │ │ │ │ │ └── Compiler │ │ │ │ │ └── EventRecorderConf.h │ │ │ │ └── cifar10 │ │ │ │ ├── readme.txt │ │ │ │ ├── RTE │ │ │ │ ├── _ARMCM3 │ │ │ │ │ └── RTE_Components.h │ │ │ │ ├── _ARMCM4_FP │ │ │ │ │ └── RTE_Components.h │ │ │ │ ├── _ARMCM7_SP │ │ │ │ │ └── RTE_Components.h │ │ │ │ ├── _ARMCM0 │ │ │ │ │ └── RTE_Components.h │ │ │ │ └── Compiler │ │ │ │ │ └── EventRecorderConf.h │ │ │ │ └── arm_nnexamples_cifar10_parameter.h │ │ ├── NN_Lib_Tests │ │ │ └── nn_test │ │ │ │ ├── readme.txt │ │ │ │ ├── RTE │ │ │ │ ├── _ARMCM0 │ │ │ │ │ └── RTE_Components.h │ │ │ │ ├── _ARMCM3 │ │ │ │ │ └── RTE_Components.h │ │ │ │ ├── _ARMCM4_FP │ │ │ │ │ └── RTE_Components.h │ │ │ │ └── _ARMCM7_SP │ │ │ │ │ └── RTE_Components.h │ │ │ │ ├── Ref_Implementations │ │ │ │ ├── arm_relu_ref.c │ │ │ │ ├── arm_fully_connected_q7_ref.c │ │ │ │ ├── arm_fully_connected_q15_ref.c │ │ │ │ ├── arm_fully_connected_mat_q7_vec_q15_ref.c │ │ │ │ └── arm_nn_mult_ref.c │ │ │ │ └── arm_nnexamples_nn_test.h │ │ └── Include │ │ │ └── arm_nn_tables.h │ ├── DSP │ │ ├── Examples │ │ │ └── ARM │ │ │ │ ├── arm_fir_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_fft_bin_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_matrix_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_sin_cos_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_variance_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_class_marks_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_convolution_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_dotproduct_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_linear_interp_example │ │ │ │ └── Abstract.txt │ │ │ │ ├── arm_graphic_equalizer_example │ │ │ │ └── Abstract.txt │ │ │ │ └── arm_signal_converge_example │ │ │ │ └── Abstract.txt │ │ ├── DSP_Lib_TestSuite │ │ │ ├── Common │ │ │ │ ├── JTest │ │ │ │ │ ├── inc │ │ │ │ │ │ ├── opt_arg │ │ │ │ │ │ │ ├── splice.h │ │ │ │ │ │ │ ├── opt_arg.h │ │ │ │ │ │ │ └── pp_narg.h │ │ │ │ │ │ ├── jtest_test_ret.h │ │ │ │ │ │ ├── jtest.h │ │ │ │ │ │ ├── jtest_util.h │ │ │ │ │ │ ├── jtest_define.h │ │ │ │ │ │ └── util │ │ │ │ │ │ │ └── util.h │ │ │ │ │ └── src │ │ │ │ │ │ ├── jtest_fw.c │ │ │ │ │ │ ├── jtest_cycle.c │ │ │ │ │ │ ├── jtest_trigger_action.c │ │ │ │ │ │ └── jtest_dump_str_segments.c │ │ │ │ ├── src │ │ │ │ │ ├── support_tests │ │ │ │ │ │ ├── support_test_group.c │ │ │ │ │ │ ├── copy_tests.c │ │ │ │ │ │ └── fill_tests.c │ │ │ │ │ ├── transform_tests │ │ │ │ │ │ └── transform_test_group.c │ │ │ │ │ ├── controller_tests │ │ │ │ │ │ └── controller_test_group.c │ │ │ │ │ ├── statistics_tests │ │ │ │ │ │ ├── statistics_test_group.c │ │ │ │ │ │ ├── rms_tests.c │ │ │ │ │ │ ├── std_tests.c │ │ │ │ │ │ ├── var_tests.c │ │ │ │ │ │ ├── max_tests.c │ │ │ │ │ │ ├── min_tests.c │ │ │ │ │ │ ├── mean_tests.c │ │ │ │ │ │ └── power_tests.c │ │ │ │ │ ├── complex_math_tests │ │ │ │ │ │ ├── complex_math_test_group.c │ │ │ │ │ │ ├── cmplx_conj_tests.c │ │ │ │ │ │ ├── cmplx_mult_cmplx_tests.c │ │ │ │ │ │ ├── cmplx_mag_squared_tests.c │ │ │ │ │ │ ├── cmplx_mag_tests.c │ │ │ │ │ │ ├── cmplx_dot_prod_tests.c │ │ │ │ │ │ └── cmplx_mult_real_test.c │ │ │ │ │ ├── filtering_tests │ │ │ │ │ │ └── filtering_test_group.c │ │ │ │ │ ├── basic_math_tests │ │ │ │ │ │ ├── basic_math_test_group.c │ │ │ │ │ │ ├── abs_tests.c │ │ │ │ │ │ ├── shift_tests.c │ │ │ │ │ │ ├── negate_tests.c │ │ │ │ │ │ ├── add_tests.c │ │ │ │ │ │ ├── sub_tests.c │ │ │ │ │ │ ├── offset_tests.c │ │ │ │ │ │ ├── dot_prod_tests.c │ │ │ │ │ │ ├── mult_tests.c │ │ │ │ │ │ └── scale_tests.c │ │ │ │ │ ├── matrix_tests │ │ │ │ │ │ ├── matrix_test_group.c │ │ │ │ │ │ ├── mat_add_tests.c │ │ │ │ │ │ ├── mat_trans_tests.c │ │ │ │ │ │ └── mat_sub_tests.c │ │ │ │ │ ├── main.c │ │ │ │ │ ├── all_tests.c │ │ │ │ │ └── fast_math_tests │ │ │ │ │ │ └── fast_math_tests.c │ │ │ │ ├── inc │ │ │ │ │ ├── all_tests.h │ │ │ │ │ ├── matrix_tests │ │ │ │ │ │ ├── matrix_test_group.h │ │ │ │ │ │ └── matrix_tests.h │ │ │ │ │ ├── support_tests │ │ │ │ │ │ ├── support_test_group.h │ │ │ │ │ │ ├── support_tests.h │ │ │ │ │ │ └── support_test_data.h │ │ │ │ │ ├── fast_math_tests │ │ │ │ │ │ ├── fast_math_test_group.h │ │ │ │ │ │ └── fast_math_test_data.h │ │ │ │ │ ├── filtering_tests │ │ │ │ │ │ ├── filtering_test_group.h │ │ │ │ │ │ └── filtering_tests.h │ │ │ │ │ ├── transform_tests │ │ │ │ │ │ ├── transform_test_group.h │ │ │ │ │ │ ├── transform_tests.h │ │ │ │ │ │ └── transform_test_data.h │ │ │ │ │ ├── basic_math_tests │ │ │ │ │ │ ├── basic_math_test_group.h │ │ │ │ │ │ ├── basic_math_tests.h │ │ │ │ │ │ └── basic_math_test_data.h │ │ │ │ │ ├── controller_tests │ │ │ │ │ │ ├── controller_test_group.h │ │ │ │ │ │ ├── controller_tests.h │ │ │ │ │ │ ├── controller_test_data.h │ │ │ │ │ │ └── controller_templates.h │ │ │ │ │ ├── intrinsics_tests │ │ │ │ │ │ ├── intrinsics_test_group.h │ │ │ │ │ │ └── intrinsics_test_data.h │ │ │ │ │ ├── statistics_tests │ │ │ │ │ │ ├── statistics_test_group.h │ │ │ │ │ │ ├── statistics_tests.h │ │ │ │ │ │ └── statistics_test_data.h │ │ │ │ │ ├── complex_math_tests │ │ │ │ │ │ ├── complex_math_test_group.h │ │ │ │ │ │ ├── complex_math_tests.h │ │ │ │ │ │ └── complex_math_test_data.h │ │ │ │ │ ├── type_abbrev.h │ │ │ │ │ └── math_helper.h │ │ │ │ └── platform │ │ │ │ │ ├── system_generic.c │ │ │ │ │ ├── ARMCC │ │ │ │ │ └── Retarget.c │ │ │ │ │ ├── startup_generic.S │ │ │ │ │ └── system_ARMCM0.c │ │ │ ├── RefLibs │ │ │ │ └── src │ │ │ │ │ ├── FastMathFunctions │ │ │ │ │ ├── cos.c │ │ │ │ │ ├── sin.c │ │ │ │ │ └── sqrt.c │ │ │ │ │ ├── ControllerFunctions │ │ │ │ │ ├── sin_cos.c │ │ │ │ │ └── pid.c │ │ │ │ │ ├── ComplexMathFunctions │ │ │ │ │ ├── cmplx_conj.c │ │ │ │ │ ├── cmplx_mag_squared.c │ │ │ │ │ ├── cmplx_mag.c │ │ │ │ │ ├── cmplx_mult_real.c │ │ │ │ │ ├── cmplx_mult_cmplx.c │ │ │ │ │ └── cmplx_dot_prod.c │ │ │ │ │ ├── TransformFunctions │ │ │ │ │ ├── bitreversal.c │ │ │ │ │ └── dct4.c │ │ │ │ │ ├── SupportFunctions │ │ │ │ │ ├── fill.c │ │ │ │ │ ├── copy.c │ │ │ │ │ ├── fixed_to_float.c │ │ │ │ │ ├── float_to_fixed.c │ │ │ │ │ └── fixed_to_fixed.c │ │ │ │ │ ├── BasicMathFunctions │ │ │ │ │ ├── negate.c │ │ │ │ │ ├── abs.c │ │ │ │ │ ├── offset.c │ │ │ │ │ ├── add.c │ │ │ │ │ ├── sub.c │ │ │ │ │ ├── shift.c │ │ │ │ │ ├── dot_prod.c │ │ │ │ │ ├── mult.c │ │ │ │ │ └── scale.c │ │ │ │ │ ├── StatisticsFunctions │ │ │ │ │ ├── power.c │ │ │ │ │ ├── mean.c │ │ │ │ │ ├── var.c │ │ │ │ │ ├── max.c │ │ │ │ │ ├── min.c │ │ │ │ │ ├── rms.c │ │ │ │ │ └── std.c │ │ │ │ │ ├── MatrixFunctions │ │ │ │ │ ├── mat_inverse.c │ │ │ │ │ ├── mat_trans.c │ │ │ │ │ ├── mat_add.c │ │ │ │ │ ├── mat_sub.c │ │ │ │ │ ├── mat_scale.c │ │ │ │ │ └── mat_mult.c │ │ │ │ │ └── HelperFunctions │ │ │ │ │ └── ref_helper.c │ │ │ └── DspLibTest_MPS2 │ │ │ │ └── HowTo.txt │ │ └── Source │ │ │ ├── ControllerFunctions │ │ │ ├── arm_pid_reset_q15.c │ │ │ ├── arm_pid_reset_q31.c │ │ │ └── arm_pid_reset_f32.c │ │ │ └── MatrixFunctions │ │ │ ├── arm_mat_init_q15.c │ │ │ └── arm_mat_init_q31.c │ ├── Device │ │ └── ST │ │ │ └── STM32F1xx │ │ │ ├── LICENSE.txt │ │ │ └── Include │ │ │ └── system_stm32f1xx.h │ ├── Include │ │ └── cmsis_version.h │ └── Core │ │ ├── Include │ │ └── cmsis_version.h │ │ └── Template │ │ └── ARMv8-M │ │ └── main_s.c ├── STM32F1xx_HAL_Driver │ ├── LICENSE.txt │ └── License.md └── CMakeLists.txt ├── shell.nix ├── README.md ├── .gitignore ├── arm-none-eabi-gcc.cmake ├── .github └── workflows │ └── cmake.yml └── Core └── Inc ├── stm32f1xx_it.h └── main.h /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/readme.txt: -------------------------------------------------------------------------------- 1 | CMSIS NN Lib example arm_nnexample_gru0 for 2 | Cortex-M4 and Cortex-M7. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/readme.txt: -------------------------------------------------------------------------------- 1 | CMSIS NN Lib example arm_nnexample_cifar10 for 2 | Cortex-M4 and Cortex-M7. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/readme.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_nnexample_nn_test for 2 | Cortex-M3, Cortex-M4 and Cortex-M7. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_fir_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_fir_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_fft_bin_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_fft_bin_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_matrix_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_matrix_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_sin_cos_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_sin_cos_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_variance_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_variance_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/inc/opt_arg/splice.h: -------------------------------------------------------------------------------- 1 | #ifndef _SPLICE_H_ 2 | #define _SPLICE_H_ 3 | 4 | #define SPLICE(a,b) SPLICE_1(a,b) 5 | #define SPLICE_1(a,b) SPLICE_2(a,b) 6 | #define SPLICE_2(a,b) a##b 7 | 8 | #endif /* _SPLICE_H_ */ 9 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_class_marks_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_class_marks_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_convolution_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_convolution_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_dotproduct_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_dotproduct_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_linear_interp_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_linear_interp_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_graphic_equalizer_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_graphic_equalizer_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Examples/ARM/arm_signal_converge_example/Abstract.txt: -------------------------------------------------------------------------------- 1 | CMSIS DSP_Lib example arm_signal_converge_example for 2 | Cortex-M0, Cortex-M3, Cortex-M4 with FPU and Cortex-M7 with single precision FPU. 3 | 4 | The example is configured for uVision Simulator. 5 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_group.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "support_tests.h" 3 | 4 | JTEST_DEFINE_GROUP(support_tests) 5 | { 6 | JTEST_GROUP_CALL(copy_tests); 7 | JTEST_GROUP_CALL(fill_tests); 8 | JTEST_GROUP_CALL(x_to_y_tests); 9 | return; 10 | } 11 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | let 2 | pkgs = import (builtins.fetchTarball { 3 | url = "https://github.com/NixOS/nixpkgs/archive/976fa3369d722e76f37c77493d99829540d43845.tar.gz"; 4 | }) {}; 5 | 6 | in pkgs.mkShell { 7 | packages = [ 8 | pkgs.gcc-arm-embedded 9 | pkgs.cmake 10 | pkgs.gnumake 11 | pkgs.git 12 | pkgs.openocd 13 | ]; 14 | } 15 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/FastMathFunctions/cos.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | q31_t ref_cos_q31(q31_t x) 4 | { 5 | return (q31_t)(cosf((float32_t)x * 6.28318530717959f / 2147483648.0f) * 2147483648.0f); 6 | } 7 | 8 | q15_t ref_cos_q15(q15_t x) 9 | { 10 | return (q15_t)(cosf((float32_t)x * 6.28318530717959f / 32768.0f) * 32768.0f); 11 | } 12 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/FastMathFunctions/sin.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | q31_t ref_sin_q31(q31_t x) 4 | { 5 | return (q31_t)(sinf((float32_t)x * 6.28318530717959f / 2147483648.0f) * 2147483648.0f); 6 | } 7 | 8 | q15_t ref_sin_q15(q15_t x) 9 | { 10 | return (q15_t)(sinf((float32_t)x * 6.28318530717959f / 32768.0f) * 32768.0f); 11 | } 12 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/all_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _ALL_TESTS_H_ 2 | #define _ALL_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(all_tests); 8 | 9 | #endif /* _ALL_TESTS_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/transform_tests/transform_test_group.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "transform_tests.h" 3 | 4 | JTEST_DEFINE_GROUP(transform_tests) 5 | { 6 | JTEST_GROUP_CALL(cfft_tests); 7 | JTEST_GROUP_CALL(cfft_family_tests); 8 | JTEST_GROUP_CALL(rfft_tests); 9 | JTEST_GROUP_CALL(rfft_fast_tests); 10 | JTEST_GROUP_CALL(dct4_tests); 11 | } 12 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/src/jtest_fw.c: -------------------------------------------------------------------------------- 1 | #include "../inc/jtest.h" 2 | 3 | /*--------------------------------------------------------------------------------*/ 4 | /* Define Global Variables */ 5 | /*--------------------------------------------------------------------------------*/ 6 | 7 | char JTEST_FW_STR_BUFFER[JTEST_BUF_SIZE] = {0}; 8 | 9 | volatile JTEST_FW_t JTEST_FW = {0}; 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/controller_tests/controller_test_group.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "controller_tests.h" 3 | 4 | JTEST_DEFINE_GROUP(controller_tests) 5 | { 6 | /* 7 | To skip a test, comment it out. 8 | */ 9 | JTEST_GROUP_CALL(pid_reset_tests); 10 | JTEST_GROUP_CALL(pid_tests); 11 | JTEST_GROUP_CALL(sin_cos_tests); 12 | return; 13 | } 14 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/LICENSE.txt: -------------------------------------------------------------------------------- 1 | This software component is provided to you as part of a software package and 2 | applicable license terms are in the Package_license file. If you received this 3 | software component outside of a package or without applicable license terms, 4 | the terms of the Apache-2.0 license shall apply. 5 | You may obtain a copy of the Apache-2.0 at: 6 | https://opensource.org/licenses/Apache-2.0 7 | -------------------------------------------------------------------------------- /Drivers/STM32F1xx_HAL_Driver/LICENSE.txt: -------------------------------------------------------------------------------- 1 | This software component is provided to you as part of a software package and 2 | applicable license terms are in the Package_license file. If you received this 3 | software component outside of a package or without applicable license terms, 4 | the terms of the BSD-3-Clause license shall apply. 5 | You may obtain a copy of the BSD-3-Clause at: 6 | https://opensource.org/licenses/BSD-3-Clause 7 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/matrix_tests/matrix_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _MATRIX_TEST_GROUP_H_ 2 | #define _MATRIX_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(matrix_tests); 8 | 9 | #endif /* _MATRIX_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/support_tests/support_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _SUPPORT_TEST_GROUP_H_ 2 | #define _SUPPORT_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(support_tests); 8 | 9 | #endif /* _SUPPORT_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/FastMathFunctions/sqrt.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | arm_status ref_sqrt_q31(q31_t in, q31_t * pOut) 4 | { 5 | *pOut = (q31_t)(sqrtf((float32_t)in / 2147483648.0f) * 2147483648.0f); 6 | 7 | return ARM_MATH_SUCCESS; 8 | } 9 | 10 | arm_status ref_sqrt_q15(q15_t in, q15_t * pOut) 11 | { 12 | *pOut = (q15_t)(sqrtf((float32_t)in / 32768.0f) * 32768.0f); 13 | 14 | return ARM_MATH_SUCCESS; 15 | } 16 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/fast_math_tests/fast_math_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _FAST_MATH_TEST_GROUP_H_ 2 | #define _FAST_MATH_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(fast_math_tests); 8 | 9 | #endif /* _FAST_MATH_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/filtering_tests/filtering_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _FILTERING_TEST_GROUP_H_ 2 | #define _FILTERING_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(filtering_tests); 8 | 9 | #endif /* _FILTERING_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/transform_tests/transform_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRANSFORM_TEST_GROUP_H_ 2 | #define _TRANSFORM_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(transform_tests); 8 | 9 | #endif /* _TRANSFORM_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/basic_math_tests/basic_math_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _BASIC_MATH_TEST_GROUP_H_ 2 | #define _BASIC_MATH_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(basic_math_tests); 8 | 9 | #endif /* _BASIC_MATH_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/controller_tests/controller_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONTROLLER_TEST_GROUP_H_ 2 | #define _CONTROLLER_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Group */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(controller_tests); 8 | 9 | #endif /* _CONTROLLER_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/intrinsics_tests/intrinsics_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _INTRINSICS_TEST_GROUP_H_ 2 | #define _INTRINSICS_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(intrinsics_tests); 8 | 9 | #endif /* _INTRINSICS_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/statistics_tests/statistics_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATISTICS_TEST_GROUP_H_ 2 | #define _STATISTICS_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(statistics_tests); 8 | 9 | #endif /* _STATISTICS_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/complex_math_tests/complex_math_test_group.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPLEX_MATH_TEST_GROUP_H_ 2 | #define _COMPLEX_MATH_TEST_GROUP_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Declare Test Groups */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(complex_math_tests); 8 | 9 | #endif /* _COMPLEX_MATH_TEST_GROUP_H_ */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/statistics_test_group.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "statistics_tests.h" 3 | 4 | JTEST_DEFINE_GROUP(statistics_tests) 5 | { 6 | JTEST_GROUP_CALL(max_tests); 7 | JTEST_GROUP_CALL(mean_tests); 8 | JTEST_GROUP_CALL(min_tests); 9 | JTEST_GROUP_CALL(power_tests); 10 | JTEST_GROUP_CALL(rms_tests); 11 | JTEST_GROUP_CALL(std_tests); 12 | JTEST_GROUP_CALL(var_tests); 13 | return; 14 | } 15 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/RTE/_ARMCM0/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_cifar10' 7 | * Target: 'ARMCM0' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM0.h" 18 | 19 | 20 | #endif /* RTE_COMPONENTS_H */ 21 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/support_tests/support_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _SUPPORT_TESTS_H_ 2 | #define _SUPPORT_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Test/Group Declarations */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(copy_tests); 8 | JTEST_DECLARE_GROUP(fill_tests); 9 | JTEST_DECLARE_GROUP(x_to_y_tests); 10 | 11 | #endif /* _SUPPORT_TESTS_H_ */ 12 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/controller_tests/controller_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONTROLLER_TESTS_H_ 2 | #define _CONTROLLER_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Test/Group Declarations */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(pid_reset_tests); 8 | JTEST_DECLARE_GROUP(sin_cos_tests); 9 | JTEST_DECLARE_GROUP(pid_tests); 10 | 11 | #endif /* _CONTROLLER_TESTS_H_ */ 12 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/complex_math_tests/complex_math_test_group.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "complex_math_tests.h" 3 | 4 | JTEST_DEFINE_GROUP(complex_math_tests) 5 | { 6 | JTEST_GROUP_CALL(cmplx_conj_tests); 7 | JTEST_GROUP_CALL(cmplx_dot_prod_tests); 8 | JTEST_GROUP_CALL(cmplx_mag_tests); 9 | JTEST_GROUP_CALL(cmplx_mag_squared_tests); 10 | JTEST_GROUP_CALL(cmplx_mult_cmplx_tests); 11 | JTEST_GROUP_CALL(cmplx_mult_real_tests); 12 | 13 | return; 14 | } 15 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/filtering_tests/filtering_test_group.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "filtering_tests.h" 3 | 4 | JTEST_DEFINE_GROUP(filtering_tests) 5 | { 6 | /* 7 | To skip a test, comment it out. 8 | */ 9 | JTEST_GROUP_CALL(biquad_tests); 10 | JTEST_GROUP_CALL(conv_tests); 11 | JTEST_GROUP_CALL(correlate_tests); 12 | JTEST_GROUP_CALL(fir_tests); 13 | JTEST_GROUP_CALL(iir_tests); 14 | JTEST_GROUP_CALL(lms_tests); 15 | 16 | return; 17 | } 18 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/src/jtest_cycle.c: -------------------------------------------------------------------------------- 1 | #include "../inc/jtest_cycle.h" 2 | #include 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Define Module Variables */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | /* const char * JTEST_CYCLE_STRF = "Running: %s\nCycles: %" PRIu32 "\n"; */ 9 | const char * JTEST_CYCLE_STRF = "Cycles: %" PRIu32 "\n"; /* function name + parameter string skipped */ 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/inc/jtest_test_ret.h: -------------------------------------------------------------------------------- 1 | #ifndef _JTEST_TEST_RET_H_ 2 | #define _JTEST_TEST_RET_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Type Definitions */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | /** 9 | * Values a #JTEST_TEST_t can return. 10 | */ 11 | typedef enum JTEST_TEST_RET_enum 12 | { 13 | JTEST_TEST_PASSED, 14 | JTEST_TEST_FAILED 15 | } JTEST_TEST_RET_t; 16 | 17 | #endif /* _JTEST_TEST_RET_H_ */ 18 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/basic_math_tests/basic_math_test_group.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "basic_math_tests.h" 3 | 4 | JTEST_DEFINE_GROUP(basic_math_tests) 5 | { 6 | JTEST_GROUP_CALL(abs_tests); 7 | JTEST_GROUP_CALL(add_tests); 8 | JTEST_GROUP_CALL(dot_prod_tests); 9 | JTEST_GROUP_CALL(mult_tests); 10 | JTEST_GROUP_CALL(negate_tests); 11 | JTEST_GROUP_CALL(offset_tests); 12 | JTEST_GROUP_CALL(scale_tests); 13 | JTEST_GROUP_CALL(shift_tests); 14 | JTEST_GROUP_CALL(sub_tests); 15 | 16 | return; 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The most thoroughly commented embedded CMakeLists file project 2 | This repository contains an example embedded CMake project using an STM32F103 MCU. It contains [the most thoroughly commented embedded CMakeLists file](CMakeLists.txt) and a [nix-shell reproducible development environment](shell.nix) covered on [my blog](https://dnedic.github.io/blog/). 3 | 4 | # Building 5 | To build the project in the default Debug mode use the following commands: 6 | ```bash 7 | cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=arm-none-eabi-gcc.cmake 8 | cmake --build build 9 | ``` 10 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/inc/jtest.h: -------------------------------------------------------------------------------- 1 | #ifndef _JTEST_H_ 2 | #define _JTEST_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Includes */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | #include "jtest_fw.h" 9 | #include "jtest_test.h" 10 | #include "jtest_test_define.h" 11 | #include "jtest_test_call.h" 12 | #include "jtest_group.h" 13 | #include "jtest_group_define.h" 14 | #include "jtest_group_call.h" 15 | #include "jtest_cycle.h" 16 | 17 | #endif /* _JTEST_H_ */ 18 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/transform_tests/transform_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRANSFORM_TESTS_H_ 2 | #define _TRANSFORM_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Test/Group Declarations */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(cfft_tests); 8 | JTEST_DECLARE_GROUP(cfft_family_tests); 9 | JTEST_DECLARE_GROUP(dct4_tests); 10 | JTEST_DECLARE_GROUP(rfft_tests); 11 | JTEST_DECLARE_GROUP(rfft_fast_tests); 12 | 13 | #endif /* _TRANSFORM_TESTS_H_ */ 14 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/inc/opt_arg/opt_arg.h: -------------------------------------------------------------------------------- 1 | #ifndef _OPT_ARG_H_ 2 | #define _OPT_ARG_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Includes */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | #include "pp_narg.h" 9 | #include "splice.h" 10 | 11 | /* If you are Joseph Jaoudi, you have a snippet which expands into an 12 | example. If you are not Joseph, but possess his code, study the examples. If 13 | you have no examples, turn back contact Joseph. */ 14 | 15 | #endif /* _OPT_ARG_H_ */ 16 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/filtering_tests/filtering_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _FILTERING_TESTS_H_ 2 | #define _FILTERING_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Test/Group Declarations */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | JTEST_DECLARE_GROUP(biquad_tests); 9 | JTEST_DECLARE_GROUP(conv_tests); 10 | JTEST_DECLARE_GROUP(correlate_tests); 11 | JTEST_DECLARE_GROUP(fir_tests); 12 | JTEST_DECLARE_GROUP(iir_tests); 13 | JTEST_DECLARE_GROUP(lms_tests); 14 | 15 | #endif /* _FILTERING_TESTS_H_ */ 16 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/RTE/_ARMCM3/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_gru' 7 | * Target: 'ARMCM3' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM3.h" 18 | 19 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 20 | #define RTE_Compiler_IO_STDOUT_ITM /* Compiler I/O: STDOUT ITM */ 21 | 22 | #endif /* RTE_COMPONENTS_H */ 23 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/statistics_tests/statistics_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATISTICS_TESTS_H_ 2 | #define _STATISTICS_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Test/Group Declarations */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(max_tests); 8 | JTEST_DECLARE_GROUP(mean_tests); 9 | JTEST_DECLARE_GROUP(min_tests); 10 | JTEST_DECLARE_GROUP(power_tests); 11 | JTEST_DECLARE_GROUP(rms_tests); 12 | JTEST_DECLARE_GROUP(std_tests); 13 | JTEST_DECLARE_GROUP(var_tests); 14 | 15 | #endif /* _STATISTICS_TESTS_H_ */ 16 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/matrix_tests/matrix_test_group.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "matrix_tests.h" 3 | 4 | JTEST_DEFINE_GROUP(matrix_tests) 5 | { 6 | /* 7 | To skip a test, comment it out. 8 | */ 9 | JTEST_GROUP_CALL(mat_add_tests); 10 | JTEST_GROUP_CALL(mat_cmplx_mult_tests); 11 | JTEST_GROUP_CALL(mat_init_tests); 12 | JTEST_GROUP_CALL(mat_inverse_tests); 13 | JTEST_GROUP_CALL(mat_mult_tests); 14 | JTEST_GROUP_CALL(mat_mult_fast_tests); 15 | JTEST_GROUP_CALL(mat_sub_tests); 16 | JTEST_GROUP_CALL(mat_trans_tests); 17 | JTEST_GROUP_CALL(mat_scale_tests); 18 | return; 19 | } 20 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/RTE/_ARMCM3/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_cifar10' 7 | * Target: 'ARMCM3' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM3.h" 18 | 19 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 20 | #define RTE_Compiler_IO_STDOUT_ITM /* Compiler I/O: STDOUT ITM */ 21 | 22 | #endif /* RTE_COMPONENTS_H */ 23 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/RTE/_ARMCM4_FP/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_gru' 7 | * Target: 'ARMCM4_FP' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM4_FP.h" 18 | 19 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 20 | #define RTE_Compiler_IO_STDOUT_ITM /* Compiler I/O: STDOUT ITM */ 21 | 22 | #endif /* RTE_COMPONENTS_H */ 23 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/RTE/_ARMCM7_SP/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_gru' 7 | * Target: 'ARMCM7_SP' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM7_SP.h" 18 | 19 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 20 | #define RTE_Compiler_IO_STDOUT_ITM /* Compiler I/O: STDOUT ITM */ 21 | 22 | #endif /* RTE_COMPONENTS_H */ 23 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/RTE/_ARMCM4_FP/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_cifar10' 7 | * Target: 'ARMCM4_FP' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM4_FP.h" 18 | 19 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 20 | #define RTE_Compiler_IO_STDOUT_ITM /* Compiler I/O: STDOUT ITM */ 21 | 22 | #endif /* RTE_COMPONENTS_H */ 23 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/RTE/_ARMCM7_SP/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_cifar10' 7 | * Target: 'ARMCM7_SP' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM7_SP.h" 18 | 19 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 20 | #define RTE_Compiler_IO_STDOUT_ITM /* Compiler I/O: STDOUT ITM */ 21 | 22 | #endif /* RTE_COMPONENTS_H */ 23 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/complex_math_tests/complex_math_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPLEX_MATH_TESTS_H_ 2 | #define _COMPLEX_MATH_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Test/Group Declarations */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(cmplx_conj_tests); 8 | JTEST_DECLARE_GROUP(cmplx_dot_prod_tests); 9 | JTEST_DECLARE_GROUP(cmplx_mag_tests); 10 | JTEST_DECLARE_GROUP(cmplx_mag_squared_tests); 11 | JTEST_DECLARE_GROUP(cmplx_mult_cmplx_tests); 12 | JTEST_DECLARE_GROUP(cmplx_mult_real_tests); 13 | 14 | #endif /* _COMPLEX_MATH_TESTS_H_ */ 15 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/src/jtest_trigger_action.c: -------------------------------------------------------------------------------- 1 | 2 | #include "jtest_fw.h" 3 | 4 | void test_start (void) { 5 | // ; 6 | JTEST_FW.test_start++; 7 | } 8 | 9 | void test_end (void) { 10 | // ; 11 | JTEST_FW.test_end++; 12 | } 13 | 14 | void group_start (void) { 15 | // ; 16 | JTEST_FW.group_start++; 17 | } 18 | 19 | void group_end (void) { 20 | // ; 21 | JTEST_FW.group_end++; 22 | } 23 | 24 | void dump_str (void) { 25 | // ; 26 | JTEST_FW.dump_str++; 27 | } 28 | 29 | void dump_data (void) { 30 | // ; 31 | JTEST_FW.dump_data++; 32 | } 33 | 34 | void exit_fw (void) { 35 | // ; 36 | JTEST_FW.exit_fw++; 37 | } 38 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/basic_math_tests/basic_math_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _BASIC_MATH_TESTS_H_ 2 | #define _BASIC_MATH_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Test/Group Declarations */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(abs_tests); 8 | JTEST_DECLARE_GROUP(add_tests); 9 | JTEST_DECLARE_GROUP(dot_prod_tests); 10 | JTEST_DECLARE_GROUP(mult_tests); 11 | JTEST_DECLARE_GROUP(negate_tests); 12 | JTEST_DECLARE_GROUP(offset_tests); 13 | JTEST_DECLARE_GROUP(scale_tests); 14 | JTEST_DECLARE_GROUP(shift_tests); 15 | JTEST_DECLARE_GROUP(sub_tests); 16 | 17 | #endif /* _BASIC_MATH_TESTS_H_ */ 18 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ControllerFunctions/sin_cos.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_sin_cos_f32( 4 | float32_t theta, 5 | float32_t * pSinVal, 6 | float32_t * pCosVal) 7 | { 8 | //theta is given in degrees 9 | *pSinVal = sinf(theta * 6.28318530717959f / 360.0f); 10 | *pCosVal = cosf(theta * 6.28318530717959f / 360.0f); 11 | } 12 | 13 | void ref_sin_cos_q31( 14 | q31_t theta, 15 | q31_t * pSinVal, 16 | q31_t * pCosVal) 17 | { 18 | //theta is given in the range [-1,1) to represent [-pi,pi) 19 | *pSinVal = (q31_t)(sinf((float32_t)theta * 3.14159265358979f / 2147483648.0f) * 2147483648.0f); 20 | *pCosVal = (q31_t)(cosf((float32_t)theta * 3.14159265358979f / 2147483648.0f) * 2147483648.0f); 21 | } 22 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/RTE/_ARMCM0/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_gru' 7 | * Target: 'ARMCM0' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM0.h" 18 | 19 | #define RTE_Compiler_EventRecorder 20 | #define RTE_Compiler_EventRecorder_DAP 21 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 22 | #define RTE_Compiler_IO_STDOUT_EVR /* Compiler I/O: STDOUT EVR */ 23 | 24 | #endif /* RTE_COMPONENTS_H */ 25 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/RTE/_ARMCM0/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'arm_nnexamples_cifar10' 7 | * Target: 'ARMCM0' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "ARMCM0.h" 18 | 19 | #define RTE_Compiler_EventRecorder 20 | #define RTE_Compiler_EventRecorder_DAP 21 | #define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ 22 | #define RTE_Compiler_IO_STDOUT_EVR /* Compiler I/O: STDOUT EVR */ 23 | 24 | #endif /* RTE_COMPONENTS_H */ 25 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/matrix_tests/matrix_tests.h: -------------------------------------------------------------------------------- 1 | #ifndef _MATRIX_TESTS_H_ 2 | #define _MATRIX_TESTS_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Test/Group Declarations */ 6 | /*--------------------------------------------------------------------------------*/ 7 | JTEST_DECLARE_GROUP(mat_add_tests); 8 | JTEST_DECLARE_GROUP(mat_cmplx_mult_tests); 9 | JTEST_DECLARE_GROUP(mat_init_tests); 10 | JTEST_DECLARE_GROUP(mat_inverse_tests); 11 | JTEST_DECLARE_GROUP(mat_mult_tests); 12 | JTEST_DECLARE_GROUP(mat_mult_fast_tests); 13 | JTEST_DECLARE_GROUP(mat_sub_tests); 14 | JTEST_DECLARE_GROUP(mat_trans_tests); 15 | JTEST_DECLARE_GROUP(mat_scale_tests); 16 | 17 | #endif /* _MATRIX_TESTS_H_ */ 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | 54 | # Directories 55 | build/ 56 | .vscode/ 57 | 58 | # The STM32CubeMX generated makefile 59 | /Makefile 60 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/DspLibTest_MPS2/HowTo.txt: -------------------------------------------------------------------------------- 1 | 2 | Used board: 3 | MPS2+. 4 | 5 | Used BIOS: 6 | mbb_v121.ebf ; use this for ULINKpro 7 | mbb_v220.ebf ; CMSIS-DAP 8 | 9 | Used Images: 10 | AN382\an382_v3.txt ; Cortex-M0 11 | AN385\an385_v3.txt ; Cortex-M3 12 | AN386\an386_v3.txt ; Cortex-M4 13 | AN500\an500_v1.txt ; Cortex-M7 14 | AN505\an505_v2.txt ; Cortex-M33 (IoT Kit) 15 | AN519\an519_v1.txt ; Cortex-M23 (IoT Kit) 16 | 17 | Used Debugger: 18 | IoT Kit: 19 | ULINKpro, JTAG, 25MHz, HW Reset 20 | other: 21 | ULINKpro, JTAG, 25MHz, Autodetect 22 | 23 | Memory Settings: 24 | IoT Kit: 25 | ROM: 0x10000000 26 | RAM: 0x38000000 27 | other: 28 | ROM: 0x00000000 29 | RAM: 0x20000000 -------------------------------------------------------------------------------- /arm-none-eabi-gcc.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Generic) 2 | set(CMAKE_SYSTEM_PROCESSOR arm) 3 | set(TOOLCHAIN_PREFIX arm-none-eabi-) 4 | 5 | set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 6 | 7 | set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc) 8 | set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) 9 | set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++) 10 | 11 | find_path(COMPILER_DIR ${CMAKE_C_COMPILER}) 12 | get_filename_component(TOOLCHAIN_DIR ${COMPILER_DIR} DIRECTORY) 13 | 14 | set(CMAKE_OBJCOPY ${TOOLCHAIN_DIR}/bin/${TOOLCHAIN_PREFIX}objcopy) 15 | set(CMAKE_SIZE_UTIL ${TOOLCHAIN_DIR}/bin/${TOOLCHAIN_PREFIX}size) 16 | 17 | set(CMAKE_FIND_ROOT_PATH ${COMPILER_DIR}) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 19 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 20 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/main.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "all_tests.h" 3 | #include "arm_math.h" 4 | 5 | 6 | #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 7 | asm(" .global __ARM_use_no_argv\n"); 8 | #endif 9 | 10 | 11 | void debug_init(void) 12 | { 13 | uint32_t * SHCSR_ptr = (uint32_t *) 0xE000ED24; /* System Handler Control and State Register */ 14 | *SHCSR_ptr |= 0x70000; /* Enable UsageFault, BusFault, and MemManage fault*/ 15 | } 16 | 17 | int main(void) 18 | { 19 | debug_init(); 20 | 21 | JTEST_INIT(); /* Initialize test framework. */ 22 | 23 | JTEST_GROUP_CALL(all_tests); /* Run all tests. */ 24 | 25 | JTEST_ACT_EXIT_FW(); /* Exit test framework. */ 26 | while (1); /* Never return. */ 27 | } 28 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_conj.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_cmplx_conj_f32( 4 | float32_t * pSrc, 5 | float32_t * pDst, 6 | uint32_t numSamples) 7 | { 8 | uint32_t i; 9 | for(i=0;i> 33); 27 | acc1 = (q31_t)(((q63_t)pSrc[i+1] * pSrc[i+1]) >> 33); 28 | *pDst++ = acc0 + acc1; 29 | } 30 | } 31 | 32 | void ref_cmplx_mag_squared_q15( 33 | q15_t * pSrc, 34 | q15_t * pDst, 35 | uint32_t numSamples) 36 | { 37 | uint32_t i; 38 | q31_t acc0,acc1; 39 | 40 | for(i=0;i> 17); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/offset.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_offset_f32( 4 | float32_t * pSrc, 5 | float32_t offset, 6 | float32_t * pDst, 7 | uint32_t blockSize) 8 | { 9 | uint32_t i; 10 | 11 | for(i=0;i 0.0f ? 0.5f : -0.5f; //round 16 | pDst[i] = ref_sat_q31((q63_t)in); //cast and saturate 17 | } 18 | } 19 | 20 | void ref_float_to_q15( 21 | float32_t * pSrc, 22 | q15_t * pDst, 23 | uint32_t blockSize) 24 | { 25 | uint32_t i; 26 | float32_t in; 27 | 28 | for(i=0;i 0.0f ? 0.5f : -0.5f; 33 | pDst[i] = ref_sat_q15((q31_t)in); 34 | } 35 | } 36 | 37 | void ref_float_to_q7( 38 | float32_t * pSrc, 39 | q7_t * pDst, 40 | uint32_t blockSize) 41 | { 42 | uint32_t i; 43 | float32_t in; 44 | 45 | for(i=0;i 0.0f ? 0.5f : -0.5f; 50 | pDst[i] = ref_sat_q7((q15_t)in); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/arm_nnexamples_cifar10_parameter.h: -------------------------------------------------------------------------------- 1 | #define CONV1_IM_DIM 32 2 | #define CONV1_IM_CH 3 3 | #define CONV1_KER_DIM 5 4 | #define CONV1_PADDING 2 5 | #define CONV1_STRIDE 1 6 | #define CONV1_OUT_CH 32 7 | #define CONV1_OUT_DIM 32 8 | 9 | #define POOL1_KER_DIM 3 10 | #define POOL1_STRIDE 2 11 | #define POOL1_PADDING 0 12 | #define POOL1_OUT_DIM 16 13 | 14 | #define CONV2_IM_DIM 16 15 | #define CONV2_IM_CH 32 16 | #define CONV2_KER_DIM 5 17 | #define CONV2_PADDING 2 18 | #define CONV2_STRIDE 1 19 | #define CONV2_OUT_CH 16 20 | #define CONV2_OUT_DIM 16 21 | 22 | #define POOL2_KER_DIM 3 23 | #define POOL2_STRIDE 2 24 | #define POOL2_PADDING 0 25 | #define POOL2_OUT_DIM 8 26 | 27 | #define CONV3_IM_DIM 8 28 | #define CONV3_IM_CH 16 29 | #define CONV3_KER_DIM 5 30 | #define CONV3_PADDING 2 31 | #define CONV3_STRIDE 1 32 | #define CONV3_OUT_CH 32 33 | #define CONV3_OUT_DIM 8 34 | 35 | #define POOL3_KER_DIM 3 36 | #define POOL3_STRIDE 2 37 | #define POOL3_PADDING 0 38 | #define POOL3_OUT_DIM 4 39 | 40 | #define IP1_DIM 4*4*32 41 | #define IP1_IM_DIM 4 42 | #define IP1_IM_CH 32 43 | #define IP1_OUT 10 44 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/StatisticsFunctions/power.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_power_f32( 4 | float32_t * pSrc, 5 | uint32_t blockSize, 6 | float32_t * pResult) 7 | { 8 | uint32_t i; 9 | float32_t sumsq=0; 10 | 11 | for(i=0;i> 14; 29 | } 30 | *pResult = sumsq; 31 | } 32 | 33 | void ref_power_q15( 34 | q15_t * pSrc, 35 | uint32_t blockSize, 36 | q63_t * pResult) 37 | { 38 | uint32_t i; 39 | q63_t sumsq=0; 40 | 41 | for(i=0;iattribute = (value); \ 25 | } while (0) 26 | 27 | #endif /* _JTEST_UTIL_H_ */ 28 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mag.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_cmplx_mag_f32( 4 | float32_t * pSrc, 5 | float32_t * pDst, 6 | uint32_t numSamples) 7 | { 8 | uint32_t i; 9 | 10 | for(i=0;i> 33); 27 | acc1 = (q31_t)(((q63_t)pSrc[i+1] * pSrc[i+1]) >> 33); 28 | out = acc0 + acc1; 29 | *pDst++ = (q31_t)(sqrtf((float)out / 2147483648.0f) * 2147483648.0f); 30 | } 31 | } 32 | 33 | void ref_cmplx_mag_q15( 34 | q15_t * pSrc, 35 | q15_t * pDst, 36 | uint32_t numSamples) 37 | { 38 | uint32_t i; 39 | q31_t acc0,acc1; 40 | q15_t out; 41 | 42 | for(i=0;i> 17); 47 | *pDst++ = (q15_t)(sqrtf((float)out / 32768.0f) * 32768.0f); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/StatisticsFunctions/mean.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_mean_f32( 4 | float32_t * pSrc, 5 | uint32_t blockSize, 6 | float32_t * pResult) 7 | { 8 | uint32_t i; 9 | float32_t sum=0; 10 | 11 | for(i=0;i> -shiftBits; 23 | } 24 | } 25 | } 26 | 27 | void ref_shift_q15( 28 | q15_t * pSrc, 29 | int8_t shiftBits, 30 | q15_t * pDst, 31 | uint32_t blockSize) 32 | { 33 | uint32_t i; 34 | 35 | if (shiftBits < 0) 36 | { 37 | for(i=0;i> -shiftBits; 47 | } 48 | } 49 | } 50 | 51 | void ref_shift_q7( 52 | q7_t * pSrc, 53 | int8_t shiftBits, 54 | q7_t * pDst, 55 | uint32_t blockSize) 56 | { 57 | uint32_t i; 58 | 59 | if (shiftBits < 0) 60 | { 61 | for(i=0;i> -shiftBits; 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/complex_math_tests/cmplx_mult_cmplx_tests.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "complex_math_test_data.h" 3 | #include "arr_desc.h" 4 | #include "arm_math.h" /* FUTs */ 5 | #include "ref.h" /* Reference Functions */ 6 | #include "test_templates.h" 7 | #include "complex_math_templates.h" 8 | #include "type_abbrev.h" 9 | 10 | #define JTEST_ARM_CMPLX_MULT_CMPLX_TEST(suffix) \ 11 | COMPLEX_MATH_DEFINE_TEST_TEMPLATE_BUF2_BLK( \ 12 | cmplx_mult_cmplx, \ 13 | suffix, \ 14 | TYPE_FROM_ABBREV(suffix), \ 15 | TYPE_FROM_ABBREV(suffix), \ 16 | COMPLEX_MATH_COMPARE_CMPLX_INTERFACE) 17 | 18 | JTEST_ARM_CMPLX_MULT_CMPLX_TEST(f32); 19 | JTEST_ARM_CMPLX_MULT_CMPLX_TEST(q31); 20 | JTEST_ARM_CMPLX_MULT_CMPLX_TEST(q15); 21 | 22 | /*--------------------------------------------------------------------------------*/ 23 | /* Collect all tests in a group. */ 24 | /*--------------------------------------------------------------------------------*/ 25 | 26 | JTEST_DEFINE_GROUP(cmplx_mult_cmplx_tests) 27 | { 28 | JTEST_TEST_CALL(arm_cmplx_mult_cmplx_f32_test); 29 | JTEST_TEST_CALL(arm_cmplx_mult_cmplx_q31_test); 30 | JTEST_TEST_CALL(arm_cmplx_mult_cmplx_q15_test); 31 | } 32 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/fast_math_tests/fast_math_tests.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "ref.h" 3 | #include "arr_desc.h" 4 | #include "fast_math_templates.h" 5 | #include "fast_math_test_data.h" 6 | #include "type_abbrev.h" 7 | 8 | SQRT_TEST_TEMPLATE_ELT1(q31); 9 | SQRT_TEST_TEMPLATE_ELT1(q15); 10 | 11 | SIN_COS_TEST_TEMPLATE_ELT1(f32, float32_t, sin); 12 | SIN_COS_TEST_TEMPLATE_ELT1(q31, q31_t, sin); 13 | SIN_COS_TEST_TEMPLATE_ELT1(q15, q15_t, sin); 14 | 15 | SIN_COS_TEST_TEMPLATE_ELT1(f32, float32_t, cos); 16 | SIN_COS_TEST_TEMPLATE_ELT1(q31, q31_t, cos); 17 | SIN_COS_TEST_TEMPLATE_ELT1(q15, q15_t, cos); 18 | 19 | /*--------------------------------------------------------------------------------*/ 20 | /* Collect all tests in a group */ 21 | /*--------------------------------------------------------------------------------*/ 22 | 23 | JTEST_DEFINE_GROUP(fast_math_tests) 24 | { 25 | /* 26 | To skip a test, comment it out. 27 | */ 28 | JTEST_TEST_CALL(arm_sqrt_q31_test); 29 | JTEST_TEST_CALL(arm_sqrt_q15_test); 30 | 31 | JTEST_TEST_CALL(arm_sin_f32_test); 32 | JTEST_TEST_CALL(arm_sin_q31_test); 33 | JTEST_TEST_CALL(arm_sin_q15_test); 34 | 35 | JTEST_TEST_CALL(arm_cos_f32_test); 36 | JTEST_TEST_CALL(arm_cos_q31_test); 37 | JTEST_TEST_CALL(arm_cos_q15_test); 38 | } 39 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/dot_prod.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_dot_prod_f32( 4 | float32_t * pSrcA, 5 | float32_t * pSrcB, 6 | uint32_t blockSize, 7 | float32_t * result) 8 | { 9 | uint32_t i; 10 | float32_t sum = 0.0f; 11 | 12 | for(i=0;i> 14; //16.48 31 | } 32 | *result = sum; 33 | } 34 | 35 | void ref_dot_prod_q15( 36 | q15_t * pSrcA, 37 | q15_t * pSrcB, 38 | uint32_t blockSize, 39 | q63_t * result) 40 | { 41 | uint32_t i; 42 | q63_t sum = 0.0f; 43 | 44 | for(i=0;i> 32; 30 | tempI = ((q63_t) pSrcCmplx[2*i+1] * pSrcReal[i]) >> 32; 31 | pCmplxDst[2*i+0] = ref_sat_n(tempR, 31) << 1; 32 | pCmplxDst[2*i+1] = ref_sat_n(tempI, 31) << 1; 33 | } 34 | } 35 | 36 | void ref_cmplx_mult_real_q15( 37 | q15_t * pSrcCmplx, 38 | q15_t * pSrcReal, 39 | q15_t * pCmplxDst, 40 | uint32_t numSamples) 41 | { 42 | uint32_t i; 43 | q31_t tempR, tempI; 44 | 45 | for(i=0;i> 15; 48 | tempI = ((q31_t) pSrcCmplx[2*i+1] * pSrcReal[i]) >> 15; 49 | pCmplxDst[2*i+0] = ref_sat_q15(tempR); 50 | pCmplxDst[2*i+1] = ref_sat_q15(tempI); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/basic_math_tests/mult_tests.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "basic_math_test_data.h" 3 | #include "arr_desc.h" 4 | #include "arm_math.h" /* FUTs */ 5 | #include "ref.h" /* Reference Functions */ 6 | #include "test_templates.h" 7 | #include "basic_math_templates.h" 8 | #include "type_abbrev.h" 9 | 10 | #define JTEST_ARM_MULT_TEST(suffix, compare_interface) \ 11 | BASIC_MATH_DEFINE_TEST_TEMPLATE_BUF2_BLK( \ 12 | mult, \ 13 | suffix, \ 14 | TYPE_FROM_ABBREV(suffix), \ 15 | TYPE_FROM_ABBREV(suffix), \ 16 | compare_interface) 17 | 18 | JTEST_ARM_MULT_TEST(f32, BASIC_MATH_COMPARE_INTERFACE); 19 | JTEST_ARM_MULT_TEST(q31, BASIC_MATH_SNR_COMPARE_INTERFACE); 20 | JTEST_ARM_MULT_TEST(q15, BASIC_MATH_COMPARE_INTERFACE); 21 | JTEST_ARM_MULT_TEST(q7 , BASIC_MATH_COMPARE_INTERFACE); 22 | 23 | /*--------------------------------------------------------------------------------*/ 24 | /* Collect all tests in a group. */ 25 | /*--------------------------------------------------------------------------------*/ 26 | 27 | JTEST_DEFINE_GROUP(mult_tests) 28 | { 29 | JTEST_TEST_CALL(arm_mult_f32_test); 30 | JTEST_TEST_CALL(arm_mult_q31_test); 31 | JTEST_TEST_CALL(arm_mult_q15_test); 32 | JTEST_TEST_CALL(arm_mult_q7_test); 33 | } 34 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/SupportFunctions/fixed_to_fixed.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_q31_to_q15( 4 | q31_t * pSrc, 5 | q15_t * pDst, 6 | uint32_t blockSize) 7 | { 8 | uint32_t i; 9 | 10 | for(i=0;i> 16; 13 | } 14 | } 15 | 16 | void ref_q31_to_q7( 17 | q31_t * pSrc, 18 | q7_t * pDst, 19 | uint32_t blockSize) 20 | { 21 | uint32_t i; 22 | 23 | for(i=0;i> 24; 26 | } 27 | } 28 | 29 | void ref_q15_to_q31( 30 | q15_t * pSrc, 31 | q31_t * pDst, 32 | uint32_t blockSize) 33 | { 34 | uint32_t i; 35 | 36 | for(i=0;i> 8; 52 | } 53 | } 54 | 55 | void ref_q7_to_q31( 56 | q7_t * pSrc, 57 | q31_t * pDst, 58 | uint32_t blockSize) 59 | { 60 | uint32_t i; 61 | 62 | for(i=0;i> 32; 29 | temp = temp << 1; 30 | pDst[i] = ref_sat_q31(temp); 31 | } 32 | } 33 | 34 | void ref_mult_q15( 35 | q15_t * pSrcA, 36 | q15_t * pSrcB, 37 | q15_t * pDst, 38 | uint32_t blockSize) 39 | { 40 | uint32_t i; 41 | q31_t temp; 42 | 43 | for(i=0;i> 15; //this comment is for JD, this is specifically 15 and not 16 like the q31 case might imply. This is because CMSIS DSP lib does it this way. No other reason. 46 | pDst[i] = ref_sat_q15(temp); 47 | } 48 | } 49 | 50 | void ref_mult_q7( 51 | q7_t * pSrcA, 52 | q7_t * pSrcB, 53 | q7_t * pDst, 54 | uint32_t blockSize) 55 | { 56 | uint32_t i; 57 | q15_t temp; 58 | 59 | for(i=0;i> 7; 62 | pDst[i] = ref_sat_q7(temp); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/inc/jtest_define.h: -------------------------------------------------------------------------------- 1 | #ifndef _JTEST_DEFINE_H_ 2 | #define _JTEST_DEFINE_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Macros and Defines */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | /** 9 | * Makes a symbol for use as a struct name. Names made this way have two parts; 10 | * the first parts is a prefix common to all structs of that class. The second 11 | * is a specifier which differs for each instance of that struct type. 12 | */ 13 | #define JTEST_STRUCT_NAME(prefix, specifier) \ 14 | CONCAT(prefix, specifier) 15 | 16 | /** 17 | * Define a struct with type with a name generated by #JTEST_STRUCT_NAME(). 18 | */ 19 | #define JTEST_DEFINE_STRUCT(type, struct_name) \ 20 | type struct_name 21 | 22 | /** 23 | * Declare a struct with type with a name generated by #JTEST_STRUCT_NAME(). 24 | */ 25 | #define JTEST_DECLARE_STRUCT(struct_definition) \ 26 | extern struct_definition 27 | 28 | /** 29 | * Define and initialize a struct (created with JTEST_DEFINE_STRUCT()) and 30 | * initialize it with init_values. 31 | */ 32 | #define JTEST_INIT_STRUCT(struct_definition, init_values) \ 33 | struct_definition = { \ 34 | init_values \ 35 | } 36 | 37 | #endif /* _JTEST_DEFINE_H_ */ 38 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/complex_math_tests/cmplx_mag_tests.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "complex_math_test_data.h" 3 | #include "arr_desc.h" 4 | #include "arm_math.h" /* FUTs */ 5 | #include "ref.h" /* Reference Functions */ 6 | #include "test_templates.h" 7 | #include "complex_math_templates.h" 8 | #include "type_abbrev.h" 9 | 10 | #define JTEST_ARM_CMPLX_MAG_TEST(suffix, comparison_interface) \ 11 | COMPLEX_MATH_DEFINE_TEST_TEMPLATE_BUF1_BLK( \ 12 | cmplx_mag, \ 13 | suffix, \ 14 | TYPE_FROM_ABBREV(suffix), \ 15 | TYPE_FROM_ABBREV(suffix), \ 16 | comparison_interface) 17 | 18 | JTEST_ARM_CMPLX_MAG_TEST(f32, COMPLEX_MATH_COMPARE_RE_INTERFACE); 19 | JTEST_ARM_CMPLX_MAG_TEST(q31, COMPLEX_MATH_SNR_COMPARE_RE_INTERFACE); 20 | JTEST_ARM_CMPLX_MAG_TEST(q15, COMPLEX_MATH_SNR_COMPARE_RE_INTERFACE); 21 | 22 | /*--------------------------------------------------------------------------------*/ 23 | /* Collect all tests in a group. */ 24 | /*--------------------------------------------------------------------------------*/ 25 | 26 | JTEST_DEFINE_GROUP(cmplx_mag_tests) 27 | { 28 | JTEST_TEST_CALL(arm_cmplx_mag_f32_test); 29 | JTEST_TEST_CALL(arm_cmplx_mag_q31_test); 30 | JTEST_TEST_CALL(arm_cmplx_mag_q15_test); 31 | } 32 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/JTest/inc/util/util.h: -------------------------------------------------------------------------------- 1 | #ifndef _UTIL_H_ 2 | #define _UTIL_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Macros and Defines */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | /** 9 | * Convert a symbol to a string and add a 'NewLine'. 10 | */ 11 | #define STR_NL(x) STR1_NL(x) 12 | #define STR1_NL(x) (STR2_NL(x)"\n") 13 | #define STR2_NL(x) #x 14 | 15 | /** 16 | * Convert a symbol to a string. 17 | */ 18 | #define STR(x) STR1(x) 19 | #define STR1(x) STR2(x) 20 | #define STR2(x) #x 21 | 22 | /** 23 | * Concatenate two symbols. 24 | */ 25 | #define CONCAT(a, b) CONCAT1(a, b) 26 | #define CONCAT1(a, b) CONCAT2(a, b) 27 | #define CONCAT2(a, b) a##b 28 | 29 | 30 | /** 31 | * Place curly braces around a varaible number of macro arguments. 32 | */ 33 | #define CURLY(...) {__VA_ARGS__} 34 | 35 | /** 36 | * Place parenthesis around a variable number of macro arguments. 37 | */ 38 | #define PAREN(...) (__VA_ARGS__) 39 | 40 | /* Standard min/max macros. */ 41 | #define MIN(x,y) (((x) < (y)) ? (x) : (y) ) 42 | #define MAX(x,y) (((x) > (y)) ? (x) : (y) ) 43 | 44 | /** 45 | * Bound value using low and high limits. 46 | * 47 | * Evaluate to a number in the range, endpoint inclusive. 48 | */ 49 | #define BOUND(low, high, value) \ 50 | MAX(MIN(high, value), low) 51 | 52 | #endif /* _UTIL_H_ */ 53 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/StatisticsFunctions/var.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_var_f32( 4 | float32_t * pSrc, 5 | uint32_t blockSize, 6 | float32_t * pResult) 7 | { 8 | uint32_t i; 9 | float32_t sum=0, sumsq=0; 10 | 11 | if (blockSize == 1) 12 | { 13 | *pResult = 0; 14 | return; 15 | } 16 | 17 | for(i=0;i> 8; 43 | sum += in; 44 | sumsq += (q63_t)in * in; 45 | } 46 | *pResult = (sumsq - sum * sum / (q31_t)blockSize) / ((q31_t)blockSize - 1) >> 15; 47 | } 48 | 49 | void ref_var_q15( 50 | q15_t * pSrc, 51 | uint32_t blockSize, 52 | q15_t * pResult) 53 | { 54 | uint32_t i; 55 | q31_t sum=0; 56 | q63_t sumsq=0; 57 | 58 | if (blockSize == 1) 59 | { 60 | *pResult = 0; 61 | return; 62 | } 63 | 64 | for(i=0;i> 15; 70 | } 71 | -------------------------------------------------------------------------------- /.github/workflows/cmake.yml: -------------------------------------------------------------------------------- 1 | name: CMake 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | env: 10 | # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) 11 | BUILD_TYPE: Release 12 | 13 | jobs: 14 | build: 15 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. 16 | # You can convert this to a matrix build if you need cross-platform coverage. 17 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | - uses: cachix/install-nix-action@v22 23 | with: 24 | nix_path: nixpkgs=channel:nixos-unstable 25 | - uses: rrbutani/use-nix-shell-action@v1 26 | with: 27 | file: shell.nix 28 | 29 | - name: Configure CMake 30 | # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. 31 | # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type 32 | run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=arm-none-eabi-gcc.cmake 33 | 34 | - name: Build 35 | # Build your program with the given configuration 36 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} 37 | 38 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/MatrixFunctions/mat_inverse.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | arm_status ref_mat_inverse_f32( 4 | const arm_matrix_instance_f32 * pSrc, 5 | arm_matrix_instance_f32 * pDst) 6 | { 7 | float32_t det; 8 | uint32_t i, size; 9 | arm_matrix_instance_f32 tmp; 10 | 11 | tmp.numCols = pSrc->numCols; 12 | tmp.numRows = pSrc->numRows; 13 | tmp.pData = scratchArray; 14 | 15 | det = ref_detrm(pSrc->pData,scratchArray,pSrc->numCols); 16 | 17 | size = pSrc->numCols * pSrc->numCols; 18 | 19 | ref_cofact(pSrc->pData,scratchArray,scratchArray + size,pSrc->numCols); 20 | 21 | ref_mat_trans_f32(&tmp,pDst); 22 | 23 | for(i=0;ipData[i] /= det; 26 | } 27 | 28 | return ARM_MATH_SUCCESS; 29 | } 30 | 31 | arm_status ref_mat_inverse_f64( 32 | const arm_matrix_instance_f64 * pSrc, 33 | arm_matrix_instance_f64 * pDst) 34 | { 35 | float64_t det; 36 | uint32_t i, size; 37 | arm_matrix_instance_f64 tmp; 38 | 39 | tmp.numCols = pSrc->numCols; 40 | tmp.numRows = pSrc->numRows; 41 | tmp.pData = (float64_t*)scratchArray; 42 | 43 | det = ref_detrm64(pSrc->pData,(float64_t*)scratchArray,pSrc->numCols); 44 | 45 | size = pSrc->numCols * pSrc->numCols; 46 | 47 | ref_cofact64(pSrc->pData,(float64_t*)scratchArray,(float64_t*)scratchArray + size,pSrc->numCols); 48 | 49 | ref_mat_trans_f64(&tmp,pDst); 50 | 51 | for(i=0;ipData[i] /= det; 54 | } 55 | 56 | return ARM_MATH_SUCCESS; 57 | } 58 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mult_cmplx.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_cmplx_mult_cmplx_f32( 4 | float32_t * pSrcA, 5 | float32_t * pSrcB, 6 | float32_t * pDst, 7 | uint32_t numSamples) 8 | { 9 | uint32_t i; 10 | 11 | for(i=0;i> 33; 30 | mul2 = ((q63_t)pSrcA[i+1] * pSrcB[i+1]) >> 33; 31 | mul3 = ((q63_t)pSrcA[i] * pSrcB[i+1]) >> 33; 32 | mul4 = ((q63_t)pSrcA[i+1] * pSrcB[i]) >> 33; 33 | pDst[i] = mul1 - mul2; 34 | pDst[i+1] = mul3 + mul4; 35 | } 36 | } 37 | 38 | void ref_cmplx_mult_cmplx_q15( 39 | q15_t * pSrcA, 40 | q15_t * pSrcB, 41 | q15_t * pDst, 42 | uint32_t numSamples) 43 | { 44 | uint32_t i; 45 | q31_t mul1, mul2, mul3, mul4; 46 | 47 | for(i=0;i> 17; 50 | mul2 = ((q31_t)pSrcA[i+1] * pSrcB[i+1]) >> 17; 51 | mul3 = ((q31_t)pSrcA[i] * pSrcB[i+1]) >> 17; 52 | mul4 = ((q31_t)pSrcA[i+1] * pSrcB[i]) >> 17; 53 | pDst[i] = mul1 - mul2; 54 | pDst[i+1] = mul3 + mul4; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/complex_math_tests/cmplx_dot_prod_tests.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "complex_math_test_data.h" 3 | #include "arr_desc.h" 4 | #include "arm_math.h" /* FUTs */ 5 | #include "ref.h" /* Reference Functions */ 6 | #include "test_templates.h" 7 | #include "complex_math_templates.h" 8 | #include "type_abbrev.h" 9 | 10 | #define JTEST_ARM_CMPLX_DOT_PROD_TEST(suffix, comparison_interface) \ 11 | COMPLEX_MATH_DEFINE_TEST_TEMPLATE_BUF2_BLK( \ 12 | cmplx_dot_prod, \ 13 | suffix, \ 14 | TYPE_FROM_ABBREV(suffix), \ 15 | TYPE_FROM_ABBREV(suffix), \ 16 | comparison_interface) 17 | 18 | JTEST_ARM_CMPLX_DOT_PROD_TEST(f32, COMPLEX_MATH_SNR_COMPARE_SPLIT_INTERFACE); 19 | JTEST_ARM_CMPLX_DOT_PROD_TEST(q31, COMPLEX_MATH_SNR_COMPARE_SPLIT_INTERFACE); 20 | JTEST_ARM_CMPLX_DOT_PROD_TEST(q15, COMPLEX_MATH_SNR_COMPARE_SPLIT_INTERFACE); 21 | 22 | /*--------------------------------------------------------------------------------*/ 23 | /* Collect all tests in a group. */ 24 | /*--------------------------------------------------------------------------------*/ 25 | 26 | JTEST_DEFINE_GROUP(cmplx_dot_prod_tests) 27 | { 28 | JTEST_TEST_CALL(arm_cmplx_dot_prod_f32_test); 29 | JTEST_TEST_CALL(arm_cmplx_dot_prod_q31_test); 30 | JTEST_TEST_CALL(arm_cmplx_dot_prod_q15_test); 31 | } 32 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/platform/ARMCC/Retarget.c: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------- 2 | * Name: Retarget.c 3 | * Purpose: 'Retarget' layer for target-dependent low level functions 4 | * Note(s): 5 | *---------------------------------------------------------------------------- 6 | * This file is part of the uVision/ARM development tools. 7 | * This software may only be used under the terms of a valid, current, 8 | * end user licence from KEIL for a compatible version of KEIL software 9 | * development tools. Nothing else gives you the right to use this software. 10 | * 11 | * This software is supplied "AS IS" without warranties of any kind. 12 | * 13 | * Copyright (c) 2011 Keil - An ARM Company. All rights reserved. 14 | *----------------------------------------------------------------------------*/ 15 | 16 | #include 17 | #include 18 | #include "Serial.h" 19 | 20 | #pragma import(__use_no_semihosting_swi) 21 | 22 | 23 | 24 | struct __FILE { int handle; /* Add whatever you need here */ }; 25 | FILE __stdout; 26 | FILE __stdin; 27 | 28 | 29 | int fputc(int c, FILE *f) { 30 | return (SER_PutChar(c)); 31 | } 32 | 33 | 34 | int fgetc(FILE *f) { 35 | return (SER_GetChar()); 36 | } 37 | 38 | 39 | int ferror(FILE *f) { 40 | /* Your implementation of ferror */ 41 | return EOF; 42 | } 43 | 44 | 45 | void _ttywrch(int c) { 46 | SER_PutChar(c); 47 | } 48 | 49 | 50 | void _sys_exit(int return_code) { 51 | label: goto label; /* endless loop */ 52 | } 53 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/complex_math_tests/cmplx_mult_real_test.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "complex_math_test_data.h" 3 | #include "arr_desc.h" 4 | #include "arm_math.h" /* FUTs */ 5 | #include "ref.h" /* Reference Functions */ 6 | #include "test_templates.h" 7 | #include "complex_math_templates.h" 8 | #include "type_abbrev.h" 9 | 10 | #define JTEST_ARM_CMPLX_MULT_REAL_TEST(suffix, comparison_interface) \ 11 | COMPLEX_MATH_DEFINE_TEST_TEMPLATE_BUF2_BLK( \ 12 | cmplx_mult_real, \ 13 | suffix, \ 14 | TYPE_FROM_ABBREV(suffix), \ 15 | TYPE_FROM_ABBREV(suffix), \ 16 | comparison_interface) 17 | 18 | JTEST_ARM_CMPLX_MULT_REAL_TEST(f32, COMPLEX_MATH_COMPARE_CMPLX_INTERFACE); 19 | JTEST_ARM_CMPLX_MULT_REAL_TEST(q31, COMPLEX_MATH_SNR_COMPARE_CMPLX_INTERFACE); 20 | JTEST_ARM_CMPLX_MULT_REAL_TEST(q15, COMPLEX_MATH_COMPARE_CMPLX_INTERFACE); 21 | 22 | /*--------------------------------------------------------------------------------*/ 23 | /* Collect all tests in a group. */ 24 | /*--------------------------------------------------------------------------------*/ 25 | 26 | JTEST_DEFINE_GROUP(cmplx_mult_real_tests) 27 | { 28 | JTEST_TEST_CALL(arm_cmplx_mult_real_f32_test); 29 | JTEST_TEST_CALL(arm_cmplx_mult_real_q31_test); 30 | JTEST_TEST_CALL(arm_cmplx_mult_real_q15_test); 31 | } 32 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/StatisticsFunctions/max.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_max_f32( 4 | float32_t * pSrc, 5 | uint32_t blockSize, 6 | float32_t * pResult, 7 | uint32_t * pIndex) 8 | { 9 | uint32_t i, ind=0; 10 | float32_t max=-FLT_MAX; 11 | 12 | for(i=0;i pSrc[i]) 15 | { 16 | min = pSrc[i]; 17 | ind = i; 18 | } 19 | } 20 | *pResult = min; 21 | *pIndex = ind; 22 | } 23 | 24 | void ref_min_q31( 25 | q31_t * pSrc, 26 | uint32_t blockSize, 27 | q31_t * pResult, 28 | uint32_t * pIndex) 29 | { 30 | uint32_t i, ind=0; 31 | q31_t min=INT_MAX; 32 | 33 | for(i=0;i pSrc[i]) 36 | { 37 | min = pSrc[i]; 38 | ind = i; 39 | } 40 | } 41 | *pResult = min; 42 | *pIndex = ind; 43 | } 44 | 45 | void ref_min_q15( 46 | q15_t * pSrc, 47 | uint32_t blockSize, 48 | q15_t * pResult, 49 | uint32_t * pIndex) 50 | { 51 | uint32_t i, ind=0; 52 | q15_t min=SHRT_MAX; 53 | 54 | for(i=0;i pSrc[i]) 57 | { 58 | min = pSrc[i]; 59 | ind = i; 60 | } 61 | } 62 | *pResult = min; 63 | *pIndex = ind; 64 | } 65 | 66 | void ref_min_q7( 67 | q7_t * pSrc, 68 | uint32_t blockSize, 69 | q7_t * pResult, 70 | uint32_t * pIndex) 71 | { 72 | uint32_t i, ind=0; 73 | q7_t min=SCHAR_MAX; 74 | 75 | for(i=0;i pSrc[i]) 78 | { 79 | min = pSrc[i]; 80 | ind = i; 81 | } 82 | } 83 | *pResult = min; 84 | *pIndex = ind; 85 | } 86 | -------------------------------------------------------------------------------- /Drivers/STM32F1xx_HAL_Driver/License.md: -------------------------------------------------------------------------------- 1 | Copyright 2016(-2021) STMicroelectronics. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/StatisticsFunctions/rms.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_rms_f32( 4 | float32_t * pSrc, 5 | uint32_t blockSize, 6 | float32_t * pResult) 7 | { 8 | uint32_t i; 9 | float32_t sumsq=0; 10 | 11 | for(i=0;i> 31; 35 | tmp2 = ref_sat_q31(tmp1); 36 | 37 | /* GCC M0 problem: __aeabi_f2iz(QNAN) returns not 0 */ 38 | help_float = (sqrtf((float)tmp2 / 2147483648.0f) * 2147483648.0f); 39 | /* Checking for a NAN value in help_float */ 40 | if (((*((int *)(&help_float))) & 0x7FC00000) == 0x7FC00000) { 41 | help_float = 0; 42 | } 43 | *pResult = (q31_t)(help_float); 44 | 45 | // *pResult = (q31_t)(sqrtf((float)tmp2 / 2147483648.0f) * 2147483648.0f); 46 | } 47 | 48 | void ref_rms_q15( 49 | q15_t * pSrc, 50 | uint32_t blockSize, 51 | q15_t * pResult) 52 | { 53 | uint32_t i; 54 | q63_t sumsq=0; 55 | q31_t tmp1; 56 | q15_t tmp2; 57 | 58 | for(i=0;i> 15; 63 | tmp2 = ref_sat_q15(tmp1); 64 | *pResult = (q15_t)(sqrtf((float)tmp2 / 32768.0f) * 32768.0f); 65 | } 66 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/controller_tests/controller_test_data.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONTROLLER_TEST_DATA_H_ 2 | #define _CONTROLLER_TEST_DATA_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Includes */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | #include "arm_math.h" 9 | 10 | /*--------------------------------------------------------------------------------*/ 11 | /* Macros and Defines */ 12 | /*--------------------------------------------------------------------------------*/ 13 | 14 | #define CONTROLLER_MAX_LEN 1024 15 | #define CONTROLLER_MAX_COEFFS_LEN (12 * 3) 16 | #define TRANFORM_BIGGEST_INPUT_TYPE float32_t 17 | 18 | /*--------------------------------------------------------------------------------*/ 19 | /* Variable Declarations */ 20 | /*--------------------------------------------------------------------------------*/ 21 | 22 | extern float32_t controller_output_fut[CONTROLLER_MAX_LEN]; 23 | extern float32_t controller_output_ref[CONTROLLER_MAX_LEN]; 24 | extern float32_t controller_output_f32_fut[CONTROLLER_MAX_LEN]; 25 | extern float32_t controller_output_f32_ref[CONTROLLER_MAX_LEN]; 26 | extern const float32_t controller_f32_inputs[CONTROLLER_MAX_LEN]; 27 | extern const q31_t controller_q31_inputs[CONTROLLER_MAX_LEN]; 28 | extern const q15_t * controller_q15_inputs; 29 | extern const float32_t controller_f32_coeffs[CONTROLLER_MAX_COEFFS_LEN]; 30 | extern const q31_t controller_q31_coeffs[CONTROLLER_MAX_COEFFS_LEN]; 31 | extern const q15_t controller_q15_coeffs[CONTROLLER_MAX_COEFFS_LEN]; 32 | 33 | #endif /* _CONTROLLER_TEST_DATA_H_ */ 34 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/BasicMathFunctions/scale.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_scale_f32( 4 | float32_t * pSrc, 5 | float32_t scale, 6 | float32_t * pDst, 7 | uint32_t blockSize) 8 | { 9 | uint32_t i; 10 | 11 | for(i=0;i> 32; 32 | if (sign) 33 | pDst[i] = temp >> -kShift; 34 | else 35 | pDst[i] = ref_sat_q31( (q63_t)temp << kShift ); 36 | } 37 | } 38 | 39 | void ref_scale_q15( 40 | q15_t * pSrc, 41 | q15_t scaleFract, 42 | int8_t shift, 43 | q15_t * pDst, 44 | uint32_t blockSize) 45 | { 46 | uint32_t i; 47 | int8_t kShift = 15 - shift; /* Shift to apply after scaling */ 48 | 49 | for(i=0;i> kShift); 52 | } 53 | } 54 | 55 | void ref_scale_q7( 56 | q7_t * pSrc, 57 | q7_t scaleFract, 58 | int8_t shift, 59 | q7_t * pDst, 60 | uint32_t blockSize) 61 | { 62 | uint32_t i; 63 | int8_t kShift = 7 - shift; /* Shift to apply after scaling */ 64 | 65 | for(i=0;i> kShift); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/statistics_tests/statistics_test_data.h: -------------------------------------------------------------------------------- 1 | #ifndef _STATISTICS_TEST_DATA_H_ 2 | #define _STATISTICS_TEST_DATA_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Includes */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | #include "arr_desc.h" 9 | #include "arm_math.h" 10 | 11 | /*--------------------------------------------------------------------------------*/ 12 | /* Macros and Defines */ 13 | /*--------------------------------------------------------------------------------*/ 14 | #define STATISTICS_MAX_INPUT_ELEMENTS 32 15 | #define STATISTICS_BIGGEST_INPUT_TYPE float32_t 16 | 17 | /*--------------------------------------------------------------------------------*/ 18 | /* Declare Variables */ 19 | /*--------------------------------------------------------------------------------*/ 20 | 21 | /* Input/Output Buffers */ 22 | ARR_DESC_DECLARE(statistics_output_fut); 23 | ARR_DESC_DECLARE(statistics_output_ref); 24 | extern uint32_t statistics_idx_fut; 25 | extern uint32_t statistics_idx_ref; 26 | 27 | extern STATISTICS_BIGGEST_INPUT_TYPE 28 | statistics_output_f32_ref[STATISTICS_MAX_INPUT_ELEMENTS]; 29 | 30 | extern STATISTICS_BIGGEST_INPUT_TYPE 31 | statistics_output_f32_fut[STATISTICS_MAX_INPUT_ELEMENTS]; 32 | 33 | 34 | /* Block Sizes */ 35 | ARR_DESC_DECLARE(statistics_block_sizes); 36 | 37 | /* Float Inputs */ 38 | ARR_DESC_DECLARE(statistics_zeros); 39 | ARR_DESC_DECLARE(statistics_f_2); 40 | ARR_DESC_DECLARE(statistics_f_15); 41 | ARR_DESC_DECLARE(statistics_f_32); 42 | ARR_DESC_DECLARE(statistics_f_all); 43 | 44 | #endif /* _STATISTICS_TEST_DATA_H_ */ 45 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/StatisticsFunctions/std.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_std_f32( 4 | float32_t * pSrc, 5 | uint32_t blockSize, 6 | float32_t * pResult) 7 | { 8 | uint32_t i; 9 | float32_t sum=0, sumsq=0; 10 | 11 | if (blockSize == 1) 12 | { 13 | *pResult = 0; 14 | return; 15 | } 16 | 17 | for(i=0;i> 8; 43 | sum += in; 44 | sumsq += (q63_t)in * in; 45 | } 46 | sumsq /= (q63_t)(blockSize - 1); 47 | sum = sum * sum / (q63_t)(blockSize * (blockSize - 1)); 48 | *pResult = (q31_t)(sqrtf((float)( (sumsq - sum) >> 15) / 2147483648.0f ) * 2147483648.0f); 49 | } 50 | 51 | void ref_std_q15( 52 | q15_t * pSrc, 53 | uint32_t blockSize, 54 | q15_t * pResult) 55 | { 56 | uint32_t i; 57 | q31_t sum=0; 58 | q63_t sumsq=0; 59 | 60 | if (blockSize == 1) 61 | { 62 | *pResult = 0; 63 | return; 64 | } 65 | 66 | for(i=0;i> 15) / 32768.0f ) * 32768.0f); 74 | } 75 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/basic_math_tests/basic_math_test_data.h: -------------------------------------------------------------------------------- 1 | #ifndef ARM_BASIC_MATH_TEST_DATA_H 2 | #define ARM_BASIC_MATH_TEST_DATA_H 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Includes */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | #include "arr_desc.h" 9 | #include "arm_math.h" 10 | 11 | /*--------------------------------------------------------------------------------*/ 12 | /* Macros and Defines */ 13 | /*--------------------------------------------------------------------------------*/ 14 | #define BASIC_MATH_MAX_INPUT_ELEMENTS 32 15 | #define BASIC_MATH_BIGGEST_INPUT_TYPE float32_t 16 | 17 | /*--------------------------------------------------------------------------------*/ 18 | /* Declare Variables */ 19 | /*--------------------------------------------------------------------------------*/ 20 | 21 | /* Input/Output Buffers */ 22 | ARR_DESC_DECLARE(basic_math_output_fut); 23 | ARR_DESC_DECLARE(basic_math_output_ref); 24 | 25 | extern BASIC_MATH_BIGGEST_INPUT_TYPE 26 | basic_math_output_f32_ref[BASIC_MATH_MAX_INPUT_ELEMENTS]; 27 | 28 | extern BASIC_MATH_BIGGEST_INPUT_TYPE 29 | basic_math_output_f32_fut[BASIC_MATH_MAX_INPUT_ELEMENTS]; 30 | 31 | /* Block Sizes*/ 32 | ARR_DESC_DECLARE(basic_math_block_sizes); 33 | 34 | /* Numbers */ 35 | ARR_DESC_DECLARE(basic_math_elts); 36 | ARR_DESC_DECLARE(basic_math_elts2); 37 | ARR_DESC_DECLARE(basic_math_eltsf); 38 | 39 | /* Float Inputs */ 40 | ARR_DESC_DECLARE(basic_math_zeros); 41 | ARR_DESC_DECLARE(basic_math_f_2); 42 | ARR_DESC_DECLARE(basic_math_f_15); 43 | ARR_DESC_DECLARE(basic_math_f_32); 44 | ARR_DESC_DECLARE(basic_math_f_all); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/MatrixFunctions/mat_trans.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | arm_status ref_mat_trans_f64( 4 | const arm_matrix_instance_f64 * pSrc, 5 | arm_matrix_instance_f64 * pDst) 6 | { 7 | uint64_t r,c; 8 | uint64_t numR = pSrc->numRows; 9 | uint64_t numC = pSrc->numCols; 10 | 11 | for(r=0;rpData[c*numR + r] = pSrc->pData[r*numC + c]; 16 | } 17 | } 18 | 19 | return ARM_MATH_SUCCESS; 20 | } 21 | 22 | arm_status ref_mat_trans_f32( 23 | const arm_matrix_instance_f32 * pSrc, 24 | arm_matrix_instance_f32 * pDst) 25 | { 26 | uint32_t r,c; 27 | uint32_t numR = pSrc->numRows; 28 | uint32_t numC = pSrc->numCols; 29 | 30 | for(r=0;rpData[c*numR + r] = pSrc->pData[r*numC + c]; 35 | } 36 | } 37 | 38 | return ARM_MATH_SUCCESS; 39 | } 40 | 41 | arm_status ref_mat_trans_q31( 42 | const arm_matrix_instance_q31 * pSrc, 43 | arm_matrix_instance_q31 * pDst) 44 | { 45 | uint32_t r,c; 46 | uint32_t numR = pSrc->numRows; 47 | uint32_t numC = pSrc->numCols; 48 | 49 | for(r=0;rpData[c*numR + r] = pSrc->pData[r*numC + c]; 54 | } 55 | } 56 | 57 | return ARM_MATH_SUCCESS; 58 | } 59 | 60 | arm_status ref_mat_trans_q15( 61 | const arm_matrix_instance_q15 * pSrc, 62 | arm_matrix_instance_q15 * pDst) 63 | { 64 | uint32_t r,c; 65 | uint32_t numR = pSrc->numRows; 66 | uint32_t numC = pSrc->numCols; 67 | 68 | for(r=0;rpData[c*numR + r] = pSrc->pData[r*numC + c]; 73 | } 74 | } 75 | 76 | return ARM_MATH_SUCCESS; 77 | } 78 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q15.c 4 | * Description: Q15 PID Control reset function 5 | * 6 | * $Date: 27. January 2017 7 | * $Revision: V.1.5.1 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | * @addtogroup PID 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Reset function for the Q15 PID Control. 38 | * @param[in] *S Instance pointer of PID control data structure. 39 | * @return none. 40 | * \par Description: 41 | * The function resets the state buffer to zeros. 42 | */ 43 | void arm_pid_reset_q15( 44 | arm_pid_instance_q15 * S) 45 | { 46 | /* Reset state to zero, The size will be always 3 samples */ 47 | memset(S->state, 0, 3U * sizeof(q15_t)); 48 | } 49 | 50 | /** 51 | * @} end of PID group 52 | */ 53 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_q31.c 4 | * Description: Q31 PID Control reset function 5 | * 6 | * $Date: 27. January 2017 7 | * $Revision: V.1.5.1 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | * @addtogroup PID 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Reset function for the Q31 PID Control. 38 | * @param[in] *S Instance pointer of PID control data structure. 39 | * @return none. 40 | * \par Description: 41 | * The function resets the state buffer to zeros. 42 | */ 43 | void arm_pid_reset_q31( 44 | arm_pid_instance_q31 * S) 45 | { 46 | 47 | /* Clear the state buffer. The size will be always 3 samples */ 48 | memset(S->state, 0, 3U * sizeof(q31_t)); 49 | } 50 | 51 | /** 52 | * @} end of PID group 53 | */ 54 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_pid_reset_f32.c 4 | * Description: Floating-point PID Control reset function 5 | * 6 | * $Date: 27. January 2017 7 | * $Revision: V.1.5.1 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | * @addtogroup PID 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Reset function for the floating-point PID Control. 38 | * @param[in] *S Instance pointer of PID control data structure. 39 | * @return none. 40 | * \par Description: 41 | * The function resets the state buffer to zeros. 42 | */ 43 | void arm_pid_reset_f32( 44 | arm_pid_instance_f32 * S) 45 | { 46 | 47 | /* Clear the state buffer. The size will be always 3 samples */ 48 | memset(S->state, 0, 3U * sizeof(float32_t)); 49 | } 50 | 51 | /** 52 | * @} end of PID group 53 | */ 54 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/MatrixFunctions/mat_add.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | arm_status ref_mat_add_f32( 4 | const arm_matrix_instance_f32 * pSrcA, 5 | const arm_matrix_instance_f32 * pSrcB, 6 | arm_matrix_instance_f32 * pDst) 7 | { 8 | uint32_t i; 9 | uint32_t numSamples; /* total number of elements in the matrix */ 10 | 11 | /* Total number of samples in the input matrix */ 12 | numSamples = (uint32_t) pSrcA->numRows * pSrcA->numCols; 13 | 14 | for(i=0;ipData[i] = pSrcA->pData[i] + pSrcB->pData[i]; 17 | } 18 | 19 | return ARM_MATH_SUCCESS; 20 | } 21 | 22 | arm_status ref_mat_add_q31( 23 | const arm_matrix_instance_q31 * pSrcA, 24 | const arm_matrix_instance_q31 * pSrcB, 25 | arm_matrix_instance_q31 * pDst) 26 | { 27 | uint32_t i; 28 | uint32_t numSamples; /* total number of elements in the matrix */ 29 | 30 | /* Total number of samples in the input matrix */ 31 | numSamples = (uint32_t) pSrcA->numRows * pSrcA->numCols; 32 | 33 | for(i=0;ipData[i] = ref_sat_q31( (q63_t)pSrcA->pData[i] + pSrcB->pData[i]); 36 | } 37 | 38 | return ARM_MATH_SUCCESS; 39 | } 40 | 41 | arm_status ref_mat_add_q15( 42 | const arm_matrix_instance_q15 * pSrcA, 43 | const arm_matrix_instance_q15 * pSrcB, 44 | arm_matrix_instance_q15 * pDst) 45 | { 46 | uint32_t i; 47 | uint32_t numSamples; /* total number of elements in the matrix */ 48 | 49 | /* Total number of samples in the input matrix */ 50 | numSamples = (uint32_t) pSrcA->numRows * pSrcA->numCols; 51 | 52 | for(i=0;ipData[i] = ref_sat_q15( (q31_t)pSrcA->pData[i] + pSrcB->pData[i]); 55 | } 56 | 57 | return ARM_MATH_SUCCESS; 58 | } 59 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/MatrixFunctions/mat_sub.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | arm_status ref_mat_sub_f32( 4 | const arm_matrix_instance_f32 * pSrcA, 5 | const arm_matrix_instance_f32 * pSrcB, 6 | arm_matrix_instance_f32 * pDst) 7 | { 8 | uint32_t i; 9 | uint32_t numSamples; /* total number of elements in the matrix */ 10 | 11 | /* Total number of samples in the input matrix */ 12 | numSamples = (uint32_t) pSrcA->numRows * pSrcA->numCols; 13 | 14 | for(i=0;ipData[i] = pSrcA->pData[i] - pSrcB->pData[i]; 17 | } 18 | 19 | return ARM_MATH_SUCCESS; 20 | } 21 | 22 | arm_status ref_mat_sub_q31( 23 | const arm_matrix_instance_q31 * pSrcA, 24 | const arm_matrix_instance_q31 * pSrcB, 25 | arm_matrix_instance_q31 * pDst) 26 | { 27 | uint32_t i; 28 | uint32_t numSamples; /* total number of elements in the matrix */ 29 | 30 | /* Total number of samples in the input matrix */ 31 | numSamples = (uint32_t) pSrcA->numRows * pSrcA->numCols; 32 | 33 | for(i=0;ipData[i] = ref_sat_q31( (q63_t)pSrcA->pData[i] - pSrcB->pData[i]); 36 | } 37 | 38 | return ARM_MATH_SUCCESS; 39 | } 40 | 41 | arm_status ref_mat_sub_q15( 42 | const arm_matrix_instance_q15 * pSrcA, 43 | const arm_matrix_instance_q15 * pSrcB, 44 | arm_matrix_instance_q15 * pDst) 45 | { 46 | uint32_t i; 47 | uint32_t numSamples; /* total number of elements in the matrix */ 48 | 49 | /* Total number of samples in the input matrix */ 50 | numSamples = (uint32_t) pSrcA->numRows * pSrcA->numCols; 51 | 52 | for(i=0;ipData[i] = ref_sat_q15( (q31_t)pSrcA->pData[i] - pSrcB->pData[i]); 55 | } 56 | 57 | return ARM_MATH_SUCCESS; 58 | } 59 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Core/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/HelperFunctions/ref_helper.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | float32_t scratchArray[8192*2]; 4 | 5 | arm_cfft_instance_f32 ref_cfft_sR_f32_len8192 = { 8192, 0, 0, 0 }; 6 | 7 | q31_t ref_sat_n(q31_t num, uint32_t bits) 8 | { 9 | int32_t posMax, negMin; 10 | uint32_t i; 11 | 12 | posMax = 1; 13 | for (i = 0; i < (bits - 1); i++) 14 | { 15 | posMax = posMax * 2; 16 | } 17 | 18 | if (num > 0) 19 | { 20 | posMax = (posMax - 1); 21 | 22 | if (num > posMax) 23 | { 24 | num = posMax; 25 | } 26 | } 27 | else 28 | { 29 | negMin = -posMax; 30 | 31 | if (num < negMin) 32 | { 33 | num = negMin; 34 | } 35 | } 36 | return (num); 37 | } 38 | 39 | q31_t ref_sat_q31(q63_t num) 40 | { 41 | if (num > (q63_t)INT_MAX) 42 | { 43 | return INT_MAX; 44 | } 45 | else if (num < (q63_t)0xffffffff80000000ll) 46 | { 47 | return INT_MIN; 48 | } 49 | else 50 | { 51 | return (q31_t)num; 52 | } 53 | } 54 | 55 | q15_t ref_sat_q15(q31_t num) 56 | { 57 | if (num > (q31_t)SHRT_MAX) 58 | { 59 | return SHRT_MAX; 60 | } 61 | else if (num < (q31_t)0xffff8000) 62 | { 63 | return SHRT_MIN; 64 | } 65 | else 66 | { 67 | return (q15_t)num; 68 | } 69 | } 70 | 71 | q7_t ref_sat_q7(q15_t num) 72 | { 73 | if (num > (q15_t)SCHAR_MAX) 74 | { 75 | return SCHAR_MAX; 76 | } 77 | else if (num < (q15_t)0xff80) 78 | { 79 | return SCHAR_MIN; 80 | } 81 | else 82 | { 83 | return (q7_t)num; 84 | } 85 | } 86 | 87 | float32_t ref_pow(float32_t a, uint32_t b) 88 | { 89 | uint32_t i; 90 | float32_t r = a; 91 | 92 | for(i=1;i> 14) - (((q63_t)pSrcA[i+1] * pSrcB[i+1]) >> 14); 43 | sumi += (((q63_t)pSrcA[i] * pSrcB[i+1]) >> 14) + (((q63_t)pSrcA[i+1] * pSrcB[i] ) >> 14); 44 | } 45 | 46 | *realResult = sumr; 47 | *imagResult = sumi; 48 | } 49 | 50 | void ref_cmplx_dot_prod_q15( 51 | q15_t * pSrcA, 52 | q15_t * pSrcB, 53 | uint32_t numSamples, 54 | q31_t * realResult, 55 | q31_t * imagResult) 56 | { 57 | q63_t sumr, sumi; 58 | uint32_t i; 59 | 60 | sumr = 0; 61 | sumi = 0; 62 | 63 | for(i=0;i> 6); 71 | *imagResult = (q31_t)(sumi >> 6); 72 | } 73 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/MatrixFunctions/mat_scale.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | arm_status ref_mat_scale_f32( 4 | const arm_matrix_instance_f32 * pSrc, 5 | float32_t scale, 6 | arm_matrix_instance_f32 * pDst) 7 | { 8 | uint32_t i; 9 | uint32_t numSamples; /* total number of elements in the matrix */ 10 | 11 | /* Total number of samples in the input matrix */ 12 | numSamples = (uint32_t) pSrc->numRows * pSrc->numCols; 13 | 14 | for(i=0;ipData[i] = pSrc->pData[i] * scale; 17 | } 18 | 19 | return ARM_MATH_SUCCESS; 20 | } 21 | 22 | arm_status ref_mat_scale_q31( 23 | const arm_matrix_instance_q31 * pSrc, 24 | q31_t scale, 25 | int32_t shift, 26 | arm_matrix_instance_q31 * pDst) 27 | { 28 | uint32_t i; 29 | uint32_t numSamples; /* total number of elements in the matrix */ 30 | int32_t totShift = shift + 1; 31 | q31_t tmp; 32 | 33 | /* Total number of samples in the input matrix */ 34 | numSamples = (uint32_t) pSrc->numRows * pSrc->numCols; 35 | 36 | for(i=0;ipData[i] * scale) >> 32; 39 | pDst->pData[i] = ref_sat_q31((q63_t)tmp << totShift ); 40 | } 41 | 42 | return ARM_MATH_SUCCESS; 43 | } 44 | 45 | arm_status ref_mat_scale_q15( 46 | const arm_matrix_instance_q15 * pSrc, 47 | q15_t scale, 48 | int32_t shift, 49 | arm_matrix_instance_q15 * pDst) 50 | { 51 | uint32_t i; 52 | uint32_t numSamples; /* total number of elements in the matrix */ 53 | int32_t totShift = 15 - shift; 54 | 55 | /* Total number of samples in the input matrix */ 56 | numSamples = (uint32_t) pSrc->numRows * pSrc->numCols; 57 | 58 | for(i=0;ipData[i] = ref_sat_q15( ((q31_t)pSrc->pData[i] * scale) >> totShift); 61 | } 62 | 63 | return ARM_MATH_SUCCESS; 64 | } 65 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/arm_nnexamples_nn_test.h: -------------------------------------------------------------------------------- 1 | #ifndef _MAIN_H_ 2 | #define _MAIN_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "arm_math.h" 9 | 10 | #include "arm_nnfunctions.h" 11 | #include "ref_functions.h" 12 | 13 | extern int test_index; 14 | extern q7_t test_flags[50]; 15 | 16 | void initialize_results_q7(q7_t * ref, q7_t * opt, int length) 17 | { 18 | arm_fill_q7(0, ref, length); 19 | arm_fill_q7(37, opt, length); 20 | } 21 | 22 | void initialize_results_q15(q15_t * ref, q15_t * opt, int length) 23 | { 24 | arm_fill_q15(0, ref, length); 25 | arm_fill_q15(0x5F5, opt, length); 26 | } 27 | 28 | void verify_results_q7(q7_t * ref, q7_t * opt, int length) 29 | { 30 | 31 | bool if_match = true; 32 | 33 | for (int i = 0; i < length; i++) 34 | { 35 | if (ref[i] != opt[i]) 36 | { 37 | printf("Output mismatch at %d, expected %d, actual %d\r\n", i, ref[i], opt[i]); 38 | 39 | if_match = false; 40 | } 41 | } 42 | 43 | if (if_match == true) 44 | { 45 | printf("Outputs match.\r\n\r\n"); 46 | test_flags[test_index++] = 0; 47 | } else { 48 | test_flags[test_index++] = 1; 49 | } 50 | 51 | } 52 | 53 | void verify_results_q15(q15_t * ref, q15_t * opt, int length) 54 | { 55 | 56 | bool if_match = true; 57 | 58 | for (int i = 0; i < length; i++) 59 | { 60 | if (ref[i] != opt[i]) 61 | { 62 | printf("Output mismatch at %d, expected %d, actual %d\r\n", i, ref[i], opt[i]); 63 | 64 | if_match = false; 65 | } 66 | } 67 | 68 | if (if_match == true) 69 | { 70 | printf("Outputs match.\r\n\r\n"); 71 | test_flags[test_index++] = 0; 72 | } else { 73 | test_flags[test_index++] = 1; 74 | } 75 | 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/basic_math_tests/scale_tests.c: -------------------------------------------------------------------------------- 1 | #include "jtest.h" 2 | #include "basic_math_test_data.h" 3 | #include "arr_desc.h" 4 | #include "arm_math.h" /* FUTs */ 5 | #include "ref.h" /* Reference Functions */ 6 | #include "test_templates.h" 7 | #include "basic_math_templates.h" 8 | #include "type_abbrev.h" 9 | 10 | 11 | #define JTEST_ARM_SCALE_TEST(suffix) \ 12 | BASIC_MATH_DEFINE_TEST_TEMPLATE_BUF1_ELT2_BLK( \ 13 | scale, \ 14 | suffix, \ 15 | TYPE_FROM_ABBREV(suffix), \ 16 | TYPE_FROM_ABBREV(suffix), /*elt1_type*/ \ 17 | int8_t, /*elt2_type*/ \ 18 | TYPE_FROM_ABBREV(suffix)) 19 | 20 | /* float32_t defined separately because it has less arguments */ 21 | JTEST_DEFINE_TEST(arm_scale_f32_test, 22 | arm_scale_f32) 23 | { 24 | TEST_TEMPLATE_BUF1_ELT1_BLK( 25 | basic_math_f_all, 26 | basic_math_eltsf, 27 | basic_math_block_sizes, 28 | float32_t, 29 | float32_t, 30 | float32_t, 31 | arm_scale_f32, 32 | ARM_scale_float_INPUT_INTERFACE, 33 | ref_scale_f32, 34 | REF_scale_float_INPUT_INTERFACE, 35 | BASIC_MATH_COMPARE_INTERFACE); 36 | } 37 | 38 | JTEST_ARM_SCALE_TEST(q31); 39 | JTEST_ARM_SCALE_TEST(q15); 40 | JTEST_ARM_SCALE_TEST(q7); 41 | 42 | /*--------------------------------------------------------------------------------*/ 43 | /* Collect all tests in a group. */ 44 | /*--------------------------------------------------------------------------------*/ 45 | 46 | JTEST_DEFINE_GROUP(scale_tests) 47 | { 48 | JTEST_TEST_CALL(arm_scale_f32_test); 49 | JTEST_TEST_CALL(arm_scale_q31_test); 50 | JTEST_TEST_CALL(arm_scale_q15_test); 51 | JTEST_TEST_CALL(arm_scale_q7_test); 52 | } 53 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/RTE/Compiler/EventRecorderConf.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | * MDK - Component ::Event Recorder 3 | * Copyright (c) 2016 ARM Germany GmbH. All rights reserved. 4 | *------------------------------------------------------------------------------ 5 | * Name: EventRecorderConf.h 6 | * Purpose: Event Recorder Configuration 7 | * Rev.: V1.0.0 8 | *----------------------------------------------------------------------------*/ 9 | 10 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 11 | 12 | // Event Recorder 13 | 14 | // Number of Records 15 | // <8=>8 <16=>16 <32=>32 <64=>64 <128=>128 <256=>256 <512=>512 <1024=>1024 16 | // <2048=>2048 <4096=>4096 <8192=>8192 <16384=>16384 <32768=>32768 17 | // <65536=>65536 <131072=>131072 <262144=>262144 <524288=>524288 18 | // <1048576=>1048576 19 | // Configure size of Event Record Buffer (each record is 16 bytes) 20 | // Must be 2^n (min=8, max=1048576) 21 | #define EVENT_RECORD_COUNT 64U 22 | 23 | // Time Stamp Source 24 | // <0=> DWT Cycle Counter <1=> SysTick 25 | // <3=> User Timer (Normal Reset) <4=> User Timer (Power-On Reset) 26 | // Selects source for 32-bit time stamp 27 | #define EVENT_TIMESTAMP_SOURCE 1 28 | 29 | // SysTick Configuration 30 | // Configure values when Time Stamp Source is set to SysTick 31 | 32 | // SysTick Input Clock Frequency [Hz] <1-1000000000> 33 | // Defines SysTick input clock (typical identical with processor clock) 34 | #define SYSTICK_CLOCK 100000000U 35 | 36 | // SysTick Interrupt Period [us] <1-1000000000> 37 | // Defines time period of the SysTick timer interrupt 38 | #define SYSTICK_PERIOD_US 1000U 39 | 40 | // 41 | 42 | // 43 | 44 | //------------- <<< end of configuration section >>> --------------------------- 45 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/RTE/Compiler/EventRecorderConf.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------------ 2 | * MDK - Component ::Event Recorder 3 | * Copyright (c) 2016 ARM Germany GmbH. All rights reserved. 4 | *------------------------------------------------------------------------------ 5 | * Name: EventRecorderConf.h 6 | * Purpose: Event Recorder Configuration 7 | * Rev.: V1.0.0 8 | *----------------------------------------------------------------------------*/ 9 | 10 | //-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- 11 | 12 | // Event Recorder 13 | 14 | // Number of Records 15 | // <8=>8 <16=>16 <32=>32 <64=>64 <128=>128 <256=>256 <512=>512 <1024=>1024 16 | // <2048=>2048 <4096=>4096 <8192=>8192 <16384=>16384 <32768=>32768 17 | // <65536=>65536 <131072=>131072 <262144=>262144 <524288=>524288 18 | // <1048576=>1048576 19 | // Configure size of Event Record Buffer (each record is 16 bytes) 20 | // Must be 2^n (min=8, max=1048576) 21 | #define EVENT_RECORD_COUNT 64U 22 | 23 | // Time Stamp Source 24 | // <0=> DWT Cycle Counter <1=> SysTick 25 | // <3=> User Timer (Normal Reset) <4=> User Timer (Power-On Reset) 26 | // Selects source for 32-bit time stamp 27 | #define EVENT_TIMESTAMP_SOURCE 1 28 | 29 | // SysTick Configuration 30 | // Configure values when Time Stamp Source is set to SysTick 31 | 32 | // SysTick Input Clock Frequency [Hz] <1-1000000000> 33 | // Defines SysTick input clock (typical identical with processor clock) 34 | #define SYSTICK_CLOCK 100000000U 35 | 36 | // SysTick Interrupt Period [us] <1-1000000000> 37 | // Defines time period of the SysTick timer interrupt 38 | #define SYSTICK_PERIOD_US 1000U 39 | 40 | // 41 | 42 | // 43 | 44 | //------------- <<< end of configuration section >>> --------------------------- 45 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/Ref_Implementations/arm_fully_connected_q7_ref.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "ref_functions.h" 20 | 21 | void arm_fully_connected_q7_ref(const q7_t * pV, // pointer to vector 22 | const q7_t * pM, // pointer to matrix 23 | const uint16_t dim_vec, // length of the vector 24 | const uint16_t num_of_rows, // numCol of A 25 | const uint16_t bias_shift, // amount of left-shift for bias 26 | const uint16_t out_shift, // amount of right-shift for output 27 | const q7_t * bias, q7_t * pOut, // output operand 28 | q15_t * vec_buffer) 29 | { 30 | for (int i = 0; i < num_of_rows; i++) 31 | { 32 | #ifndef ARM_NN_TRUNCATE 33 | int ip_out = (bias[i] << bias_shift) + (0x1 << (out_shift - 1)); 34 | #else 35 | int ip_out = bias[i] << bias_shift; 36 | #endif 37 | for (int j = 0; j < dim_vec; j++) 38 | { 39 | ip_out += pV[j] * pM[i * dim_vec + j]; 40 | } 41 | pOut[i] = (q7_t) __SSAT((ip_out >> out_shift), 8); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/Ref_Implementations/arm_fully_connected_q15_ref.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "ref_functions.h" 20 | 21 | void arm_fully_connected_q15_ref(const q15_t * pV, // pointer to vector 22 | const q15_t * pM, // pointer to matrix 23 | const uint16_t dim_vec, // length of the vector 24 | const uint16_t num_of_rows, // numCol of A 25 | const uint16_t bias_shift, // amount of left-shift for bias 26 | const uint16_t out_shift, // amount of right-shift for output 27 | const q15_t * bias, q15_t * pOut, // output operand 28 | q15_t * vec_buffer) 29 | { 30 | for (int i = 0; i < num_of_rows; i++) 31 | { 32 | #ifndef ARM_NN_TRUNCATE 33 | int ip_out = (bias[i] << bias_shift) + (0x1 << (out_shift - 1)); 34 | #else 35 | int ip_out = bias[i] << bias_shift; 36 | #endif 37 | for (int j = 0; j < dim_vec; j++) 38 | { 39 | ip_out += pV[j] * pM[i * dim_vec + j]; 40 | } 41 | pOut[i] = (q15_t) __SSAT((ip_out >> out_shift), 16); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/complex_math_tests/complex_math_test_data.h: -------------------------------------------------------------------------------- 1 | #ifndef _COMPLEX_MATH_TEST_DATA_H_ 2 | #define _COMPLEX_MATH_TEST_DATA_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Includes */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | #include "arr_desc.h" 9 | #include "arm_math.h" 10 | 11 | /*--------------------------------------------------------------------------------*/ 12 | /* Macros and Defines */ 13 | /*--------------------------------------------------------------------------------*/ 14 | #define COMPLEX_MATH_MAX_INPUT_ELEMENTS 32 15 | #define COMPLEX_MATH_BIGGEST_INPUT_TYPE float32_t 16 | 17 | /*--------------------------------------------------------------------------------*/ 18 | /* Decalare Variables */ 19 | /*--------------------------------------------------------------------------------*/ 20 | 21 | /* Input/Output Buffers */ 22 | ARR_DESC_DECLARE(complex_math_output_fut_a); 23 | ARR_DESC_DECLARE(complex_math_output_fut_b); 24 | ARR_DESC_DECLARE(complex_math_output_ref_a); 25 | ARR_DESC_DECLARE(complex_math_output_ref_b); 26 | 27 | extern COMPLEX_MATH_BIGGEST_INPUT_TYPE 28 | complex_math_output_f32_ref_a[COMPLEX_MATH_MAX_INPUT_ELEMENTS * 2]; 29 | 30 | extern COMPLEX_MATH_BIGGEST_INPUT_TYPE 31 | complex_math_output_f32_ref_b[COMPLEX_MATH_MAX_INPUT_ELEMENTS * 2]; 32 | 33 | extern COMPLEX_MATH_BIGGEST_INPUT_TYPE 34 | complex_math_output_f32_fut_a[COMPLEX_MATH_MAX_INPUT_ELEMENTS * 2]; 35 | 36 | extern COMPLEX_MATH_BIGGEST_INPUT_TYPE 37 | complex_math_output_f32_fut_b[COMPLEX_MATH_MAX_INPUT_ELEMENTS * 2]; 38 | 39 | /* Block Sizes*/ 40 | ARR_DESC_DECLARE(complex_math_block_sizes); 41 | 42 | /* Float Inputs */ 43 | ARR_DESC_DECLARE(complex_math_zeros); 44 | ARR_DESC_DECLARE(complex_math_f_2); 45 | ARR_DESC_DECLARE(complex_math_f_15); 46 | ARR_DESC_DECLARE(complex_math_f_32); 47 | ARR_DESC_DECLARE(complex_math_f_all); 48 | 49 | 50 | #endif /* _COMPLEX_MATH_TEST_DATA_H_ */ 51 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/Ref_Implementations/arm_fully_connected_mat_q7_vec_q15_ref.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "ref_functions.h" 20 | 21 | void arm_fully_connected_mat_q7_vec_q15_ref(const q15_t * pV, // pointer to vector 22 | const q7_t * pM, // pointer to matrix 23 | const uint16_t dim_vec, // length of the vector 24 | const uint16_t num_of_rows, // numCol of A 25 | const uint16_t bias_shift, // amount of left-shift for bias 26 | const uint16_t out_shift, // amount of right-shift for output 27 | const q7_t * bias, q15_t * pOut, // output operand 28 | q15_t * vec_buffer) 29 | { 30 | for (int i = 0; i < num_of_rows; i++) 31 | { 32 | #ifndef ARM_NN_TRUNCATE 33 | int ip_out = (bias[i] << bias_shift) + (0x1 << (out_shift - 1)); 34 | #else 35 | int ip_out = bias[i] << bias_shift; 36 | #endif 37 | for (int j = 0; j < dim_vec; j++) 38 | { 39 | ip_out += pV[j] * pM[i * dim_vec + j]; 40 | } 41 | pOut[i] = (q15_t) __SSAT((ip_out >> out_shift), 16); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/NN_Lib_Tests/nn_test/Ref_Implementations/arm_nn_mult_ref.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #include "arm_math.h" 20 | #include "arm_nnfunctions.h" 21 | 22 | void arm_nn_mult_q7_ref(q7_t * pSrcA, 23 | q7_t * pSrcB, 24 | q7_t * pDst, 25 | const uint16_t out_shift, 26 | uint32_t blockSize) { 27 | uint16_t i; 28 | 29 | for (i = 0; i < blockSize; i++) 30 | { 31 | q31_t product = pSrcA[i] * pSrcB[i]; 32 | #ifndef ARM_NN_TRUNCATE 33 | pDst[i] = (q7_t)__SSAT((product + (0x1 << (out_shift - 1)))>>out_shift, 8); 34 | #else 35 | pDst[i] = (q7_t)__SSAT(product >> out_shift, 8); 36 | #endif 37 | } 38 | } 39 | 40 | void arm_nn_mult_q15_ref(q15_t * pSrcA, 41 | q15_t * pSrcB, 42 | q15_t * pDst, 43 | const uint16_t out_shift, 44 | uint32_t blockSize) { 45 | uint16_t i; 46 | 47 | for (i = 0; i < blockSize; i++) 48 | { 49 | q31_t product = pSrcA[i] * pSrcB[i]; 50 | #ifndef ARM_NN_TRUNCATE 51 | pDst[i] = (q15_t)__SSAT((product + (0x1 << (out_shift - 1)))>>out_shift, 16); 52 | #else 53 | pDst[i] = (q15_t)__SSAT(product >> out_shift, 16); 54 | #endif 55 | 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Core/Template/ARMv8-M/main_s.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file main_s.c 3 | * @brief Code template for secure main function 4 | * @version V1.1.1 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2013-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | /* Use CMSE intrinsics */ 26 | #include 27 | 28 | #include "RTE_Components.h" 29 | #include CMSIS_device_header 30 | 31 | /* TZ_START_NS: Start address of non-secure application */ 32 | #ifndef TZ_START_NS 33 | #define TZ_START_NS (0x200000U) 34 | #endif 35 | 36 | /* typedef for non-secure callback functions */ 37 | typedef void (*funcptr_void) (void) __attribute__((cmse_nonsecure_call)); 38 | 39 | /* Secure main() */ 40 | int main(void) { 41 | funcptr_void NonSecure_ResetHandler; 42 | 43 | /* Add user setup code for secure part here*/ 44 | 45 | /* Set non-secure main stack (MSP_NS) */ 46 | __TZ_set_MSP_NS(*((uint32_t *)(TZ_START_NS))); 47 | 48 | /* Get non-secure reset handler */ 49 | NonSecure_ResetHandler = (funcptr_void)(*((uint32_t *)((TZ_START_NS) + 4U))); 50 | 51 | /* Start non-secure state software application */ 52 | NonSecure_ResetHandler(); 53 | 54 | /* Non-secure software does not return, this code is not executed */ 55 | while (1) { 56 | __NOP(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/controller_tests/controller_templates.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONTROLLER_TEMPLATES_H_ 2 | #define _CONTROLLER_TEMPLATES_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Includes */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | #include "test_templates.h" 9 | #include /* memcpy() */ 10 | 11 | /*--------------------------------------------------------------------------------*/ 12 | /* Group Specific Templates */ 13 | /*--------------------------------------------------------------------------------*/ 14 | 15 | /** 16 | * Comparison SNR thresholds for the data types used in transform_tests. 17 | */ 18 | #define CONTROLLER_SNR_THRESHOLD_float32_t 110 19 | #define CONTROLLER_SNR_THRESHOLD_q31_t 100 20 | #define CONTROLLER_SNR_THRESHOLD_q15_t 45 21 | 22 | /** 23 | * Compare the outputs from the function under test and the reference 24 | * function using SNR. 25 | */ 26 | #define CONTROLLER_SNR_COMPARE_INTERFACE(block_size, \ 27 | output_type) \ 28 | do \ 29 | { \ 30 | TEST_CONVERT_AND_ASSERT_SNR( \ 31 | controller_output_f32_ref, \ 32 | (output_type *) controller_output_ref, \ 33 | controller_output_f32_fut, \ 34 | (output_type *) controller_output_fut, \ 35 | block_size, \ 36 | output_type, \ 37 | CONTROLLER_SNR_THRESHOLD_##output_type \ 38 | ); \ 39 | } while (0) 40 | 41 | 42 | /*--------------------------------------------------------------------------------*/ 43 | /* TEST Templates */ 44 | /*--------------------------------------------------------------------------------*/ 45 | 46 | #endif /* _CONTROLLER_TEMPLATES_H_ */ 47 | -------------------------------------------------------------------------------- /Drivers/CMSIS/NN/Include/arm_nn_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS NN Library 3 | * Title: arm_nn_tables.h 4 | * Description: Extern declaration for NN tables 5 | * 6 | * $Date: 17. January 2018 7 | * $Revision: V.1.0.0 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2018 Arm Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #ifndef _ARM_NN_TABLES_H 30 | #define _ARM_NN_TABLES_H 31 | 32 | #include "arm_math.h" 33 | 34 | /** 35 | * @brief tables for various activation functions 36 | * 37 | */ 38 | 39 | extern const q15_t sigmoidTable_q15[256]; 40 | extern const q7_t sigmoidTable_q7[256]; 41 | 42 | extern const q7_t tanhTable_q7[256]; 43 | extern const q15_t tanhTable_q15[256]; 44 | 45 | /** 46 | * @brief 2-way tables for various activation functions 47 | * 48 | * 2-way table, H table for value larger than 1/4 49 | * L table for value smaller than 1/4, H table for remaining 50 | * We have this only for the q15_t version. It does not make 51 | * sense to have it for q7_t type 52 | */ 53 | extern const q15_t sigmoidHTable_q15[192]; 54 | extern const q15_t sigmoidLTable_q15[128]; 55 | 56 | extern const q15_t sigmoidLTable_q15[128]; 57 | extern const q15_t sigmoidHTable_q15[192]; 58 | 59 | #endif /* ARM_NN_TABLES_H */ 60 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ControllerFunctions/pid.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | float32_t ref_pid_f32( 4 | arm_pid_instance_f32 * S, 5 | float32_t in) 6 | { 7 | float32_t out; 8 | 9 | /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ 10 | out = S->state[2] + S->A0 * in + S->A1 * S->state[0] + S->A2 * S->state[1]; 11 | 12 | /* Update state */ 13 | S->state[1] = S->state[0]; 14 | S->state[0] = in; 15 | S->state[2] = out; 16 | 17 | /* return to application */ 18 | return (out); 19 | } 20 | 21 | q31_t ref_pid_q31( 22 | arm_pid_instance_q31 * S, 23 | q31_t in) 24 | { 25 | q63_t acc; 26 | q31_t out; 27 | 28 | /* acc = A0 * x[n] */ 29 | acc = (q63_t) S->A0 * in; 30 | 31 | /* acc += A1 * x[n-1] */ 32 | acc += (q63_t) S->A1 * S->state[0]; 33 | 34 | /* acc += A2 * x[n-2] */ 35 | acc += (q63_t) S->A2 * S->state[1]; 36 | 37 | /* convert output to 1.31 format to add y[n-1] */ 38 | out = (q31_t) (acc >> 31U); 39 | 40 | /* out += y[n-1] */ 41 | out += S->state[2]; 42 | 43 | /* Update state */ 44 | S->state[1] = S->state[0]; 45 | S->state[0] = in; 46 | S->state[2] = out; 47 | 48 | /* return to application */ 49 | return (out); 50 | } 51 | 52 | q15_t ref_pid_q15( 53 | arm_pid_instance_q15 * S, 54 | q15_t in) 55 | { 56 | q63_t acc; 57 | q15_t out; 58 | q15_t A1, A2; 59 | 60 | #if defined (ARM_MATH_DSP) 61 | 62 | #ifndef ARM_MATH_BIG_ENDIAN 63 | A2 = S->A1 >> 16; 64 | A1 = (q15_t)S->A1; 65 | #else 66 | A1 = S->A1 >> 16; 67 | A2 = (q15_t)S->A1; 68 | #endif 69 | 70 | #else 71 | 72 | A1 = S->A1; 73 | A2 = S->A2; 74 | 75 | #endif 76 | 77 | /* acc = A0 * x[n] */ 78 | acc = ((q31_t) S->A0) * in; 79 | 80 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ 81 | acc += (q31_t) A1 * S->state[0]; 82 | acc += (q31_t) A2 * S->state[1]; 83 | 84 | /* acc += y[n-1] */ 85 | acc += (q31_t) S->state[2] << 15; 86 | 87 | /* saturate the output */ 88 | out = ref_sat_q15(acc >> 15); 89 | 90 | /* Update state */ 91 | S->state[1] = S->state[0]; 92 | S->state[0] = in; 93 | S->state[2] = out; 94 | 95 | /* return to application */ 96 | return (out); 97 | } 98 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/MatrixFunctions/mat_mult.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | arm_status ref_mat_mult_f32( 4 | const arm_matrix_instance_f32 * pSrcA, 5 | const arm_matrix_instance_f32 * pSrcB, 6 | arm_matrix_instance_f32 * pDst) 7 | { 8 | uint32_t r,c,i,outR,outC,innerSize; 9 | float32_t sum; 10 | 11 | outR = pSrcA->numRows; 12 | outC = pSrcB->numCols; 13 | innerSize = pSrcA->numCols; 14 | 15 | for(r=0;rpData[r*innerSize + i] * pSrcB->pData[i*outC + c]; 24 | } 25 | 26 | pDst->pData[r*outC + c] = sum; 27 | } 28 | } 29 | 30 | return ARM_MATH_SUCCESS; 31 | } 32 | 33 | arm_status ref_mat_mult_q31( 34 | const arm_matrix_instance_q31 * pSrcA, 35 | const arm_matrix_instance_q31 * pSrcB, 36 | arm_matrix_instance_q31 * pDst) 37 | { 38 | uint32_t r,c,i,outR,outC,innerSize; 39 | q63_t sum; 40 | 41 | outR = pSrcA->numRows; 42 | outC = pSrcB->numCols; 43 | innerSize = pSrcA->numCols; 44 | 45 | for(r=0;rpData[r*innerSize + i]) * pSrcB->pData[i*outC + c]; 54 | } 55 | 56 | pDst->pData[r*outC + c] = ref_sat_q31(sum >> 31); 57 | } 58 | } 59 | 60 | return ARM_MATH_SUCCESS; 61 | } 62 | 63 | arm_status ref_mat_mult_q15( 64 | const arm_matrix_instance_q15 * pSrcA, 65 | const arm_matrix_instance_q15 * pSrcB, 66 | arm_matrix_instance_q15 * pDst) 67 | { 68 | uint32_t r,c,i,outR,outC,innerSize; 69 | q63_t sum; 70 | 71 | outR = pSrcA->numRows; 72 | outC = pSrcB->numCols; 73 | innerSize = pSrcA->numCols; 74 | 75 | for(r=0;rpData[r*innerSize + i]) * pSrcB->pData[i*outC + c]; 84 | } 85 | 86 | pDst->pData[r*outC + c] = ref_sat_q15(sum >> 15); 87 | } 88 | } 89 | 90 | return ARM_MATH_SUCCESS; 91 | } 92 | -------------------------------------------------------------------------------- /Core/Inc/stm32f1xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2022 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | /* USER CODE END Header */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __STM32F1xx_IT_H 22 | #define __STM32F1xx_IT_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Private includes ----------------------------------------------------------*/ 29 | /* USER CODE BEGIN Includes */ 30 | 31 | /* USER CODE END Includes */ 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* USER CODE BEGIN ET */ 35 | 36 | /* USER CODE END ET */ 37 | 38 | /* Exported constants --------------------------------------------------------*/ 39 | /* USER CODE BEGIN EC */ 40 | 41 | /* USER CODE END EC */ 42 | 43 | /* Exported macro ------------------------------------------------------------*/ 44 | /* USER CODE BEGIN EM */ 45 | 46 | /* USER CODE END EM */ 47 | 48 | /* Exported functions prototypes ---------------------------------------------*/ 49 | void NMI_Handler(void); 50 | void HardFault_Handler(void); 51 | void MemManage_Handler(void); 52 | void BusFault_Handler(void); 53 | void UsageFault_Handler(void); 54 | void SVC_Handler(void); 55 | void DebugMon_Handler(void); 56 | void PendSV_Handler(void); 57 | void SysTick_Handler(void); 58 | /* USER CODE BEGIN EFP */ 59 | 60 | /* USER CODE END EFP */ 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* __STM32F1xx_IT_H */ 67 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q15.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q15.c 4 | * Description: Q15 matrix initialization 5 | * 6 | * $Date: 27. January 2017 7 | * $Revision: V.1.5.1 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | * @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | * @addtogroup MatrixInit 37 | * @{ 38 | */ 39 | 40 | /** 41 | * @brief Q15 matrix initialization. 42 | * @param[in,out] *S points to an instance of the floating-point matrix structure. 43 | * @param[in] nRows number of rows in the matrix. 44 | * @param[in] nColumns number of columns in the matrix. 45 | * @param[in] *pData points to the matrix data array. 46 | * @return none 47 | */ 48 | 49 | void arm_mat_init_q15( 50 | arm_matrix_instance_q15 * S, 51 | uint16_t nRows, 52 | uint16_t nColumns, 53 | q15_t * pData) 54 | { 55 | /* Assign Number of Rows */ 56 | S->numRows = nRows; 57 | 58 | /* Assign Number of Columns */ 59 | S->numCols = nColumns; 60 | 61 | /* Assign Data pointer */ 62 | S->pData = pData; 63 | } 64 | 65 | /** 66 | * @} end of MatrixInit group 67 | */ 68 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f1xx.h 4 | * @author MCD Application Team 5 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017-2021 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /** @addtogroup CMSIS 20 | * @{ 21 | */ 22 | 23 | /** @addtogroup stm32f10x_system 24 | * @{ 25 | */ 26 | 27 | /** 28 | * @brief Define to prevent recursive inclusion 29 | */ 30 | #ifndef __SYSTEM_STM32F10X_H 31 | #define __SYSTEM_STM32F10X_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /** @addtogroup STM32F10x_System_Includes 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | 46 | /** @addtogroup STM32F10x_System_Exported_types 47 | * @{ 48 | */ 49 | 50 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 51 | extern const uint8_t AHBPrescTable[16U]; /*!< AHB prescalers table values */ 52 | extern const uint8_t APBPrescTable[8U]; /*!< APB prescalers table values */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @addtogroup STM32F10x_System_Exported_Constants 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F10x_System_Exported_Macros 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F10x_System_Exported_Functions 75 | * @{ 76 | */ 77 | 78 | extern void SystemInit(void); 79 | extern void SystemCoreClockUpdate(void); 80 | /** 81 | * @} 82 | */ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /*__SYSTEM_STM32F10X_H */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** 95 | * @} 96 | */ 97 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/math_helper.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 29. November 2010 5 | * $Revision: V1.0.3 6 | * 7 | * Project: CMSIS DSP Library 8 | * 9 | * Title: math_helper.h 10 | * 11 | * 12 | * Description: Prototypes of all helper functions required. 13 | * 14 | * Target Processor: Cortex-M4/Cortex-M3 15 | * 16 | * Version 1.0.3 2010/11/29 17 | * Re-organized the CMSIS folders and updated documentation. 18 | * 19 | * Version 1.0.2 2010/11/11 20 | * Documentation updated. 21 | * 22 | * Version 1.0.1 2010/10/05 23 | * Production release and review comments incorporated. 24 | * 25 | * Version 1.0.0 2010/09/20 26 | * Production release and review comments incorporated. 27 | * 28 | * Version 0.0.7 2010/06/10 29 | * Misra-C changes done 30 | * -------------------------------------------------------------------- */ 31 | 32 | #ifndef MATH_HELPER_H 33 | #define MATH_HELPER_H 34 | 35 | #include "arm_math.h" 36 | 37 | float arm_snr_f32(float *pRef, float *pTest, uint32_t buffSize); 38 | double arm_snr_f64(double *pRef, double *pTest, uint32_t buffSize); 39 | void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples); 40 | void arm_provide_guard_bits_q15(q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits); 41 | void arm_provide_guard_bits_q31(q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits); 42 | void arm_float_to_q14(float *pIn, q15_t *pOut, uint32_t numSamples); 43 | void arm_float_to_q29(float *pIn, q31_t *pOut, uint32_t numSamples); 44 | void arm_float_to_q28(float *pIn, q31_t *pOut, uint32_t numSamples); 45 | void arm_float_to_q30(float *pIn, q31_t *pOut, uint32_t numSamples); 46 | void arm_clip_f32(float *pIn, uint32_t numSamples); 47 | uint32_t arm_calc_guard_bits(uint32_t num_adds); 48 | void arm_apply_guard_bits (float32_t * pIn, uint32_t numSamples, uint32_t guard_bits); 49 | uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t * pOut, uint32_t numSamples); 50 | uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t *pOut, uint32_t numSamples); 51 | uint32_t arm_calc_2pow(uint32_t guard_bits); 52 | #endif 53 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/platform/startup_generic.S: -------------------------------------------------------------------------------- 1 | 2 | #if defined (__CC_ARM) 3 | #if (defined (ARM_MATH_CM0)) 4 | #include "ARMCC\startup_armv6-m.s" 5 | #elif (defined (ARM_MATH_CM0P)) 6 | #include "ARMCC\startup_armv6-m.s" 7 | #elif (defined (ARM_MATH_CM3)) 8 | #include "ARMCC\startup_armv7-m.s" 9 | #elif (defined (ARM_MATH_CM4)) 10 | #include "ARMCC\startup_armv7-m.s" 11 | #elif (defined (ARM_MATH_CM7)) 12 | #include "ARMCC\startup_armv7-m.s" 13 | #elif (defined (ARM_MATH_ARMV8MBL)) 14 | #include "ARMCC\startup_armv6-m.s" 15 | #elif (defined (ARM_MATH_ARMV8MML)) 16 | #include "ARMCC\startup_armv7-m.s" 17 | #else 18 | #error "No appropriate startup file found!" 19 | #endif 20 | 21 | #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 22 | #if (defined (ARM_MATH_CM0)) 23 | #include "ARMCLANG\startup_armv6-m.S" 24 | #elif (defined (ARM_MATH_CM0P)) 25 | #include "ARMCLANG\startup_armv6-m.S" 26 | #elif (defined (ARM_MATH_CM3)) 27 | #include "ARMCLANG\startup_armv7-m.S" 28 | #elif (defined (ARM_MATH_CM4)) 29 | #include "ARMCLANG\startup_armv7-m.S" 30 | #elif (defined (ARM_MATH_CM7)) 31 | #include "ARMCLANG\startup_armv7-m.S" 32 | #elif (defined (ARM_MATH_ARMV8MBL)) 33 | #include "ARMCLANG\startup_armv6-m.S" 34 | #elif (defined (ARM_MATH_ARMV8MML)) 35 | #include "ARMCLANG\startup_armv7-m.S" 36 | #else 37 | #error "No appropriate startup file found!" 38 | #endif 39 | 40 | #elif defined (__GNUC__) 41 | #if (defined (ARM_MATH_CM0)) 42 | #include "GCC\startup_armv6-m.S" 43 | #elif (defined (ARM_MATH_CM0P)) 44 | #include "GCC\startup_armv6-m.S" 45 | #elif (defined (ARM_MATH_CM3)) 46 | #include "GCC\startup_armv7-m.S" 47 | #elif (defined (ARM_MATH_CM4)) 48 | #include "GCC\startup_armv7-m.S" 49 | #elif (defined (ARM_MATH_CM7)) 50 | #include "GCC\startup_armv7-m.S" 51 | #elif (defined (ARM_MATH_ARMV8MBL)) 52 | #include "GCC\startup_armv6-m.S" 53 | #elif (defined (ARM_MATH_ARMV8MML)) 54 | #include "GCC\startup_armv7-m.S" 55 | #else 56 | #error "No appropriate startup file found!" 57 | #endif 58 | 59 | #else 60 | #error "Compiler not supported!" 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /Core/Inc/main.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.h 5 | * @brief : Header for main.c file. 6 | * This file contains the common defines of the application. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | * Copyright (c) 2022 STMicroelectronics. 11 | * All rights reserved. 12 | * 13 | * This software is licensed under terms that can be found in the LICENSE file 14 | * in the root directory of this software component. 15 | * If no LICENSE file comes with this software, it is provided AS-IS. 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __MAIN_H 23 | #define __MAIN_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32f1xx_hal.h" 31 | 32 | /* Private includes ----------------------------------------------------------*/ 33 | /* USER CODE BEGIN Includes */ 34 | 35 | /* USER CODE END Includes */ 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | /* USER CODE BEGIN ET */ 39 | 40 | /* USER CODE END ET */ 41 | 42 | /* Exported constants --------------------------------------------------------*/ 43 | /* USER CODE BEGIN EC */ 44 | 45 | /* USER CODE END EC */ 46 | 47 | /* Exported macro ------------------------------------------------------------*/ 48 | /* USER CODE BEGIN EM */ 49 | 50 | /* USER CODE END EM */ 51 | 52 | /* Exported functions prototypes ---------------------------------------------*/ 53 | void Error_Handler(void); 54 | 55 | /* USER CODE BEGIN EFP */ 56 | 57 | /* USER CODE END EFP */ 58 | 59 | /* Private defines -----------------------------------------------------------*/ 60 | 61 | /* USER CODE BEGIN Private defines */ 62 | 63 | /* USER CODE END Private defines */ 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* __MAIN_H */ 70 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/Source/MatrixFunctions/arm_mat_init_q31.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Project: CMSIS DSP Library 3 | * Title: arm_mat_init_q31.c 4 | * Description: Q31 matrix initialization 5 | * 6 | * $Date: 27. January 2017 7 | * $Revision: V.1.5.1 8 | * 9 | * Target Processor: Cortex-M cores 10 | * -------------------------------------------------------------------- */ 11 | /* 12 | * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. 13 | * 14 | * SPDX-License-Identifier: Apache-2.0 15 | * 16 | * Licensed under the Apache License, Version 2.0 (the License); you may 17 | * not use this file except in compliance with the License. 18 | * You may obtain a copy of the License at 19 | * 20 | * www.apache.org/licenses/LICENSE-2.0 21 | * 22 | * Unless required by applicable law or agreed to in writing, software 23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | * See the License for the specific language governing permissions and 26 | * limitations under the License. 27 | */ 28 | 29 | #include "arm_math.h" 30 | 31 | /** 32 | * @ingroup groupMatrix 33 | */ 34 | 35 | /** 36 | * @defgroup MatrixInit Matrix Initialization 37 | * 38 | */ 39 | 40 | /** 41 | * @addtogroup MatrixInit 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @brief Q31 matrix initialization. 47 | * @param[in,out] *S points to an instance of the floating-point matrix structure. 48 | * @param[in] nRows number of rows in the matrix. 49 | * @param[in] nColumns number of columns in the matrix. 50 | * @param[in] *pData points to the matrix data array. 51 | * @return none 52 | */ 53 | 54 | void arm_mat_init_q31( 55 | arm_matrix_instance_q31 * S, 56 | uint16_t nRows, 57 | uint16_t nColumns, 58 | q31_t * pData) 59 | { 60 | /* Assign Number of Rows */ 61 | S->numRows = nRows; 62 | 63 | /* Assign Number of Columns */ 64 | S->numCols = nColumns; 65 | 66 | /* Assign Data pointer */ 67 | S->pData = pData; 68 | } 69 | 70 | /** 71 | * @} end of MatrixInit group 72 | */ 73 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/TransformFunctions/dct4.c: -------------------------------------------------------------------------------- 1 | #include "ref.h" 2 | 3 | void ref_dct4_f32( 4 | const arm_dct4_instance_f32 * S, 5 | float32_t * pState, 6 | float32_t * pInlineBuffer) 7 | { 8 | uint32_t n,k; 9 | float32_t sum; 10 | float32_t pi_by_N = 3.14159265358979f / (float32_t)S->N; 11 | float32_t tmp; 12 | float32_t normalize = sqrtf(2.0f / (float32_t)S->N); 13 | 14 | for(k=0;kN;k++) 15 | { 16 | sum=0.0f; 17 | tmp = ((float32_t)k + 0.5f)*pi_by_N; 18 | for(n=0;nN;n++) 19 | { 20 | sum += pInlineBuffer[n] * cosf(tmp * ((float32_t)n + 0.5f)); 21 | } 22 | scratchArray[k] = normalize * sum; 23 | } 24 | 25 | for(k=0;kN;k++) 26 | { 27 | pInlineBuffer[k] = scratchArray[k]; 28 | } 29 | } 30 | 31 | void ref_dct4_q31( 32 | const arm_dct4_instance_q31 * S, 33 | q31_t * pState, 34 | q31_t * pInlineBuffer) 35 | { 36 | arm_dct4_instance_f32 SS; 37 | float32_t *fSrc = (float32_t*)pInlineBuffer; 38 | uint32_t i; 39 | 40 | SS.N = S->N; 41 | 42 | for(i=0;iN;i++) 43 | { 44 | //read the q31 data, cast to float, scale down for float 45 | fSrc[i] = (float32_t)pInlineBuffer[i] / 2147483648.0f; 46 | } 47 | 48 | ref_dct4_f32(&SS,(float32_t*)0,fSrc); 49 | 50 | for(i=0;iN;i++) 51 | { 52 | fSrc[i] = fSrc[i] * 2147483648.0f / (float32_t)S->N ; 53 | fSrc[i] += (fSrc[i] > 0) ? 0.5f : -0.5f; 54 | pInlineBuffer[i] = (q31_t)fSrc[i]; 55 | } 56 | } 57 | 58 | void ref_dct4_q15( 59 | const arm_dct4_instance_q15 * S, 60 | q15_t * pState, 61 | q15_t * pInlineBuffer) 62 | { 63 | arm_dct4_instance_f32 SS; 64 | float32_t *fSrc = (float32_t*)pInlineBuffer; 65 | uint32_t i; 66 | 67 | SS.N = S->N; 68 | 69 | for(i=0;iN;i++) 70 | { 71 | //read the q15 data, cast to float, scale down for float, place in temporary buffer 72 | scratchArray[i] = (float32_t)pInlineBuffer[i] / 32768.0f; 73 | } 74 | 75 | for(i=0;iN;i++) 76 | { 77 | //copy from temp buffer to final buffer 78 | fSrc[i] = scratchArray[i]; 79 | } 80 | 81 | ref_dct4_f32(&SS,(float32_t*)0,fSrc); 82 | 83 | for(i=0;iN;i++) 84 | { 85 | fSrc[i] = fSrc[i] * 32768.0f / (float32_t)S->N; 86 | fSrc[i] += (fSrc[i] > 0) ? 0.5f : -0.5f; 87 | pInlineBuffer[i] = (q15_t)fSrc[i]; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/inc/transform_tests/transform_test_data.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRANSFORM_TEST_DATA_H_ 2 | #define _TRANSFORM_TEST_DATA_H_ 3 | 4 | /*--------------------------------------------------------------------------------*/ 5 | /* Includes */ 6 | /*--------------------------------------------------------------------------------*/ 7 | 8 | #include "arr_desc.h" 9 | #include "arm_math.h" 10 | 11 | /*--------------------------------------------------------------------------------*/ 12 | /* Macros and Defines */ 13 | /*--------------------------------------------------------------------------------*/ 14 | 15 | #define TRANSFORM_MAX_FFT_LEN 4096 16 | #define TRANFORM_BIGGEST_INPUT_TYPE float32_t 17 | 18 | /*--------------------------------------------------------------------------------*/ 19 | /* Variable Declarations */ 20 | /*--------------------------------------------------------------------------------*/ 21 | 22 | /* Lengths are multiplied by 2 to accomodate complex numbers*/ 23 | extern float32_t transform_fft_output_fut[TRANSFORM_MAX_FFT_LEN * 2]; 24 | extern float32_t transform_fft_output_ref[TRANSFORM_MAX_FFT_LEN * 2]; 25 | extern float32_t transform_fft_input_fut[TRANSFORM_MAX_FFT_LEN * 2]; 26 | extern float32_t transform_fft_input_ref[TRANSFORM_MAX_FFT_LEN * 2]; 27 | extern float32_t transform_fft_output_f32_fut[TRANSFORM_MAX_FFT_LEN * 2]; 28 | extern float32_t transform_fft_output_f32_ref[TRANSFORM_MAX_FFT_LEN * 2]; 29 | extern float32_t * transform_fft_inplace_input_fut; 30 | extern float32_t * transform_fft_inplace_input_ref; 31 | extern float32_t transform_fft_f32_inputs[TRANSFORM_MAX_FFT_LEN * 2]; 32 | extern q31_t transform_fft_q31_inputs[TRANSFORM_MAX_FFT_LEN * 2]; 33 | extern q15_t * transform_fft_q15_inputs; 34 | extern q15_t dct4_transform_fft_q15_inputs[TRANSFORM_MAX_FFT_LEN * 2]; 35 | 36 | /* FFT Lengths */ 37 | ARR_DESC_DECLARE(transform_radix2_fftlens); 38 | ARR_DESC_DECLARE(transform_radix4_fftlens); 39 | ARR_DESC_DECLARE(transform_rfft_fftlens); 40 | ARR_DESC_DECLARE(transform_rfft_fast_fftlens); 41 | ARR_DESC_DECLARE(transform_dct_fftlens); 42 | 43 | /* CFFT Structs */ 44 | ARR_DESC_DECLARE(transform_cfft_f32_structs); 45 | ARR_DESC_DECLARE(transform_cfft_q31_structs); 46 | ARR_DESC_DECLARE(transform_cfft_q15_structs); 47 | 48 | #endif /* _TRANSFORM_TEST_DATA_H_ */ 49 | -------------------------------------------------------------------------------- /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/platform/system_ARMCM0.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file system_ARMCM0.c 3 | * @brief CMSIS Device System Source File for 4 | * ARMCM0 Device Series 5 | * @version V5.00 6 | * @date 07. September 2016 7 | ******************************************************************************/ 8 | /* 9 | * Copyright (c) 2009-2016 ARM Limited. All rights reserved. 10 | * 11 | * SPDX-License-Identifier: Apache-2.0 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the License); you may 14 | * not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * http://www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 21 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | */ 25 | 26 | #include "ARMCM0.h" 27 | 28 | /*---------------------------------------------------------------------------- 29 | Define clocks 30 | *----------------------------------------------------------------------------*/ 31 | #define XTAL ( 5000000UL) /* Oscillator frequency */ 32 | 33 | #define SYSTEM_CLOCK (5U * XTAL) 34 | 35 | 36 | /*---------------------------------------------------------------------------- 37 | System Core Clock Variable 38 | *----------------------------------------------------------------------------*/ 39 | uint32_t SystemCoreClock = SYSTEM_CLOCK; 40 | 41 | 42 | /*---------------------------------------------------------------------------- 43 | System Core Clock update function 44 | *----------------------------------------------------------------------------*/ 45 | void SystemCoreClockUpdate (void) 46 | { 47 | SystemCoreClock = SYSTEM_CLOCK; 48 | } 49 | 50 | /*---------------------------------------------------------------------------- 51 | System initialization function 52 | *----------------------------------------------------------------------------*/ 53 | void SystemInit (void) 54 | { 55 | SystemCoreClock = SYSTEM_CLOCK; 56 | } 57 | --------------------------------------------------------------------------------