├── .dockerignore ├── .gitignore ├── CMakeLists.txt ├── Dockerfile ├── Kconfig ├── LICENSE.3-clause-bsd-clear ├── README.md ├── boards └── thingy91_nrf9160_ns.overlay ├── child_image └── prj.conf ├── connectivity_bridge ├── CMakeLists.txt ├── Kconfig ├── README.rst ├── app.overlay ├── prj.conf ├── sample.yaml └── src │ ├── disk │ ├── CMakeLists.txt │ ├── config.c │ ├── readme.c │ ├── thingy91_cdc_acm.cat │ ├── thingy91_cdc_acm.cat.c │ ├── thingy91_cdc_acm.inf │ └── thingy91_cdc_acm.inf.c │ ├── events │ ├── CMakeLists.txt │ ├── Kconfig │ ├── ble_ctrl_event.c │ ├── ble_ctrl_event.h │ ├── ble_data_event.c │ ├── ble_data_event.h │ ├── cdc_data_event.c │ ├── cdc_data_event.h │ ├── fs_event.c │ ├── fs_event.h │ ├── module_state_event.c │ ├── module_state_event.h │ ├── peer_conn_event.c │ ├── peer_conn_event.h │ ├── power_event.c │ ├── power_event.h │ ├── uart_data_event.c │ └── uart_data_event.h │ ├── main.c │ └── modules │ ├── CMakeLists.txt │ ├── Kconfig │ ├── ble_handler.c │ ├── fs_handler.c │ ├── power_handler.c │ ├── uart_handler.c │ └── usb_cdc_handler.c ├── doc ├── online-mqtt-client-connect.png ├── online-mqtt-client-messages.png ├── online-mqtt-client-subscribe.png ├── online-mqtt-client-topic.png └── thingy91-swd-select.png ├── ei-model ├── edge-impulse-sdk │ ├── .gitignore │ ├── .mbedignore │ ├── CMSIS │ │ ├── Core │ │ │ └── Include │ │ │ │ ├── cachel1_armv7.h │ │ │ │ ├── cmsis_armcc.h │ │ │ │ ├── cmsis_armclang.h │ │ │ │ ├── cmsis_armclang_ltm.h │ │ │ │ ├── cmsis_compiler.h │ │ │ │ ├── cmsis_gcc.h │ │ │ │ ├── cmsis_iccarm.h │ │ │ │ ├── cmsis_version.h │ │ │ │ ├── core_armv81mml.h │ │ │ │ ├── core_armv8mbl.h │ │ │ │ ├── core_armv8mml.h │ │ │ │ ├── core_cm0.h │ │ │ │ ├── core_cm0plus.h │ │ │ │ ├── core_cm1.h │ │ │ │ ├── core_cm23.h │ │ │ │ ├── core_cm3.h │ │ │ │ ├── core_cm33.h │ │ │ │ ├── core_cm35p.h │ │ │ │ ├── core_cm4.h │ │ │ │ ├── core_cm55.h │ │ │ │ ├── core_cm7.h │ │ │ │ ├── core_cm85.h │ │ │ │ ├── core_sc000.h │ │ │ │ ├── core_sc300.h │ │ │ │ ├── core_starmc1.h │ │ │ │ ├── mpu_armv7.h │ │ │ │ ├── mpu_armv8.h │ │ │ │ ├── pac_armv81.h │ │ │ │ ├── pmu_armv8.h │ │ │ │ └── tz_context.h │ │ ├── DSP │ │ │ ├── Include │ │ │ │ ├── arm_common_tables.h │ │ │ │ ├── arm_common_tables_f16.h │ │ │ │ ├── arm_const_structs.h │ │ │ │ ├── arm_const_structs_f16.h │ │ │ │ ├── arm_helium_utils.h │ │ │ │ ├── arm_math.h │ │ │ │ ├── arm_math_f16.h │ │ │ │ ├── arm_math_memory.h │ │ │ │ ├── arm_math_types.h │ │ │ │ ├── arm_math_types_f16.h │ │ │ │ ├── arm_mve_tables.h │ │ │ │ ├── arm_mve_tables_f16.h │ │ │ │ ├── arm_sorting.h │ │ │ │ ├── arm_vec_fft.h │ │ │ │ ├── arm_vec_filtering.h │ │ │ │ ├── arm_vec_math.h │ │ │ │ ├── arm_vec_math_f16.h │ │ │ │ └── dsp │ │ │ │ │ ├── basic_math_functions.h │ │ │ │ │ ├── basic_math_functions_f16.h │ │ │ │ │ ├── bayes_functions.h │ │ │ │ │ ├── bayes_functions_f16.h │ │ │ │ │ ├── complex_math_functions.h │ │ │ │ │ ├── complex_math_functions_f16.h │ │ │ │ │ ├── controller_functions.h │ │ │ │ │ ├── controller_functions_f16.h │ │ │ │ │ ├── debug.h │ │ │ │ │ ├── distance_functions.h │ │ │ │ │ ├── distance_functions_f16.h │ │ │ │ │ ├── fast_math_functions.h │ │ │ │ │ ├── fast_math_functions_f16.h │ │ │ │ │ ├── filtering_functions.h │ │ │ │ │ ├── filtering_functions_f16.h │ │ │ │ │ ├── interpolation_functions.h │ │ │ │ │ ├── interpolation_functions_f16.h │ │ │ │ │ ├── matrix_functions.h │ │ │ │ │ ├── matrix_functions_f16.h │ │ │ │ │ ├── matrix_utils.h │ │ │ │ │ ├── none.h │ │ │ │ │ ├── quaternion_math_functions.h │ │ │ │ │ ├── statistics_functions.h │ │ │ │ │ ├── statistics_functions_f16.h │ │ │ │ │ ├── support_functions.h │ │ │ │ │ ├── support_functions_f16.h │ │ │ │ │ ├── svm_defines.h │ │ │ │ │ ├── svm_functions.h │ │ │ │ │ ├── svm_functions_f16.h │ │ │ │ │ ├── transform_functions.h │ │ │ │ │ ├── transform_functions_f16.h │ │ │ │ │ └── utils.h │ │ │ ├── PrivateInclude │ │ │ │ └── README.md │ │ │ └── Source │ │ │ │ ├── BasicMathFunctions │ │ │ │ ├── arm_abs_f16.c │ │ │ │ ├── arm_abs_f32.c │ │ │ │ ├── arm_abs_f64.c │ │ │ │ ├── arm_abs_q15.c │ │ │ │ ├── arm_abs_q31.c │ │ │ │ ├── arm_abs_q7.c │ │ │ │ ├── arm_add_f16.c │ │ │ │ ├── arm_add_f32.c │ │ │ │ ├── arm_add_f64.c │ │ │ │ ├── arm_add_q15.c │ │ │ │ ├── arm_add_q31.c │ │ │ │ ├── arm_add_q7.c │ │ │ │ ├── arm_and_u16.c │ │ │ │ ├── arm_and_u32.c │ │ │ │ ├── arm_and_u8.c │ │ │ │ ├── arm_clip_f16.c │ │ │ │ ├── arm_clip_f32.c │ │ │ │ ├── arm_clip_q15.c │ │ │ │ ├── arm_clip_q31.c │ │ │ │ ├── arm_clip_q7.c │ │ │ │ ├── arm_dot_prod_f16.c │ │ │ │ ├── arm_dot_prod_f32.c │ │ │ │ ├── arm_dot_prod_f64.c │ │ │ │ ├── arm_dot_prod_q15.c │ │ │ │ ├── arm_dot_prod_q31.c │ │ │ │ ├── arm_dot_prod_q7.c │ │ │ │ ├── arm_mult_f16.c │ │ │ │ ├── arm_mult_f32.c │ │ │ │ ├── arm_mult_f64.c │ │ │ │ ├── arm_mult_q15.c │ │ │ │ ├── arm_mult_q31.c │ │ │ │ ├── arm_mult_q7.c │ │ │ │ ├── arm_negate_f16.c │ │ │ │ ├── arm_negate_f32.c │ │ │ │ ├── arm_negate_f64.c │ │ │ │ ├── arm_negate_q15.c │ │ │ │ ├── arm_negate_q31.c │ │ │ │ ├── arm_negate_q7.c │ │ │ │ ├── arm_not_u16.c │ │ │ │ ├── arm_not_u32.c │ │ │ │ ├── arm_not_u8.c │ │ │ │ ├── arm_offset_f16.c │ │ │ │ ├── arm_offset_f32.c │ │ │ │ ├── arm_offset_f64.c │ │ │ │ ├── arm_offset_q15.c │ │ │ │ ├── arm_offset_q31.c │ │ │ │ ├── arm_offset_q7.c │ │ │ │ ├── arm_or_u16.c │ │ │ │ ├── arm_or_u32.c │ │ │ │ ├── arm_or_u8.c │ │ │ │ ├── arm_scale_f16.c │ │ │ │ ├── arm_scale_f32.c │ │ │ │ ├── arm_scale_f64.c │ │ │ │ ├── arm_scale_q15.c │ │ │ │ ├── arm_scale_q31.c │ │ │ │ ├── arm_scale_q7.c │ │ │ │ ├── arm_shift_q15.c │ │ │ │ ├── arm_shift_q31.c │ │ │ │ ├── arm_shift_q7.c │ │ │ │ ├── arm_sub_f16.c │ │ │ │ ├── arm_sub_f32.c │ │ │ │ ├── arm_sub_f64.c │ │ │ │ ├── arm_sub_q15.c │ │ │ │ ├── arm_sub_q31.c │ │ │ │ ├── arm_sub_q7.c │ │ │ │ ├── arm_xor_u16.c │ │ │ │ ├── arm_xor_u32.c │ │ │ │ └── arm_xor_u8.c │ │ │ │ ├── BayesFunctions │ │ │ │ ├── arm_gaussian_naive_bayes_predict_f16.c │ │ │ │ └── arm_gaussian_naive_bayes_predict_f32.c │ │ │ │ ├── CommonTables │ │ │ │ ├── arm_common_tables.c │ │ │ │ ├── arm_common_tables_f16.c │ │ │ │ ├── arm_const_structs.c │ │ │ │ ├── arm_const_structs_f16.c │ │ │ │ ├── arm_mve_tables.c │ │ │ │ └── arm_mve_tables_f16.c │ │ │ │ ├── ComplexMathFunctions │ │ │ │ ├── arm_cmplx_conj_f16.c │ │ │ │ ├── arm_cmplx_conj_f32.c │ │ │ │ ├── arm_cmplx_conj_q15.c │ │ │ │ ├── arm_cmplx_conj_q31.c │ │ │ │ ├── arm_cmplx_dot_prod_f16.c │ │ │ │ ├── arm_cmplx_dot_prod_f32.c │ │ │ │ ├── arm_cmplx_dot_prod_q15.c │ │ │ │ ├── arm_cmplx_dot_prod_q31.c │ │ │ │ ├── arm_cmplx_mag_f16.c │ │ │ │ ├── arm_cmplx_mag_f32.c │ │ │ │ ├── arm_cmplx_mag_f64.c │ │ │ │ ├── arm_cmplx_mag_fast_q15.c │ │ │ │ ├── arm_cmplx_mag_q15.c │ │ │ │ ├── arm_cmplx_mag_q31.c │ │ │ │ ├── arm_cmplx_mag_squared_f16.c │ │ │ │ ├── arm_cmplx_mag_squared_f32.c │ │ │ │ ├── arm_cmplx_mag_squared_f64.c │ │ │ │ ├── arm_cmplx_mag_squared_q15.c │ │ │ │ ├── arm_cmplx_mag_squared_q31.c │ │ │ │ ├── arm_cmplx_mult_cmplx_f16.c │ │ │ │ ├── arm_cmplx_mult_cmplx_f32.c │ │ │ │ ├── arm_cmplx_mult_cmplx_f64.c │ │ │ │ ├── arm_cmplx_mult_cmplx_q15.c │ │ │ │ ├── arm_cmplx_mult_cmplx_q31.c │ │ │ │ ├── arm_cmplx_mult_real_f16.c │ │ │ │ ├── arm_cmplx_mult_real_f32.c │ │ │ │ ├── arm_cmplx_mult_real_q15.c │ │ │ │ └── arm_cmplx_mult_real_q31.c │ │ │ │ ├── ControllerFunctions │ │ │ │ ├── arm_pid_init_f32.c │ │ │ │ ├── arm_pid_init_q15.c │ │ │ │ ├── arm_pid_init_q31.c │ │ │ │ ├── arm_pid_reset_f32.c │ │ │ │ ├── arm_pid_reset_q15.c │ │ │ │ ├── arm_pid_reset_q31.c │ │ │ │ ├── arm_sin_cos_f32.c │ │ │ │ └── arm_sin_cos_q31.c │ │ │ │ ├── DistanceFunctions │ │ │ │ ├── arm_boolean_distance.c │ │ │ │ ├── arm_boolean_distance_template.h │ │ │ │ ├── arm_braycurtis_distance_f16.c │ │ │ │ ├── arm_braycurtis_distance_f32.c │ │ │ │ ├── arm_canberra_distance_f16.c │ │ │ │ ├── arm_canberra_distance_f32.c │ │ │ │ ├── arm_chebyshev_distance_f16.c │ │ │ │ ├── arm_chebyshev_distance_f32.c │ │ │ │ ├── arm_chebyshev_distance_f64.c │ │ │ │ ├── arm_cityblock_distance_f16.c │ │ │ │ ├── arm_cityblock_distance_f32.c │ │ │ │ ├── arm_cityblock_distance_f64.c │ │ │ │ ├── arm_correlation_distance_f16.c │ │ │ │ ├── arm_correlation_distance_f32.c │ │ │ │ ├── arm_cosine_distance_f16.c │ │ │ │ ├── arm_cosine_distance_f32.c │ │ │ │ ├── arm_cosine_distance_f64.c │ │ │ │ ├── arm_dice_distance.c │ │ │ │ ├── arm_euclidean_distance_f16.c │ │ │ │ ├── arm_euclidean_distance_f32.c │ │ │ │ ├── arm_euclidean_distance_f64.c │ │ │ │ ├── arm_hamming_distance.c │ │ │ │ ├── arm_jaccard_distance.c │ │ │ │ ├── arm_jensenshannon_distance_f16.c │ │ │ │ ├── arm_jensenshannon_distance_f32.c │ │ │ │ ├── arm_kulsinski_distance.c │ │ │ │ ├── arm_minkowski_distance_f16.c │ │ │ │ ├── arm_minkowski_distance_f32.c │ │ │ │ ├── arm_rogerstanimoto_distance.c │ │ │ │ ├── arm_russellrao_distance.c │ │ │ │ ├── arm_sokalmichener_distance.c │ │ │ │ ├── arm_sokalsneath_distance.c │ │ │ │ └── arm_yule_distance.c │ │ │ │ ├── FastMathFunctions │ │ │ │ ├── arm_atan2_f16.c │ │ │ │ ├── arm_atan2_f32.c │ │ │ │ ├── arm_atan2_q15.c │ │ │ │ ├── arm_atan2_q31.c │ │ │ │ ├── arm_cos_f32.c │ │ │ │ ├── arm_cos_q15.c │ │ │ │ ├── arm_cos_q31.c │ │ │ │ ├── arm_divide_q15.c │ │ │ │ ├── arm_divide_q31.c │ │ │ │ ├── arm_sin_f32.c │ │ │ │ ├── arm_sin_q15.c │ │ │ │ ├── arm_sin_q31.c │ │ │ │ ├── arm_sqrt_q15.c │ │ │ │ ├── arm_sqrt_q31.c │ │ │ │ ├── arm_vexp_f16.c │ │ │ │ ├── arm_vexp_f32.c │ │ │ │ ├── arm_vexp_f64.c │ │ │ │ ├── arm_vinverse_f16.c │ │ │ │ ├── arm_vlog_f16.c │ │ │ │ ├── arm_vlog_f32.c │ │ │ │ ├── arm_vlog_f64.c │ │ │ │ ├── arm_vlog_q15.c │ │ │ │ └── arm_vlog_q31.c │ │ │ │ ├── FilteringFunctions │ │ │ │ ├── arm_biquad_cascade_df1_32x64_init_q31.c │ │ │ │ ├── arm_biquad_cascade_df1_32x64_q31.c │ │ │ │ ├── arm_biquad_cascade_df1_f16.c │ │ │ │ ├── arm_biquad_cascade_df1_f32.c │ │ │ │ ├── arm_biquad_cascade_df1_fast_q15.c │ │ │ │ ├── arm_biquad_cascade_df1_fast_q31.c │ │ │ │ ├── arm_biquad_cascade_df1_init_f16.c │ │ │ │ ├── arm_biquad_cascade_df1_init_f32.c │ │ │ │ ├── arm_biquad_cascade_df1_init_q15.c │ │ │ │ ├── arm_biquad_cascade_df1_init_q31.c │ │ │ │ ├── arm_biquad_cascade_df1_q15.c │ │ │ │ ├── arm_biquad_cascade_df1_q31.c │ │ │ │ ├── arm_biquad_cascade_df2T_f16.c │ │ │ │ ├── arm_biquad_cascade_df2T_f32.c │ │ │ │ ├── arm_biquad_cascade_df2T_f64.c │ │ │ │ ├── arm_biquad_cascade_df2T_init_f16.c │ │ │ │ ├── arm_biquad_cascade_df2T_init_f32.c │ │ │ │ ├── arm_biquad_cascade_df2T_init_f64.c │ │ │ │ ├── arm_biquad_cascade_stereo_df2T_f16.c │ │ │ │ ├── arm_biquad_cascade_stereo_df2T_f32.c │ │ │ │ ├── arm_biquad_cascade_stereo_df2T_init_f16.c │ │ │ │ ├── arm_biquad_cascade_stereo_df2T_init_f32.c │ │ │ │ ├── arm_conv_f32.c │ │ │ │ ├── arm_conv_fast_opt_q15.c │ │ │ │ ├── arm_conv_fast_q15.c │ │ │ │ ├── arm_conv_fast_q31.c │ │ │ │ ├── arm_conv_opt_q15.c │ │ │ │ ├── arm_conv_opt_q7.c │ │ │ │ ├── arm_conv_partial_f32.c │ │ │ │ ├── arm_conv_partial_fast_opt_q15.c │ │ │ │ ├── arm_conv_partial_fast_q15.c │ │ │ │ ├── arm_conv_partial_fast_q31.c │ │ │ │ ├── arm_conv_partial_opt_q15.c │ │ │ │ ├── arm_conv_partial_opt_q7.c │ │ │ │ ├── arm_conv_partial_q15.c │ │ │ │ ├── arm_conv_partial_q31.c │ │ │ │ ├── arm_conv_partial_q7.c │ │ │ │ ├── arm_conv_q15.c │ │ │ │ ├── arm_conv_q31.c │ │ │ │ ├── arm_conv_q7.c │ │ │ │ ├── arm_correlate_f16.c │ │ │ │ ├── arm_correlate_f32.c │ │ │ │ ├── arm_correlate_f64.c │ │ │ │ ├── arm_correlate_fast_opt_q15.c │ │ │ │ ├── arm_correlate_fast_q15.c │ │ │ │ ├── arm_correlate_fast_q31.c │ │ │ │ ├── arm_correlate_opt_q15.c │ │ │ │ ├── arm_correlate_opt_q7.c │ │ │ │ ├── arm_correlate_q15.c │ │ │ │ ├── arm_correlate_q31.c │ │ │ │ ├── arm_correlate_q7.c │ │ │ │ ├── arm_fir_decimate_f32.c │ │ │ │ ├── arm_fir_decimate_fast_q15.c │ │ │ │ ├── arm_fir_decimate_fast_q31.c │ │ │ │ ├── arm_fir_decimate_init_f32.c │ │ │ │ ├── arm_fir_decimate_init_q15.c │ │ │ │ ├── arm_fir_decimate_init_q31.c │ │ │ │ ├── arm_fir_decimate_q15.c │ │ │ │ ├── arm_fir_decimate_q31.c │ │ │ │ ├── arm_fir_f16.c │ │ │ │ ├── arm_fir_f32.c │ │ │ │ ├── arm_fir_f64.c │ │ │ │ ├── arm_fir_fast_q15.c │ │ │ │ ├── arm_fir_fast_q31.c │ │ │ │ ├── arm_fir_init_f16.c │ │ │ │ ├── arm_fir_init_f32.c │ │ │ │ ├── arm_fir_init_f64.c │ │ │ │ ├── arm_fir_init_q15.c │ │ │ │ ├── arm_fir_init_q31.c │ │ │ │ ├── arm_fir_init_q7.c │ │ │ │ ├── arm_fir_interpolate_f32.c │ │ │ │ ├── arm_fir_interpolate_init_f32.c │ │ │ │ ├── arm_fir_interpolate_init_q15.c │ │ │ │ ├── arm_fir_interpolate_init_q31.c │ │ │ │ ├── arm_fir_interpolate_q15.c │ │ │ │ ├── arm_fir_interpolate_q31.c │ │ │ │ ├── arm_fir_lattice_f32.c │ │ │ │ ├── arm_fir_lattice_init_f32.c │ │ │ │ ├── arm_fir_lattice_init_q15.c │ │ │ │ ├── arm_fir_lattice_init_q31.c │ │ │ │ ├── arm_fir_lattice_q15.c │ │ │ │ ├── arm_fir_lattice_q31.c │ │ │ │ ├── arm_fir_q15.c │ │ │ │ ├── arm_fir_q31.c │ │ │ │ ├── arm_fir_q7.c │ │ │ │ ├── arm_fir_sparse_f32.c │ │ │ │ ├── arm_fir_sparse_init_f32.c │ │ │ │ ├── arm_fir_sparse_init_q15.c │ │ │ │ ├── arm_fir_sparse_init_q31.c │ │ │ │ ├── arm_fir_sparse_init_q7.c │ │ │ │ ├── arm_fir_sparse_q15.c │ │ │ │ ├── arm_fir_sparse_q31.c │ │ │ │ ├── arm_fir_sparse_q7.c │ │ │ │ ├── arm_iir_lattice_f32.c │ │ │ │ ├── arm_iir_lattice_init_f32.c │ │ │ │ ├── arm_iir_lattice_init_q15.c │ │ │ │ ├── arm_iir_lattice_init_q31.c │ │ │ │ ├── arm_iir_lattice_q15.c │ │ │ │ ├── arm_iir_lattice_q31.c │ │ │ │ ├── arm_levinson_durbin_f16.c │ │ │ │ ├── arm_levinson_durbin_f32.c │ │ │ │ ├── arm_levinson_durbin_q31.c │ │ │ │ ├── arm_lms_f32.c │ │ │ │ ├── arm_lms_init_f32.c │ │ │ │ ├── arm_lms_init_q15.c │ │ │ │ ├── arm_lms_init_q31.c │ │ │ │ ├── arm_lms_norm_f32.c │ │ │ │ ├── arm_lms_norm_init_f32.c │ │ │ │ ├── arm_lms_norm_init_q15.c │ │ │ │ ├── arm_lms_norm_init_q31.c │ │ │ │ ├── arm_lms_norm_q15.c │ │ │ │ ├── arm_lms_norm_q31.c │ │ │ │ ├── arm_lms_q15.c │ │ │ │ └── arm_lms_q31.c │ │ │ │ ├── InterpolationFunctions │ │ │ │ ├── arm_bilinear_interp_f16.c │ │ │ │ ├── arm_bilinear_interp_f32.c │ │ │ │ ├── arm_bilinear_interp_q15.c │ │ │ │ ├── arm_bilinear_interp_q31.c │ │ │ │ ├── arm_bilinear_interp_q7.c │ │ │ │ ├── arm_linear_interp_f16.c │ │ │ │ ├── arm_linear_interp_f32.c │ │ │ │ ├── arm_linear_interp_q15.c │ │ │ │ ├── arm_linear_interp_q31.c │ │ │ │ ├── arm_linear_interp_q7.c │ │ │ │ ├── arm_spline_interp_f32.c │ │ │ │ └── arm_spline_interp_init_f32.c │ │ │ │ ├── MatrixFunctions │ │ │ │ ├── arm_householder_f16.c │ │ │ │ ├── arm_householder_f32.c │ │ │ │ ├── arm_householder_f64.c │ │ │ │ ├── arm_mat_add_f16.c │ │ │ │ ├── arm_mat_add_f32.c │ │ │ │ ├── arm_mat_add_q15.c │ │ │ │ ├── arm_mat_add_q31.c │ │ │ │ ├── arm_mat_cholesky_f16.c │ │ │ │ ├── arm_mat_cholesky_f32.c │ │ │ │ ├── arm_mat_cholesky_f64.c │ │ │ │ ├── arm_mat_cmplx_mult_f16.c │ │ │ │ ├── arm_mat_cmplx_mult_f32.c │ │ │ │ ├── arm_mat_cmplx_mult_q15.c │ │ │ │ ├── arm_mat_cmplx_mult_q31.c │ │ │ │ ├── arm_mat_cmplx_trans_f16.c │ │ │ │ ├── arm_mat_cmplx_trans_f32.c │ │ │ │ ├── arm_mat_cmplx_trans_q15.c │ │ │ │ ├── arm_mat_cmplx_trans_q31.c │ │ │ │ ├── arm_mat_init_f16.c │ │ │ │ ├── arm_mat_init_f32.c │ │ │ │ ├── arm_mat_init_q15.c │ │ │ │ ├── arm_mat_init_q31.c │ │ │ │ ├── arm_mat_inverse_f16.c │ │ │ │ ├── arm_mat_inverse_f32.c │ │ │ │ ├── arm_mat_inverse_f64.c │ │ │ │ ├── arm_mat_ldlt_f32.c │ │ │ │ ├── arm_mat_ldlt_f64.c │ │ │ │ ├── arm_mat_mult_f16.c │ │ │ │ ├── arm_mat_mult_f32.c │ │ │ │ ├── arm_mat_mult_f64.c │ │ │ │ ├── arm_mat_mult_fast_q15.c │ │ │ │ ├── arm_mat_mult_fast_q31.c │ │ │ │ ├── arm_mat_mult_opt_q31.c │ │ │ │ ├── arm_mat_mult_q15.c │ │ │ │ ├── arm_mat_mult_q31.c │ │ │ │ ├── arm_mat_mult_q7.c │ │ │ │ ├── arm_mat_qr_f16.c │ │ │ │ ├── arm_mat_qr_f32.c │ │ │ │ ├── arm_mat_qr_f64.c │ │ │ │ ├── arm_mat_scale_f16.c │ │ │ │ ├── arm_mat_scale_f32.c │ │ │ │ ├── arm_mat_scale_q15.c │ │ │ │ ├── arm_mat_scale_q31.c │ │ │ │ ├── arm_mat_solve_lower_triangular_f16.c │ │ │ │ ├── arm_mat_solve_lower_triangular_f32.c │ │ │ │ ├── arm_mat_solve_lower_triangular_f64.c │ │ │ │ ├── arm_mat_solve_upper_triangular_f16.c │ │ │ │ ├── arm_mat_solve_upper_triangular_f32.c │ │ │ │ ├── arm_mat_solve_upper_triangular_f64.c │ │ │ │ ├── arm_mat_sub_f16.c │ │ │ │ ├── arm_mat_sub_f32.c │ │ │ │ ├── arm_mat_sub_f64.c │ │ │ │ ├── arm_mat_sub_q15.c │ │ │ │ ├── arm_mat_sub_q31.c │ │ │ │ ├── arm_mat_trans_f16.c │ │ │ │ ├── arm_mat_trans_f32.c │ │ │ │ ├── arm_mat_trans_f64.c │ │ │ │ ├── arm_mat_trans_q15.c │ │ │ │ ├── arm_mat_trans_q31.c │ │ │ │ ├── arm_mat_trans_q7.c │ │ │ │ ├── arm_mat_vec_mult_f16.c │ │ │ │ ├── arm_mat_vec_mult_f32.c │ │ │ │ ├── arm_mat_vec_mult_q15.c │ │ │ │ ├── arm_mat_vec_mult_q31.c │ │ │ │ └── arm_mat_vec_mult_q7.c │ │ │ │ ├── QuaternionMathFunctions │ │ │ │ ├── arm_quaternion2rotation_f32.c │ │ │ │ ├── arm_quaternion_conjugate_f32.c │ │ │ │ ├── arm_quaternion_inverse_f32.c │ │ │ │ ├── arm_quaternion_norm_f32.c │ │ │ │ ├── arm_quaternion_normalize_f32.c │ │ │ │ ├── arm_quaternion_product_f32.c │ │ │ │ ├── arm_quaternion_product_single_f32.c │ │ │ │ └── arm_rotation2quaternion_f32.c │ │ │ │ ├── SVMFunctions │ │ │ │ ├── arm_svm_linear_init_f16.c │ │ │ │ ├── arm_svm_linear_init_f32.c │ │ │ │ ├── arm_svm_linear_predict_f16.c │ │ │ │ ├── arm_svm_linear_predict_f32.c │ │ │ │ ├── arm_svm_polynomial_init_f16.c │ │ │ │ ├── arm_svm_polynomial_init_f32.c │ │ │ │ ├── arm_svm_polynomial_predict_f16.c │ │ │ │ ├── arm_svm_polynomial_predict_f32.c │ │ │ │ ├── arm_svm_rbf_init_f16.c │ │ │ │ ├── arm_svm_rbf_init_f32.c │ │ │ │ ├── arm_svm_rbf_predict_f16.c │ │ │ │ ├── arm_svm_rbf_predict_f32.c │ │ │ │ ├── arm_svm_sigmoid_init_f16.c │ │ │ │ ├── arm_svm_sigmoid_init_f32.c │ │ │ │ ├── arm_svm_sigmoid_predict_f16.c │ │ │ │ └── arm_svm_sigmoid_predict_f32.c │ │ │ │ ├── StatisticsFunctions │ │ │ │ ├── arm_absmax_f16.c │ │ │ │ ├── arm_absmax_f32.c │ │ │ │ ├── arm_absmax_f64.c │ │ │ │ ├── arm_absmax_no_idx_f16.c │ │ │ │ ├── arm_absmax_no_idx_f32.c │ │ │ │ ├── arm_absmax_no_idx_f64.c │ │ │ │ ├── arm_absmax_no_idx_q15.c │ │ │ │ ├── arm_absmax_no_idx_q31.c │ │ │ │ ├── arm_absmax_no_idx_q7.c │ │ │ │ ├── arm_absmax_q15.c │ │ │ │ ├── arm_absmax_q31.c │ │ │ │ ├── arm_absmax_q7.c │ │ │ │ ├── arm_absmin_f16.c │ │ │ │ ├── arm_absmin_f32.c │ │ │ │ ├── arm_absmin_f64.c │ │ │ │ ├── arm_absmin_no_idx_f16.c │ │ │ │ ├── arm_absmin_no_idx_f32.c │ │ │ │ ├── arm_absmin_no_idx_f64.c │ │ │ │ ├── arm_absmin_no_idx_q15.c │ │ │ │ ├── arm_absmin_no_idx_q31.c │ │ │ │ ├── arm_absmin_no_idx_q7.c │ │ │ │ ├── arm_absmin_q15.c │ │ │ │ ├── arm_absmin_q31.c │ │ │ │ ├── arm_absmin_q7.c │ │ │ │ ├── arm_accumulate_f16.c │ │ │ │ ├── arm_accumulate_f32.c │ │ │ │ ├── arm_accumulate_f64.c │ │ │ │ ├── arm_entropy_f16.c │ │ │ │ ├── arm_entropy_f32.c │ │ │ │ ├── arm_entropy_f64.c │ │ │ │ ├── arm_kullback_leibler_f16.c │ │ │ │ ├── arm_kullback_leibler_f32.c │ │ │ │ ├── arm_kullback_leibler_f64.c │ │ │ │ ├── arm_logsumexp_dot_prod_f16.c │ │ │ │ ├── arm_logsumexp_dot_prod_f32.c │ │ │ │ ├── arm_logsumexp_f16.c │ │ │ │ ├── arm_logsumexp_f32.c │ │ │ │ ├── arm_max_f16.c │ │ │ │ ├── arm_max_f32.c │ │ │ │ ├── arm_max_f64.c │ │ │ │ ├── arm_max_no_idx_f16.c │ │ │ │ ├── arm_max_no_idx_f32.c │ │ │ │ ├── arm_max_no_idx_f64.c │ │ │ │ ├── arm_max_no_idx_q15.c │ │ │ │ ├── arm_max_no_idx_q31.c │ │ │ │ ├── arm_max_no_idx_q7.c │ │ │ │ ├── arm_max_q15.c │ │ │ │ ├── arm_max_q31.c │ │ │ │ ├── arm_max_q7.c │ │ │ │ ├── arm_mean_f16.c │ │ │ │ ├── arm_mean_f32.c │ │ │ │ ├── arm_mean_f64.c │ │ │ │ ├── arm_mean_q15.c │ │ │ │ ├── arm_mean_q31.c │ │ │ │ ├── arm_mean_q7.c │ │ │ │ ├── arm_min_f16.c │ │ │ │ ├── arm_min_f32.c │ │ │ │ ├── arm_min_f64.c │ │ │ │ ├── arm_min_no_idx_f16.c │ │ │ │ ├── arm_min_no_idx_f32.c │ │ │ │ ├── arm_min_no_idx_f64.c │ │ │ │ ├── arm_min_no_idx_q15.c │ │ │ │ ├── arm_min_no_idx_q31.c │ │ │ │ ├── arm_min_no_idx_q7.c │ │ │ │ ├── arm_min_q15.c │ │ │ │ ├── arm_min_q31.c │ │ │ │ ├── arm_min_q7.c │ │ │ │ ├── arm_mse_f16.c │ │ │ │ ├── arm_mse_f32.c │ │ │ │ ├── arm_mse_f64.c │ │ │ │ ├── arm_mse_q15.c │ │ │ │ ├── arm_mse_q31.c │ │ │ │ ├── arm_mse_q7.c │ │ │ │ ├── arm_power_f16.c │ │ │ │ ├── arm_power_f32.c │ │ │ │ ├── arm_power_f64.c │ │ │ │ ├── arm_power_q15.c │ │ │ │ ├── arm_power_q31.c │ │ │ │ ├── arm_power_q7.c │ │ │ │ ├── arm_rms_f16.c │ │ │ │ ├── arm_rms_f32.c │ │ │ │ ├── arm_rms_q15.c │ │ │ │ ├── arm_rms_q31.c │ │ │ │ ├── arm_std_f16.c │ │ │ │ ├── arm_std_f32.c │ │ │ │ ├── arm_std_f64.c │ │ │ │ ├── arm_std_q15.c │ │ │ │ ├── arm_std_q31.c │ │ │ │ ├── arm_var_f16.c │ │ │ │ ├── arm_var_f32.c │ │ │ │ ├── arm_var_f64.c │ │ │ │ ├── arm_var_q15.c │ │ │ │ └── arm_var_q31.c │ │ │ │ ├── SupportFunctions │ │ │ │ ├── arm_barycenter_f16.c │ │ │ │ ├── arm_barycenter_f32.c │ │ │ │ ├── arm_bitonic_sort_f32.c │ │ │ │ ├── arm_bubble_sort_f32.c │ │ │ │ ├── arm_copy_f16.c │ │ │ │ ├── arm_copy_f32.c │ │ │ │ ├── arm_copy_f64.c │ │ │ │ ├── arm_copy_q15.c │ │ │ │ ├── arm_copy_q31.c │ │ │ │ ├── arm_copy_q7.c │ │ │ │ ├── arm_f16_to_float.c │ │ │ │ ├── arm_f16_to_q15.c │ │ │ │ ├── arm_fill_f16.c │ │ │ │ ├── arm_fill_f32.c │ │ │ │ ├── arm_fill_f64.c │ │ │ │ ├── arm_fill_q15.c │ │ │ │ ├── arm_fill_q31.c │ │ │ │ ├── arm_fill_q7.c │ │ │ │ ├── arm_float_to_f16.c │ │ │ │ ├── arm_float_to_q15.c │ │ │ │ ├── arm_float_to_q31.c │ │ │ │ ├── arm_float_to_q7.c │ │ │ │ ├── arm_heap_sort_f32.c │ │ │ │ ├── arm_insertion_sort_f32.c │ │ │ │ ├── arm_merge_sort_f32.c │ │ │ │ ├── arm_merge_sort_init_f32.c │ │ │ │ ├── arm_q15_to_f16.c │ │ │ │ ├── arm_q15_to_float.c │ │ │ │ ├── arm_q15_to_q31.c │ │ │ │ ├── arm_q15_to_q7.c │ │ │ │ ├── arm_q31_to_float.c │ │ │ │ ├── arm_q31_to_q15.c │ │ │ │ ├── arm_q31_to_q7.c │ │ │ │ ├── arm_q7_to_float.c │ │ │ │ ├── arm_q7_to_q15.c │ │ │ │ ├── arm_q7_to_q31.c │ │ │ │ ├── arm_quick_sort_f32.c │ │ │ │ ├── arm_selection_sort_f32.c │ │ │ │ ├── arm_sort_f32.c │ │ │ │ ├── arm_sort_init_f32.c │ │ │ │ ├── arm_weighted_sum_f16.c │ │ │ │ └── arm_weighted_sum_f32.c │ │ │ │ └── TransformFunctions │ │ │ │ ├── arm_bitreversal.c │ │ │ │ ├── arm_bitreversal2.c │ │ │ │ ├── arm_bitreversal_f16.c │ │ │ │ ├── arm_cfft_f16.c │ │ │ │ ├── arm_cfft_f32.c │ │ │ │ ├── arm_cfft_f64.c │ │ │ │ ├── arm_cfft_init_f16.c │ │ │ │ ├── arm_cfft_init_f32.c │ │ │ │ ├── arm_cfft_init_f64.c │ │ │ │ ├── arm_cfft_init_q15.c │ │ │ │ ├── arm_cfft_init_q31.c │ │ │ │ ├── arm_cfft_q15.c │ │ │ │ ├── arm_cfft_q31.c │ │ │ │ ├── arm_cfft_radix2_f16.c │ │ │ │ ├── arm_cfft_radix2_f32.c │ │ │ │ ├── arm_cfft_radix2_init_f16.c │ │ │ │ ├── arm_cfft_radix2_init_f32.c │ │ │ │ ├── arm_cfft_radix2_init_q15.c │ │ │ │ ├── arm_cfft_radix2_init_q31.c │ │ │ │ ├── arm_cfft_radix2_q15.c │ │ │ │ ├── arm_cfft_radix2_q31.c │ │ │ │ ├── arm_cfft_radix4_f16.c │ │ │ │ ├── arm_cfft_radix4_f32.c │ │ │ │ ├── arm_cfft_radix4_init_f16.c │ │ │ │ ├── arm_cfft_radix4_init_f32.c │ │ │ │ ├── arm_cfft_radix4_init_q15.c │ │ │ │ ├── arm_cfft_radix4_init_q31.c │ │ │ │ ├── arm_cfft_radix4_q15.c │ │ │ │ ├── arm_cfft_radix4_q31.c │ │ │ │ ├── arm_cfft_radix8_f16.c │ │ │ │ ├── arm_cfft_radix8_f32.c │ │ │ │ ├── arm_dct4_f32.c │ │ │ │ ├── arm_dct4_init_f32.c │ │ │ │ ├── arm_dct4_init_q15.c │ │ │ │ ├── arm_dct4_init_q31.c │ │ │ │ ├── arm_dct4_q15.c │ │ │ │ ├── arm_dct4_q31.c │ │ │ │ ├── arm_mfcc_f16.c │ │ │ │ ├── arm_mfcc_f32.c │ │ │ │ ├── arm_mfcc_init_f16.c │ │ │ │ ├── arm_mfcc_init_f32.c │ │ │ │ ├── arm_mfcc_init_q15.c │ │ │ │ ├── arm_mfcc_init_q31.c │ │ │ │ ├── arm_mfcc_q15.c │ │ │ │ ├── arm_mfcc_q31.c │ │ │ │ ├── arm_rfft_f32.c │ │ │ │ ├── arm_rfft_fast_f16.c │ │ │ │ ├── arm_rfft_fast_f32.c │ │ │ │ ├── arm_rfft_fast_f64.c │ │ │ │ ├── arm_rfft_fast_init_f16.c │ │ │ │ ├── arm_rfft_fast_init_f32.c │ │ │ │ ├── arm_rfft_fast_init_f64.c │ │ │ │ ├── arm_rfft_init_f32.c │ │ │ │ ├── arm_rfft_init_q15.c │ │ │ │ ├── arm_rfft_init_q31.c │ │ │ │ ├── arm_rfft_q15.c │ │ │ │ └── arm_rfft_q31.c │ │ ├── NN │ │ │ ├── Include │ │ │ │ ├── arm_nn_math_types.h │ │ │ │ ├── arm_nn_tables.h │ │ │ │ ├── arm_nn_types.h │ │ │ │ ├── arm_nnfunctions.h │ │ │ │ └── arm_nnsupportfunctions.h │ │ │ └── Source │ │ │ │ ├── ActivationFunctions │ │ │ │ ├── arm_nn_activations_q15.c │ │ │ │ ├── arm_nn_activations_q7.c │ │ │ │ ├── arm_relu6_s8.c │ │ │ │ ├── arm_relu_q15.c │ │ │ │ └── arm_relu_q7.c │ │ │ │ ├── BasicMathFunctions │ │ │ │ ├── arm_elementwise_add_s16.c │ │ │ │ ├── arm_elementwise_add_s8.c │ │ │ │ ├── arm_elementwise_mul_s16.c │ │ │ │ └── arm_elementwise_mul_s8.c │ │ │ │ ├── ConcatenationFunctions │ │ │ │ ├── arm_concatenation_s8_w.c │ │ │ │ ├── arm_concatenation_s8_x.c │ │ │ │ ├── arm_concatenation_s8_y.c │ │ │ │ └── arm_concatenation_s8_z.c │ │ │ │ ├── ConvolutionFunctions │ │ │ │ ├── arm_convolve_1_x_n_s8.c │ │ │ │ ├── arm_convolve_1x1_HWC_q7_fast_nonsquare.c │ │ │ │ ├── arm_convolve_1x1_s8_fast.c │ │ │ │ ├── arm_convolve_HWC_q15_basic.c │ │ │ │ ├── arm_convolve_HWC_q15_fast.c │ │ │ │ ├── arm_convolve_HWC_q15_fast_nonsquare.c │ │ │ │ ├── arm_convolve_HWC_q7_RGB.c │ │ │ │ ├── arm_convolve_HWC_q7_basic.c │ │ │ │ ├── arm_convolve_HWC_q7_basic_nonsquare.c │ │ │ │ ├── arm_convolve_HWC_q7_fast.c │ │ │ │ ├── arm_convolve_HWC_q7_fast_nonsquare.c │ │ │ │ ├── arm_convolve_fast_s16.c │ │ │ │ ├── arm_convolve_s16.c │ │ │ │ ├── arm_convolve_s8.c │ │ │ │ ├── arm_convolve_wrapper_s16.c │ │ │ │ ├── arm_convolve_wrapper_s8.c │ │ │ │ ├── arm_depthwise_conv_3x3_s8.c │ │ │ │ ├── arm_depthwise_conv_fast_s16.c │ │ │ │ ├── arm_depthwise_conv_s16.c │ │ │ │ ├── arm_depthwise_conv_s8.c │ │ │ │ ├── arm_depthwise_conv_s8_opt.c │ │ │ │ ├── arm_depthwise_conv_u8_basic_ver1.c │ │ │ │ ├── arm_depthwise_conv_wrapper_s16.c │ │ │ │ ├── arm_depthwise_conv_wrapper_s8.c │ │ │ │ ├── arm_depthwise_separable_conv_HWC_q7.c │ │ │ │ ├── arm_depthwise_separable_conv_HWC_q7_nonsquare.c │ │ │ │ ├── arm_nn_depthwise_conv_s8_core.c │ │ │ │ ├── arm_nn_mat_mult_kernel_q7_q15.c │ │ │ │ ├── arm_nn_mat_mult_kernel_q7_q15_reordered.c │ │ │ │ ├── arm_nn_mat_mult_kernel_s8_s16.c │ │ │ │ └── arm_nn_mat_mult_s8.c │ │ │ │ ├── FullyConnectedFunctions │ │ │ │ ├── arm_fully_connected_mat_q7_vec_q15.c │ │ │ │ ├── arm_fully_connected_mat_q7_vec_q15_opt.c │ │ │ │ ├── arm_fully_connected_q15.c │ │ │ │ ├── arm_fully_connected_q15_opt.c │ │ │ │ ├── arm_fully_connected_q7.c │ │ │ │ ├── arm_fully_connected_q7_opt.c │ │ │ │ ├── arm_fully_connected_s16.c │ │ │ │ └── arm_fully_connected_s8.c │ │ │ │ ├── NNSupportFunctions │ │ │ │ ├── arm_nn_accumulate_q7_to_q15.c │ │ │ │ ├── arm_nn_add_q7.c │ │ │ │ ├── arm_nn_depthwise_conv_nt_t_padded_s8.c │ │ │ │ ├── arm_nn_depthwise_conv_nt_t_s16.c │ │ │ │ ├── arm_nn_depthwise_conv_nt_t_s8.c │ │ │ │ ├── arm_nn_mat_mul_core_1x_s8.c │ │ │ │ ├── arm_nn_mat_mul_core_4x_s8.c │ │ │ │ ├── arm_nn_mat_mul_kernel_s16.c │ │ │ │ ├── arm_nn_mat_mult_nt_t_s8.c │ │ │ │ ├── arm_nn_mult_q15.c │ │ │ │ ├── arm_nn_mult_q7.c │ │ │ │ ├── arm_nn_vec_mat_mult_t_s16.c │ │ │ │ ├── arm_nn_vec_mat_mult_t_s8.c │ │ │ │ ├── arm_nn_vec_mat_mult_t_svdf_s8.c │ │ │ │ ├── arm_nntables.c │ │ │ │ ├── arm_q7_to_q15_no_shift.c │ │ │ │ ├── arm_q7_to_q15_reordered_no_shift.c │ │ │ │ ├── arm_q7_to_q15_reordered_with_offset.c │ │ │ │ └── arm_q7_to_q15_with_offset.c │ │ │ │ ├── PoolingFunctions │ │ │ │ ├── arm_avgpool_s16.c │ │ │ │ ├── arm_avgpool_s8.c │ │ │ │ ├── arm_max_pool_s16.c │ │ │ │ ├── arm_max_pool_s8.c │ │ │ │ └── arm_pool_q7_HWC.c │ │ │ │ ├── ReshapeFunctions │ │ │ │ └── arm_reshape_s8.c │ │ │ │ ├── SVDFunctions │ │ │ │ ├── arm_svdf_s8.c │ │ │ │ └── arm_svdf_state_s16_s8.c │ │ │ │ └── SoftmaxFunctions │ │ │ │ ├── arm_nn_softmax_common_s8.c │ │ │ │ ├── arm_softmax_q15.c │ │ │ │ ├── arm_softmax_q7.c │ │ │ │ ├── arm_softmax_s16.c │ │ │ │ ├── arm_softmax_s8.c │ │ │ │ ├── arm_softmax_s8_s16.c │ │ │ │ ├── arm_softmax_u8.c │ │ │ │ └── arm_softmax_with_batch_q7.c │ │ └── sources.txt │ ├── LICENSE │ ├── LICENSE.3-clause-bsd-clear │ ├── README.md │ ├── classifier │ │ ├── ei_aligned_malloc.h │ │ ├── ei_classifier_config.h │ │ ├── ei_classifier_smooth.h │ │ ├── ei_classifier_types.h │ │ ├── ei_constants.h │ │ ├── ei_fill_result_struct.h │ │ ├── ei_model_types.h │ │ ├── ei_nms.h │ │ ├── ei_quantize.h │ │ ├── ei_run_classifier.h │ │ ├── ei_run_classifier_c.cpp │ │ ├── ei_run_classifier_c.h │ │ ├── ei_run_classifier_image.h │ │ ├── ei_run_dsp.h │ │ ├── ei_signal_with_axes.h │ │ ├── ei_signal_with_range.h │ │ ├── inferencing_engines │ │ │ ├── akida.h │ │ │ ├── anomaly.h │ │ │ ├── aton.h │ │ │ ├── ceva_npn.h │ │ │ ├── drpai.h │ │ │ ├── engines.h │ │ │ ├── ethos_linux.h │ │ │ ├── memryx.h │ │ │ ├── onnx_tidl.h │ │ │ ├── tensaiflow.h │ │ │ ├── tensorrt.h │ │ │ ├── tflite_eon.h │ │ │ ├── tflite_full.h │ │ │ ├── tflite_helper.h │ │ │ ├── tflite_micro.h │ │ │ └── tflite_tidl.h │ │ └── postprocessing │ │ │ ├── alignment │ │ │ ├── ei_alignment.hpp │ │ │ └── rectangular_lsap.hpp │ │ │ ├── ei_object_counting.h │ │ │ ├── ei_object_tracking.h │ │ │ ├── ei_performance_calibration.h │ │ │ ├── ei_postprocessing.h │ │ │ ├── ei_postprocessing_common.h │ │ │ └── tinyEKF │ │ │ ├── LICENSE.md │ │ │ ├── tinyekf.hpp │ │ │ └── tinyekf_custom.h │ ├── cmake │ │ ├── add_source.cmake │ │ ├── utils.cmake │ │ └── zephyr │ │ │ └── CMakeLists.txt │ ├── dsp │ │ ├── README.md │ │ ├── config.hpp │ │ ├── dct │ │ │ ├── .clang-format │ │ │ ├── fast-dct-fft.cpp │ │ │ └── fast-dct-fft.h │ │ ├── dsp_engines │ │ │ ├── ei_arm_cmsis_dsp.h │ │ │ ├── ei_ceva_dsp.h │ │ │ ├── ei_ceva_dsp_fixed.h │ │ │ └── ei_no_hw_dsp.h │ │ ├── ei_alloc.h │ │ ├── ei_dsp_handle.h │ │ ├── ei_flatten.h │ │ ├── ei_hr.hpp │ │ ├── ei_profiler.h │ │ ├── ei_utils.h │ │ ├── ei_vector.h │ │ ├── image │ │ │ ├── image.hpp │ │ │ ├── processing.cpp │ │ │ └── processing.hpp │ │ ├── kissfft │ │ │ ├── .clang-format │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── _kiss_fft_guts.h │ │ │ ├── kiss_fft.cpp │ │ │ ├── kiss_fft.h │ │ │ ├── kiss_fftr.cpp │ │ │ ├── kiss_fftr.h │ │ │ └── kissfft.h │ │ ├── memory.cpp │ │ ├── memory.hpp │ │ ├── numpy.hpp │ │ ├── numpy_types.h │ │ ├── returntypes.h │ │ ├── returntypes.hpp │ │ ├── spectral │ │ │ ├── feature.hpp │ │ │ ├── filters.hpp │ │ │ ├── fir_filter.hpp │ │ │ ├── processing.hpp │ │ │ ├── signal.hpp │ │ │ ├── spectral.hpp │ │ │ ├── wavelet.hpp │ │ │ └── wavelet_coeff.hpp │ │ └── speechpy │ │ │ ├── feature.hpp │ │ │ ├── functions.hpp │ │ │ ├── processing.hpp │ │ │ └── speechpy.hpp │ ├── porting │ │ ├── .clang-format │ │ ├── ambiq │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── android │ │ │ └── ei_classifier_porting.cpp │ │ ├── arduino │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── brickml │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── ceva-npn │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── clib │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── ei_classifier_porting.h │ │ ├── ei_logging.h │ │ ├── espressif │ │ │ ├── ESP-NN │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CONTRIBUTING.md │ │ │ │ ├── Kconfig.projbuild │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── idf_component.yml │ │ │ │ ├── include │ │ │ │ │ ├── esp_nn.h │ │ │ │ │ ├── esp_nn_ansi_c.h │ │ │ │ │ ├── esp_nn_ansi_headers.h │ │ │ │ │ ├── esp_nn_defs.h │ │ │ │ │ ├── esp_nn_esp32p4.h │ │ │ │ │ ├── esp_nn_esp32s3.h │ │ │ │ │ └── esp_nn_generic_opt.h │ │ │ │ └── src │ │ │ │ │ ├── activation_functions │ │ │ │ │ ├── esp_nn_relu_ansi.c │ │ │ │ │ └── esp_nn_relu_s8_esp32s3.S │ │ │ │ │ ├── basic_math │ │ │ │ │ ├── esp_nn_add_ansi.c │ │ │ │ │ ├── esp_nn_add_s8_esp32s3.S │ │ │ │ │ ├── esp_nn_mul_ansi.c │ │ │ │ │ └── esp_nn_mul_s8_esp32s3.S │ │ │ │ │ ├── common │ │ │ │ │ ├── common_functions.h │ │ │ │ │ ├── esp_nn_common_functions_esp32s3.S │ │ │ │ │ ├── esp_nn_multiply_by_quantized_mult_esp32s3.S │ │ │ │ │ └── esp_nn_multiply_by_quantized_mult_ver1_esp32s3.S │ │ │ │ │ ├── convolution │ │ │ │ │ ├── esp_nn_conv_ansi.c │ │ │ │ │ ├── esp_nn_conv_esp32p4.c │ │ │ │ │ ├── esp_nn_conv_esp32s3.c │ │ │ │ │ ├── esp_nn_conv_opt.c │ │ │ │ │ ├── esp_nn_conv_s16_mult4_1x1_esp32s3.S │ │ │ │ │ ├── esp_nn_conv_s16_mult8_esp32s3.S │ │ │ │ │ ├── esp_nn_conv_s8_filter_aligned_input_padded_esp32s3.S │ │ │ │ │ ├── esp_nn_conv_s8_mult8_1x1_esp32s3.S │ │ │ │ │ ├── esp_nn_depthwise_conv_ansi.c │ │ │ │ │ ├── esp_nn_depthwise_conv_opt.c │ │ │ │ │ ├── esp_nn_depthwise_conv_s16_mult1_3x3_esp32s3.S │ │ │ │ │ ├── esp_nn_depthwise_conv_s16_mult1_3x3_no_pad_esp32s3.S │ │ │ │ │ ├── esp_nn_depthwise_conv_s16_mult1_esp32s3.S │ │ │ │ │ ├── esp_nn_depthwise_conv_s16_mult4_esp32s3.S │ │ │ │ │ ├── esp_nn_depthwise_conv_s16_mult8_3x3_esp32s3.S │ │ │ │ │ ├── esp_nn_depthwise_conv_s16_mult8_esp32s3.S │ │ │ │ │ ├── esp_nn_depthwise_conv_s8_esp32s3.c │ │ │ │ │ └── esp_nn_depthwise_conv_s8_mult1_3x3_padded_esp32s3.S │ │ │ │ │ ├── fully_connected │ │ │ │ │ ├── esp_nn_fully_connected_ansi.c │ │ │ │ │ └── esp_nn_fully_connected_s8_esp32s3.S │ │ │ │ │ ├── pooling │ │ │ │ │ ├── esp_nn_avg_pool_ansi.c │ │ │ │ │ ├── esp_nn_avg_pool_s8_esp32s3.S │ │ │ │ │ ├── esp_nn_max_pool_ansi.c │ │ │ │ │ └── esp_nn_max_pool_s8_esp32s3.S │ │ │ │ │ └── softmax │ │ │ │ │ ├── esp_nn_softmax_ansi.c │ │ │ │ │ ├── esp_nn_softmax_opt.c │ │ │ │ │ └── softmax_common.h │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── ethos-core-driver │ │ │ ├── CMakeLists.txt │ │ │ ├── LICENSE.txt │ │ │ ├── README.MD │ │ │ ├── SECURITY.md │ │ │ ├── include │ │ │ │ ├── ethosu_driver.h │ │ │ │ ├── ethosu_types.h │ │ │ │ └── pmu_ethosu.h │ │ │ ├── src │ │ │ │ ├── ehtosu_config_u65.h │ │ │ │ ├── ethosu55_interface.h │ │ │ │ ├── ethosu65_interface.h │ │ │ │ ├── ethosu85_interface.h │ │ │ │ ├── ethosu_config_u55.h │ │ │ │ ├── ethosu_config_u85.h │ │ │ │ ├── ethosu_device.h │ │ │ │ ├── ethosu_device_u55_u65.c │ │ │ │ ├── ethosu_device_u85.c │ │ │ │ ├── ethosu_driver.c │ │ │ │ ├── ethosu_interface.h │ │ │ │ ├── ethosu_log.h │ │ │ │ └── ethosu_pmu.c │ │ │ └── version.txt │ │ ├── himax-we2 │ │ │ ├── debug_log.cpp │ │ │ ├── ei_classifier_porting.cpp │ │ │ └── ethosu_driver.c │ │ ├── himax │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── iar │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── infineon-psoc62 │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── mbed │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── mingw32 │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── particle │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── posix │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── raspberry │ │ │ └── ei_classifier_porting.cpp │ │ ├── renesas-ra │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── seeed-vision-ai │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── silabs │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── sony │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── stm32-cubeai │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── synaptics │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ ├── ti │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ │ └── zephyr │ │ │ ├── debug_log.cpp │ │ │ └── ei_classifier_porting.cpp │ ├── sources.txt │ ├── tensorflow │ │ ├── LICENSE │ │ └── lite │ │ │ ├── builtin_op_data.h │ │ │ ├── builtin_ops.h │ │ │ ├── c │ │ │ ├── builtin_op_data.h │ │ │ ├── c_api_types.h │ │ │ ├── common.c │ │ │ └── common.h │ │ │ ├── context_util.h │ │ │ ├── core │ │ │ ├── api │ │ │ │ ├── common.cc │ │ │ │ ├── error_reporter.cc │ │ │ │ ├── error_reporter.h │ │ │ │ ├── flatbuffer_conversions.cc │ │ │ │ ├── flatbuffer_conversions.h │ │ │ │ ├── op_resolver.cc │ │ │ │ ├── op_resolver.h │ │ │ │ ├── tensor_utils.cc │ │ │ │ └── tensor_utils.h │ │ │ └── c │ │ │ │ ├── builtin_op_data.h │ │ │ │ ├── c_api_types.h │ │ │ │ └── common.h │ │ │ ├── kernels │ │ │ ├── custom │ │ │ │ ├── tree_ensemble_classifier.cc │ │ │ │ └── tree_ensemble_classifier.h │ │ │ ├── internal │ │ │ │ ├── common.h │ │ │ │ ├── compatibility.h │ │ │ │ ├── cppmath.h │ │ │ │ ├── max.h │ │ │ │ ├── min.h │ │ │ │ ├── optimized │ │ │ │ │ └── neon_check.h │ │ │ │ ├── portable_tensor.h │ │ │ │ ├── portable_tensor_utils.cc │ │ │ │ ├── portable_tensor_utils.h │ │ │ │ ├── quantization_util.cc │ │ │ │ ├── quantization_util.h │ │ │ │ ├── reduce_common.h │ │ │ │ ├── reference │ │ │ │ │ ├── add.h │ │ │ │ │ ├── add_n.h │ │ │ │ │ ├── arg_min_max.h │ │ │ │ │ ├── batch_matmul.h │ │ │ │ │ ├── batch_to_space_nd.h │ │ │ │ │ ├── binary_function.h │ │ │ │ │ ├── broadcast_args.h │ │ │ │ │ ├── broadcast_to.h │ │ │ │ │ ├── ceil.h │ │ │ │ │ ├── comparisons.h │ │ │ │ │ ├── concatenation.h │ │ │ │ │ ├── conv.h │ │ │ │ │ ├── cumsum.h │ │ │ │ │ ├── depth_to_space.h │ │ │ │ │ ├── depthwiseconv_float.h │ │ │ │ │ ├── depthwiseconv_uint8.h │ │ │ │ │ ├── dequantize.h │ │ │ │ │ ├── div.h │ │ │ │ │ ├── elu.h │ │ │ │ │ ├── exp.h │ │ │ │ │ ├── fill.h │ │ │ │ │ ├── floor.h │ │ │ │ │ ├── floor_div.h │ │ │ │ │ ├── floor_mod.h │ │ │ │ │ ├── fully_connected.h │ │ │ │ │ ├── hard_swish.h │ │ │ │ │ ├── integer_ops │ │ │ │ │ │ ├── add.h │ │ │ │ │ │ ├── conv.h │ │ │ │ │ │ ├── depthwise_conv.h │ │ │ │ │ │ ├── fully_connected.h │ │ │ │ │ │ ├── l2normalization.h │ │ │ │ │ │ ├── logistic.h │ │ │ │ │ │ ├── mean.h │ │ │ │ │ │ ├── mul.h │ │ │ │ │ │ ├── pooling.h │ │ │ │ │ │ ├── tanh.h │ │ │ │ │ │ └── transpose_conv.h │ │ │ │ │ ├── l2normalization.h │ │ │ │ │ ├── leaky_relu.h │ │ │ │ │ ├── log_softmax.h │ │ │ │ │ ├── logistic.h │ │ │ │ │ ├── lstm_cell.h │ │ │ │ │ ├── maximum_minimum.h │ │ │ │ │ ├── mul.h │ │ │ │ │ ├── neg.h │ │ │ │ │ ├── pad.h │ │ │ │ │ ├── pooling.h │ │ │ │ │ ├── prelu.h │ │ │ │ │ ├── process_broadcast_shapes.h │ │ │ │ │ ├── quantize.h │ │ │ │ │ ├── reduce.h │ │ │ │ │ ├── requantize.h │ │ │ │ │ ├── resize_bilinear.h │ │ │ │ │ ├── resize_nearest_neighbor.h │ │ │ │ │ ├── round.h │ │ │ │ │ ├── scatter_nd.h │ │ │ │ │ ├── select.h │ │ │ │ │ ├── slice.h │ │ │ │ │ ├── softmax.h │ │ │ │ │ ├── space_to_batch_nd.h │ │ │ │ │ ├── space_to_depth.h │ │ │ │ │ ├── strided_slice.h │ │ │ │ │ ├── sub.h │ │ │ │ │ ├── tanh.h │ │ │ │ │ ├── transpose.h │ │ │ │ │ └── transpose_conv.h │ │ │ │ ├── reference_portable_tensor_utils.cc │ │ │ │ ├── reference_portable_tensor_utils.h │ │ │ │ ├── reference_portable_tensor_utils_impl.h │ │ │ │ ├── runtime_shape.h │ │ │ │ ├── strided_slice_logic.h │ │ │ │ ├── tensor_ctypes.h │ │ │ │ ├── tensor_utils.cc │ │ │ │ └── types.h │ │ │ ├── kernel_util.h │ │ │ ├── kernel_util_lite.cc │ │ │ ├── op_macros.h │ │ │ └── padding.h │ │ │ ├── micro │ │ │ ├── all_ops_resolver.cc │ │ │ ├── all_ops_resolver.h │ │ │ ├── compatibility.h │ │ │ ├── debug_log.h │ │ │ ├── fake_micro_context.cc │ │ │ ├── fake_micro_context.h │ │ │ ├── flatbuffer_conversions_bridge.cc │ │ │ ├── flatbuffer_conversions_bridge.h │ │ │ ├── flatbuffer_utils.cc │ │ │ ├── flatbuffer_utils.h │ │ │ ├── ibuffer_allocator.h │ │ │ ├── kernels │ │ │ │ ├── activation_utils.h │ │ │ │ ├── activations.cc │ │ │ │ ├── activations.h │ │ │ │ ├── activations_common.cc │ │ │ │ ├── add.cc │ │ │ │ ├── add.h │ │ │ │ ├── add_common.cc │ │ │ │ ├── add_n.cc │ │ │ │ ├── arg_min_max.cc │ │ │ │ ├── assign_variable.cc │ │ │ │ ├── batch_matmul.cc │ │ │ │ ├── batch_to_space_nd.cc │ │ │ │ ├── broadcast_args.cc │ │ │ │ ├── broadcast_to.cc │ │ │ │ ├── call_once.cc │ │ │ │ ├── cast.cc │ │ │ │ ├── ceil.cc │ │ │ │ ├── circular_buffer.cc │ │ │ │ ├── circular_buffer.h │ │ │ │ ├── circular_buffer_common.cc │ │ │ │ ├── circular_buffer_flexbuffers_generated_data.h │ │ │ │ ├── comparisons.cc │ │ │ │ ├── complex_abs.cc │ │ │ │ ├── concatenation.cc │ │ │ │ ├── conv.cc │ │ │ │ ├── conv.h │ │ │ │ ├── conv_common.cc │ │ │ │ ├── conv_test.h │ │ │ │ ├── cumsum.cc │ │ │ │ ├── depth_to_space.cc │ │ │ │ ├── depthwise_conv.cc │ │ │ │ ├── depthwise_conv.h │ │ │ │ ├── depthwise_conv_common.cc │ │ │ │ ├── dequantize.cc │ │ │ │ ├── dequantize.h │ │ │ │ ├── dequantize_common.cc │ │ │ │ ├── detection_postprocess.cc │ │ │ │ ├── detection_postprocess_flexbuffers_generated_data.h │ │ │ │ ├── div.cc │ │ │ │ ├── elementwise.cc │ │ │ │ ├── elu.cc │ │ │ │ ├── ethosu.cc │ │ │ │ ├── ethosu.h │ │ │ │ ├── exp.cc │ │ │ │ ├── expand_dims.cc │ │ │ │ ├── fill.cc │ │ │ │ ├── floor.cc │ │ │ │ ├── floor_div.cc │ │ │ │ ├── floor_mod.cc │ │ │ │ ├── fully_connected.cc │ │ │ │ ├── fully_connected.h │ │ │ │ ├── fully_connected_common.cc │ │ │ │ ├── gather.cc │ │ │ │ ├── gather_nd.cc │ │ │ │ ├── hard_swish.cc │ │ │ │ ├── hard_swish.h │ │ │ │ ├── hard_swish_common.cc │ │ │ │ ├── if.cc │ │ │ │ ├── kernel_runner.cc │ │ │ │ ├── kernel_runner.h │ │ │ │ ├── kernel_util.h │ │ │ │ ├── kernel_util_micro.cc │ │ │ │ ├── l2_pool_2d.cc │ │ │ │ ├── l2norm.cc │ │ │ │ ├── leaky_relu.cc │ │ │ │ ├── leaky_relu.h │ │ │ │ ├── leaky_relu_common.cc │ │ │ │ ├── log_softmax.cc │ │ │ │ ├── logical.cc │ │ │ │ ├── logical.h │ │ │ │ ├── logical_common.cc │ │ │ │ ├── logistic.cc │ │ │ │ ├── logistic.h │ │ │ │ ├── logistic_common.cc │ │ │ │ ├── lstm_eval.cc │ │ │ │ ├── lstm_eval.h │ │ │ │ ├── lstm_eval_test.h │ │ │ │ ├── lstm_shared.h │ │ │ │ ├── maximum_minimum.cc │ │ │ │ ├── micro_ops.h │ │ │ │ ├── micro_tensor_utils.cc │ │ │ │ ├── micro_tensor_utils.h │ │ │ │ ├── mirror_pad.cc │ │ │ │ ├── mli_function_specializations.h │ │ │ │ ├── mli_interface.cc │ │ │ │ ├── mli_interface.h │ │ │ │ ├── mli_slicers.cc │ │ │ │ ├── mli_slicers.h │ │ │ │ ├── mli_tf_utils.h │ │ │ │ ├── mul.cc │ │ │ │ ├── mul.h │ │ │ │ ├── mul_common.cc │ │ │ │ ├── neg.cc │ │ │ │ ├── pack.cc │ │ │ │ ├── pad.cc │ │ │ │ ├── pad.h │ │ │ │ ├── pooling.cc │ │ │ │ ├── pooling.h │ │ │ │ ├── pooling_common.cc │ │ │ │ ├── prelu.cc │ │ │ │ ├── prelu.h │ │ │ │ ├── prelu_common.cc │ │ │ │ ├── quantize.cc │ │ │ │ ├── quantize.h │ │ │ │ ├── quantize_common.cc │ │ │ │ ├── read_variable.cc │ │ │ │ ├── real.cc │ │ │ │ ├── reduce.cc │ │ │ │ ├── reduce.h │ │ │ │ ├── reduce_common.cc │ │ │ │ ├── reshape.cc │ │ │ │ ├── resize_bilinear.cc │ │ │ │ ├── resize_nearest_neighbor.cc │ │ │ │ ├── rfft2d.cc │ │ │ │ ├── round.cc │ │ │ │ ├── scatter_nd.cc │ │ │ │ ├── scratch_buf_mgr.cc │ │ │ │ ├── scratch_buf_mgr.h │ │ │ │ ├── scratch_buffers.cc │ │ │ │ ├── scratch_buffers.h │ │ │ │ ├── select.cc │ │ │ │ ├── shape.cc │ │ │ │ ├── slice.cc │ │ │ │ ├── softmax.cc │ │ │ │ ├── softmax.h │ │ │ │ ├── softmax_common.cc │ │ │ │ ├── space_to_batch_nd.cc │ │ │ │ ├── space_to_depth.cc │ │ │ │ ├── split.cc │ │ │ │ ├── split_v.cc │ │ │ │ ├── squared_difference.cc │ │ │ │ ├── squeeze.cc │ │ │ │ ├── strided_slice.cc │ │ │ │ ├── sub.cc │ │ │ │ ├── sub.h │ │ │ │ ├── sub_common.cc │ │ │ │ ├── svdf.cc │ │ │ │ ├── svdf.h │ │ │ │ ├── svdf_common.cc │ │ │ │ ├── tanh.cc │ │ │ │ ├── tile.cc │ │ │ │ ├── topk_v2.cc │ │ │ │ ├── transpose.cc │ │ │ │ ├── transpose_conv.cc │ │ │ │ ├── tree_ensemble_classifier.cc │ │ │ │ ├── tree_ensemble_classifier.h │ │ │ │ ├── unidirectional_sequence_lstm.cc │ │ │ │ ├── unpack.cc │ │ │ │ ├── var_handle.cc │ │ │ │ ├── while.cc │ │ │ │ └── zeros_like.cc │ │ │ ├── memory_helpers.cc │ │ │ ├── memory_helpers.h │ │ │ ├── memory_planner │ │ │ │ ├── greedy_memory_planner.cc │ │ │ │ ├── greedy_memory_planner.h │ │ │ │ ├── linear_memory_planner.cc │ │ │ │ ├── linear_memory_planner.h │ │ │ │ ├── memory_plan_struct.h │ │ │ │ ├── micro_memory_planner.h │ │ │ │ ├── non_persistent_buffer_planner_shim.cc │ │ │ │ └── non_persistent_buffer_planner_shim.h │ │ │ ├── micro_allocation_info.cc │ │ │ ├── micro_allocation_info.h │ │ │ ├── micro_allocator.cc │ │ │ ├── micro_allocator.h │ │ │ ├── micro_arena_constants.h │ │ │ ├── micro_context.cc │ │ │ ├── micro_context.h │ │ │ ├── micro_error_reporter.cc │ │ │ ├── micro_error_reporter.h │ │ │ ├── micro_graph.cc │ │ │ ├── micro_graph.h │ │ │ ├── micro_interpreter.cc │ │ │ ├── micro_interpreter.h │ │ │ ├── micro_log.cc │ │ │ ├── micro_log.h │ │ │ ├── micro_mutable_op_resolver.h │ │ │ ├── micro_op_resolver.h │ │ │ ├── micro_profiler.cc │ │ │ ├── micro_profiler.h │ │ │ ├── micro_profiler_interface.h │ │ │ ├── micro_resource_variable.cc │ │ │ ├── micro_resource_variable.h │ │ │ ├── micro_string.cc │ │ │ ├── micro_string.h │ │ │ ├── micro_time.cc │ │ │ ├── micro_time.h │ │ │ ├── micro_utils.cc │ │ │ ├── micro_utils.h │ │ │ ├── mock_micro_graph.cc │ │ │ ├── mock_micro_graph.h │ │ │ ├── non_persistent_arena_buffer_allocator.cc │ │ │ ├── non_persistent_arena_buffer_allocator.h │ │ │ ├── op_resolver_bridge.cc │ │ │ ├── op_resolver_bridge.h │ │ │ ├── persistent_arena_buffer_allocator.cc │ │ │ ├── persistent_arena_buffer_allocator.h │ │ │ ├── recording_micro_allocator.cc │ │ │ ├── recording_micro_allocator.h │ │ │ ├── recording_micro_interpreter.h │ │ │ ├── recording_single_arena_buffer_allocator.cc │ │ │ ├── recording_single_arena_buffer_allocator.h │ │ │ ├── schema_utils.cc │ │ │ ├── single_arena_buffer_allocator.cc │ │ │ ├── single_arena_buffer_allocator.h │ │ │ ├── system_setup.cc │ │ │ ├── system_setup.h │ │ │ ├── test_helper_custom_ops.cc │ │ │ ├── test_helper_custom_ops.h │ │ │ ├── test_helpers.cc │ │ │ └── test_helpers.h │ │ │ ├── portable_type_to_tflitetype.h │ │ │ └── schema │ │ │ ├── schema_generated.h │ │ │ ├── schema_generated_full.h │ │ │ └── schema_utils.h │ └── third_party │ │ ├── arc_mli_package │ │ ├── LICENSE │ │ ├── bin │ │ │ └── emsdp_em11d_em9d_dfss │ │ │ │ └── release │ │ │ │ └── libmli.a │ │ └── include │ │ │ ├── api │ │ │ ├── mli_helpers_api.h │ │ │ ├── mli_kernels_api.h │ │ │ ├── mli_krn_avepool_spec_api.h │ │ │ ├── mli_krn_conv2d_spec_api.h │ │ │ ├── mli_krn_depthwise_conv2d_spec_api.h │ │ │ ├── mli_krn_maxpool_spec_api.h │ │ │ └── mli_mov_api.h │ │ │ ├── mli_api.h │ │ │ ├── mli_config.h │ │ │ └── mli_types.h │ │ ├── flatbuffers │ │ ├── LICENSE.txt │ │ └── include │ │ │ └── flatbuffers │ │ │ ├── fb_allocator.h │ │ │ ├── fb_array.h │ │ │ ├── fb_base.h │ │ │ ├── fb_buffer.h │ │ │ ├── fb_buffer_ref.h │ │ │ ├── fb_default_allocator.h │ │ │ ├── fb_detached_buffer.h │ │ │ ├── fb_flatbuffer_builder.h │ │ │ ├── fb_stl_emulation.h │ │ │ ├── fb_string.h │ │ │ ├── fb_struct.h │ │ │ ├── fb_table.h │ │ │ ├── fb_util.h │ │ │ ├── fb_vector.h │ │ │ ├── fb_vector_downward.h │ │ │ ├── fb_verifier.h │ │ │ ├── flatbuffers.h │ │ │ └── flexbuffers.h │ │ ├── gemmlowp │ │ ├── LICENSE │ │ ├── fixedpoint │ │ │ ├── fixedpoint.h │ │ │ ├── fixedpoint_neon.h │ │ │ └── fixedpoint_sse.h │ │ └── internal │ │ │ └── detect_platform.h │ │ ├── incbin │ │ └── incbin.h │ │ └── ruy │ │ └── ruy │ │ └── profiler │ │ └── instrumentation.h ├── model-parameters │ ├── anomaly_metadata.h │ ├── model_metadata.h │ └── model_variables.h └── tflite-model │ ├── tflite_learn_3_compiled.cpp │ ├── tflite_learn_3_compiled.h │ └── trained_model_ops_define.h ├── firmware-sdk ├── .gitignore ├── CHANGELOG.md ├── CMakeLists.txt ├── QCBOR │ ├── inc │ │ ├── UsefulBuf.h │ │ └── qcbor.h │ └── src │ │ ├── UsefulBuf.c │ │ ├── ieee754.c │ │ ├── ieee754.h │ │ ├── qcbor_decode.c │ │ └── qcbor_encode.c ├── README.md ├── at-server │ ├── ei_at_command_set.cpp │ ├── ei_at_command_set.h │ ├── ei_at_history.h │ ├── ei_at_parser.cpp │ ├── ei_at_parser.h │ ├── ei_at_server.cpp │ ├── ei_at_server.h │ ├── ei_at_server_singleton.cpp │ └── ei_line_buffer.h ├── at_base64_lib.cpp ├── at_base64_lib.h ├── ei_camera_interface.h ├── ei_config_types.h ├── ei_device_info_lib.h ├── ei_device_interface.h ├── ei_device_lib.cpp ├── ei_device_lib.h ├── ei_device_memory.h ├── ei_fusion.cpp ├── ei_fusion.h ├── ei_image_lib.cpp ├── ei_image_lib.h ├── ei_image_nn.h ├── jpeg │ ├── JPEGENC.cpp │ ├── JPEGENC.h │ ├── encode_as_jpg.h │ └── jpeg.h ├── remote-mgmt.cpp ├── remote-mgmt.h └── sensor-aq │ ├── sensor_aq.cpp │ ├── sensor_aq.h │ ├── sensor_aq_none.cpp │ └── sensor_aq_none.h ├── overlay-remote-ingestion.conf ├── prj.conf └── src ├── CMakeLists.txt ├── ei_at_handlers.cpp ├── ei_at_handlers.h ├── ei_device_nrf91.cpp ├── ei_device_nrf91.h ├── ei_memory.cpp ├── ei_memory.h ├── ei_sampler.cpp ├── ei_sampler.h ├── ei_ws_client.cpp ├── ei_ws_client.h ├── inference ├── CMakeLists.txt ├── ei_run_fusion_impulse.cpp └── ei_run_impulse.h ├── main.cpp └── sensors ├── CMakeLists.txt ├── ei_accelerometer.cpp ├── ei_accelerometer.h ├── ei_environment.cpp ├── ei_environment.h ├── ei_fusion_sensors_config.h ├── ei_light.cpp └── ei_light.h /.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | * 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .vscode/ 3 | tags 4 | tags.lock 5 | .west/ 6 | bootloader/ 7 | tools/ 8 | *.hex 9 | create-arduino-library.sh 10 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.20.0) 2 | 3 | set(CMAKE_CXX_STANDARD 11) 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 5 | 6 | find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) 7 | 8 | project(firmware-nordic-thingy91) 9 | 10 | zephyr_compile_definitions(PROJECT_NAME=${PROJECT_NAME}) 11 | 12 | # Needed for colorful output 13 | zephyr_compile_options(-fdiagnostics-color=always) 14 | 15 | # Do not quantize filterbank 16 | # Enable manual loop unrolling in DSP functions 17 | add_definitions(-DEIDSP_QUANTIZE_FILTERBANK=0 18 | -DARM_MATH_LOOPUNROLL 19 | ) 20 | 21 | # Add all required source files 22 | add_subdirectory(ei-model/edge-impulse-sdk/cmake/zephyr) 23 | add_subdirectory(firmware-sdk) 24 | add_subdirectory(src/inference) 25 | add_subdirectory(src/sensors) 26 | add_subdirectory(src) 27 | 28 | # Include directories (everything in the SDK is already included here) 29 | target_include_directories(app PRIVATE .) 30 | target_include_directories(app PRIVATE ei-model) 31 | 32 | # Use GLOB to include model files, because model file names differes whether model is EON compiled or not 33 | RECURSIVE_FIND_FILE(MODEL_FILES ei-model/tflite-model "*.cpp") 34 | target_sources(app PRIVATE ${MODEL_FILES}) 35 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | WORKDIR /app 4 | 5 | ARG DEBIAN_FRONTEND=noninteractive 6 | 7 | # APT packages 8 | RUN apt update && apt install -y --no-install-recommends git ninja-build gperf \ 9 | ccache dfu-util device-tree-compiler wget \ 10 | python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ 11 | make gcc libsdl2-dev 12 | 13 | # Install recent CMake 14 | RUN if [ $(uname -m) = "x86_64" ]; then export ARCH=x86_64; else export ARCH=aarch64; fi && \ 15 | mkdir -p /opt/cmake && \ 16 | cd /opt/cmake && \ 17 | wget https://github.com/Kitware/CMake/releases/download/v3.21.3/cmake-3.21.3-linux-$ARCH.sh && \ 18 | sh cmake-3.21.3-linux-$ARCH.sh --prefix=/opt/cmake --skip-license && \ 19 | ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake && \ 20 | rm /opt/cmake/cmake-3.21.3-linux-$ARCH.sh 21 | 22 | # Zephyr SDK 23 | RUN if [ $(uname -m) = "x86_64" ]; then export ARCH=x86_64; else export ARCH=aarch64; fi && \ 24 | cd /opt && \ 25 | wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/zephyr-sdk-0.16.1_linux-${ARCH}_minimal.tar.xz && \ 26 | tar xf zephyr-sdk-0.16.1_linux-${ARCH}_minimal.tar.xz && \ 27 | cd zephyr-sdk-0.16.1 && \ 28 | ./setup.sh -t arm-zephyr-eabi -c 29 | ENV ZEPHYR_TOOLCHAIN_VARIANT=zephyr 30 | ENV ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk-0.16.1 31 | 32 | # Install west and the nRF Connect SDK 33 | RUN python3 -m pip install pip==21.2.4 34 | RUN pip3 install west==1.0.0 35 | RUN pip3 install ecdsa==0.17.0 36 | RUN mkdir /ncs 37 | RUN cd /ncs && west init -m https://github.com/nrfconnect/sdk-nrf --mr v2.4.0 38 | RUN cd /ncs && west update 39 | RUN cd /ncs && west zephyr-export 40 | RUN pip3 install -r /ncs/zephyr/scripts/requirements.txt 41 | 42 | ENV ZEPHYR_BASE="/ncs/zephyr" 43 | -------------------------------------------------------------------------------- /LICENSE.3-clause-bsd-clear: -------------------------------------------------------------------------------- 1 | The Clear BSD License 2 | 3 | Copyright (c) 2025 EdgeImpulse Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted (subject to the limitations in the disclaimer 8 | below) provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /boards/thingy91_nrf9160_ns.overlay: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | / { 8 | aliases { 9 | temp-sensor = &bme680; 10 | humidity-sensor = &bme680; 11 | pressure-sensor = &bme680; 12 | accelerometer = &adxl362; 13 | impact-sensor = &adxl372; 14 | }; 15 | }; 16 | 17 | &i2c2 { 18 | bme680: bme680@76 {}; 19 | }; 20 | 21 | &spi3 { 22 | adxl362: adxl362@0 { 23 | autosleep; 24 | }; 25 | }; 26 | -------------------------------------------------------------------------------- /child_image/prj.conf: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2021 Nordic Semiconductor ASA 3 | # 4 | # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | # 6 | 7 | ## Disable serial and UART interface. 8 | CONFIG_SERIAL=n 9 | CONFIG_UART_CONSOLE=n 10 | -------------------------------------------------------------------------------- /connectivity_bridge/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Nordic Semiconductor 3 | # 4 | # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | # 6 | 7 | cmake_minimum_required(VERSION 3.20.0) 8 | 9 | find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) 10 | project(NONE) 11 | 12 | # NORDIC SDK APP START 13 | target_sources(app PRIVATE src/main.c) 14 | # NORDIC SDK APP END 15 | 16 | # Include application events and disk files 17 | zephyr_library_include_directories( 18 | src/events 19 | ) 20 | 21 | # Application sources 22 | add_subdirectory(src/disk) 23 | add_subdirectory(src/events) 24 | add_subdirectory(src/modules) 25 | -------------------------------------------------------------------------------- /connectivity_bridge/Kconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Nordic Semiconductor ASA 3 | # 4 | # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | # 6 | 7 | menu "Connectivity Bridge" 8 | rsource "src/modules/Kconfig" 9 | rsource "src/events/Kconfig" 10 | endmenu 11 | 12 | menu "Zephyr Kernel" 13 | source "Kconfig.zephyr" 14 | endmenu 15 | -------------------------------------------------------------------------------- /connectivity_bridge/app.overlay: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | &zephyr_udc0 { 8 | cdc_acm_uart0: cdc_acm_uart0 { 9 | compatible = "zephyr,cdc-acm-uart"; 10 | }; 11 | 12 | cdc_acm_uart1: cdc_acm_uart1 { 13 | compatible = "zephyr,cdc-acm-uart"; 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /connectivity_bridge/sample.yaml: -------------------------------------------------------------------------------- 1 | sample: 2 | description: Connectivity Bridge application 3 | name: Connectivity Bridge 4 | tests: 5 | applications.connectivity_bridge: 6 | build_only: true 7 | platform_allow: thingy91_nrf52840 8 | integration_platforms: 9 | - thingy91_nrf52840 10 | tags: ci_build 11 | -------------------------------------------------------------------------------- /connectivity_bridge/src/disk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Nordic Semiconductor 3 | # 4 | # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | # 6 | 7 | # Write the generated files into the include/generated directory, which 8 | # is already in the system path 9 | set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/) 10 | generate_inc_file_for_target(app thingy91_cdc_acm.cat ${gen_dir}/thingy91_cdc_acm.cat.inc) 11 | generate_inc_file_for_target(app thingy91_cdc_acm.inf ${gen_dir}/thingy91_cdc_acm.inf.inc) 12 | 13 | target_sources_ifdef( 14 | CONFIG_BRIDGE_MSC_ENABLE 15 | app PRIVATE 16 | ${CMAKE_CURRENT_SOURCE_DIR}/readme.c 17 | ${CMAKE_CURRENT_SOURCE_DIR}/config.c 18 | ${CMAKE_CURRENT_SOURCE_DIR}/thingy91_cdc_acm.cat.c 19 | ${CMAKE_CURRENT_SOURCE_DIR}/thingy91_cdc_acm.inf.c) 20 | -------------------------------------------------------------------------------- /connectivity_bridge/src/disk/thingy91_cdc_acm.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/firmware-nordic-thingy91/840d17a01a716ad852a0f40b647ce2fd96e62e22/connectivity_bridge/src/disk/thingy91_cdc_acm.cat -------------------------------------------------------------------------------- /connectivity_bridge/src/disk/thingy91_cdc_acm.cat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | 9 | #define MODULE file_cat 10 | #include "fs_event.h" 11 | 12 | #if CONFIG_FS_FATFS_LFN 13 | #define FILE_NAME "thingy91_cdc_acm.cat" 14 | #else 15 | #define FILE_NAME "THINGY91.CAT" 16 | #endif 17 | #define FILE_CONTENTS file_contents 18 | #define FILE_CONTENTS_LEN sizeof(file_contents) 19 | 20 | static const char file_contents[] = { 21 | #include 22 | }; 23 | 24 | static bool app_event_handler(const struct app_event_header *aeh) 25 | { 26 | if (is_fs_event(aeh)) { 27 | const struct fs_event *event = 28 | cast_fs_event(aeh); 29 | 30 | if (event->req == FS_REQUEST_CREATE_FILE) { 31 | int err; 32 | 33 | err = fs_event_helper_file_write( 34 | event->mnt_point, 35 | FILE_NAME, 36 | FILE_CONTENTS, 37 | FILE_CONTENTS_LEN); 38 | 39 | __ASSERT_NO_MSG(err == 0); 40 | } 41 | 42 | return false; 43 | } 44 | 45 | /* If event is unhandled, unsubscribe. */ 46 | __ASSERT_NO_MSG(false); 47 | 48 | return false; 49 | } 50 | 51 | APP_EVENT_LISTENER(MODULE, app_event_handler); 52 | APP_EVENT_SUBSCRIBE(MODULE, fs_event); 53 | -------------------------------------------------------------------------------- /connectivity_bridge/src/disk/thingy91_cdc_acm.inf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | 9 | #define MODULE file_inf 10 | #include "fs_event.h" 11 | 12 | #if CONFIG_FS_FATFS_LFN 13 | #define FILE_NAME "thingy91_cdc_acm.inf" 14 | #else 15 | #define FILE_NAME "THINGY91.INF" 16 | #endif 17 | #define FILE_CONTENTS file_contents 18 | #define FILE_CONTENTS_LEN sizeof(file_contents) 19 | 20 | static const char file_contents[] = { 21 | #include 22 | }; 23 | 24 | static bool app_event_handler(const struct app_event_header *aeh) 25 | { 26 | if (is_fs_event(aeh)) { 27 | const struct fs_event *event = 28 | cast_fs_event(aeh); 29 | 30 | if (event->req == FS_REQUEST_CREATE_FILE) { 31 | int err; 32 | 33 | err = fs_event_helper_file_write( 34 | event->mnt_point, 35 | FILE_NAME, 36 | FILE_CONTENTS, 37 | FILE_CONTENTS_LEN); 38 | 39 | __ASSERT_NO_MSG(err == 0); 40 | } 41 | 42 | return false; 43 | } 44 | 45 | /* If event is unhandled, unsubscribe. */ 46 | __ASSERT_NO_MSG(false); 47 | 48 | return false; 49 | } 50 | 51 | APP_EVENT_LISTENER(MODULE, app_event_handler); 52 | APP_EVENT_SUBSCRIBE(MODULE, fs_event); 53 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Nordic Semiconductor 3 | # 4 | # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | # 6 | 7 | target_sources(app PRIVATE 8 | ${CMAKE_CURRENT_SOURCE_DIR}/module_state_event.c 9 | ${CMAKE_CURRENT_SOURCE_DIR}/peer_conn_event.c 10 | ${CMAKE_CURRENT_SOURCE_DIR}/ble_ctrl_event.c 11 | ${CMAKE_CURRENT_SOURCE_DIR}/ble_data_event.c 12 | ${CMAKE_CURRENT_SOURCE_DIR}/cdc_data_event.c 13 | ${CMAKE_CURRENT_SOURCE_DIR}/uart_data_event.c 14 | ${CMAKE_CURRENT_SOURCE_DIR}/fs_event.c 15 | ${CMAKE_CURRENT_SOURCE_DIR}/power_event.c) 16 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/Kconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Nordic Semiconductor 3 | # 4 | # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | # 6 | 7 | if LOG 8 | 9 | menu "Event options" 10 | 11 | comment "Initially logged events" 12 | 13 | config BRIDGE_LOG_MODULE_STATE_EVENT 14 | bool "Module state event" 15 | default y 16 | 17 | config BRIDGE_LOG_UART_DATA_EVENT 18 | bool "UART data event" 19 | default y 20 | 21 | config BRIDGE_LOG_CDC_DATA_EVENT 22 | bool "CDC data event" 23 | default y 24 | 25 | config BRIDGE_LOG_BLE_DATA_EVENT 26 | bool "BLE data event" 27 | default y 28 | 29 | config BRIDGE_LOG_BLE_CTRL_EVENT 30 | bool "BLE data event" 31 | default y 32 | 33 | config BRIDGE_LOG_PEER_CONN_EVENT 34 | bool "Peer connection event" 35 | default y 36 | 37 | config BRIDGE_LOG_FS_EVENT 38 | bool "File system event" 39 | default y 40 | 41 | config BRIDGE_LOG_POWER_DOWN_EVENT 42 | bool "Power down event" 43 | default y 44 | 45 | endmenu 46 | 47 | endif 48 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/ble_ctrl_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include "ble_ctrl_event.h" 11 | 12 | static void log_ble_ctrl_event(const struct app_event_header *aeh) 13 | { 14 | const struct ble_ctrl_event *event = cast_ble_ctrl_event(aeh); 15 | 16 | APP_EVENT_MANAGER_LOG(aeh, "cmd:%d", event->cmd); 17 | } 18 | 19 | APP_EVENT_TYPE_DEFINE(ble_ctrl_event, 20 | log_ble_ctrl_event, 21 | NULL, 22 | APP_EVENT_FLAGS_CREATE( 23 | IF_ENABLED(CONFIG_BRIDGE_LOG_BLE_CTRL_EVENT, 24 | (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE)))); 25 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/ble_ctrl_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #ifndef _BLE_CTRL_EVENT_H_ 8 | #define _BLE_CTRL_EVENT_H_ 9 | 10 | /** 11 | * @brief BLE Control Event 12 | * @defgroup ble_ctrl_event BLE Control Event 13 | * @{ 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | enum ble_ctrl_cmd { 27 | BLE_CTRL_ENABLE, 28 | BLE_CTRL_DISABLE, 29 | BLE_CTRL_NAME_UPDATE, 30 | }; 31 | 32 | /** BLE control event. */ 33 | struct ble_ctrl_event { 34 | struct app_event_header header; 35 | 36 | enum ble_ctrl_cmd cmd; 37 | union { 38 | const char *name_update; 39 | } param; 40 | }; 41 | 42 | APP_EVENT_TYPE_DECLARE(ble_ctrl_event); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | /** 49 | * @} 50 | */ 51 | 52 | #endif /* _BLE_CTRL_EVENT_H_ */ 53 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/ble_data_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include "ble_data_event.h" 11 | 12 | static void log_ble_data_event(const struct app_event_header *aeh) 13 | { 14 | const struct ble_data_event *event = cast_ble_data_event(aeh); 15 | 16 | APP_EVENT_MANAGER_LOG(aeh, "buf:%p len:%d", event->buf, event->len); 17 | } 18 | 19 | APP_EVENT_TYPE_DEFINE(ble_data_event, 20 | log_ble_data_event, 21 | NULL, 22 | APP_EVENT_FLAGS_CREATE( 23 | IF_ENABLED(CONFIG_BRIDGE_LOG_BLE_DATA_EVENT, 24 | (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE)))); 25 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/ble_data_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #ifndef _BLE_DATA_EVENT_H_ 8 | #define _BLE_DATA_EVENT_H_ 9 | 10 | /** 11 | * @brief BLE Data Event 12 | * @defgroup ble_data_event BLE Data Event 13 | * @{ 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** Peer connection event. */ 27 | struct ble_data_event { 28 | struct app_event_header header; 29 | 30 | uint8_t *buf; 31 | size_t len; 32 | }; 33 | 34 | APP_EVENT_TYPE_DECLARE(ble_data_event); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | /** 41 | * @} 42 | */ 43 | 44 | #endif /* _BLE_DATA_EVENT_H_ */ 45 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/cdc_data_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include "cdc_data_event.h" 11 | 12 | static void log_cdc_data_event(const struct app_event_header *aeh) 13 | { 14 | const struct cdc_data_event *event = cast_cdc_data_event(aeh); 15 | 16 | APP_EVENT_MANAGER_LOG(aeh, 17 | "dev:%u buf:%p len:%d", 18 | event->dev_idx, 19 | event->buf, 20 | event->len); 21 | } 22 | 23 | APP_EVENT_TYPE_DEFINE(cdc_data_event, 24 | log_cdc_data_event, 25 | NULL, 26 | APP_EVENT_FLAGS_CREATE( 27 | IF_ENABLED(CONFIG_BRIDGE_LOG_CDC_DATA_EVENT, 28 | (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE)))); 29 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/cdc_data_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #ifndef _CDC_DATA_EVENT_H_ 8 | #define _CDC_DATA_EVENT_H_ 9 | 10 | /** 11 | * @brief CDC Data Event 12 | * @defgroup cdc_data_event CDC Data Event 13 | * @{ 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** Peer connection event. */ 27 | struct cdc_data_event { 28 | struct app_event_header header; 29 | 30 | uint8_t dev_idx; 31 | uint8_t *buf; 32 | size_t len; 33 | }; 34 | 35 | APP_EVENT_TYPE_DECLARE(cdc_data_event); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | #endif /* _CDC_DATA_EVENT_H_ */ 46 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/fs_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | static void log_fs_event(const struct app_event_header *aeh) 14 | { 15 | const struct fs_event *event = cast_fs_event(aeh); 16 | 17 | APP_EVENT_MANAGER_LOG(aeh, "req:%d", event->req); 18 | } 19 | 20 | int fs_event_helper_file_write( 21 | const char *mnt_point, 22 | const char *file_path, 23 | char const *file_contents, 24 | size_t contents_len) 25 | { 26 | struct fs_file_t file; 27 | ssize_t bytes_written; 28 | char fname[128]; 29 | int err; 30 | 31 | err = snprintf(fname, sizeof(fname), "%s/%s", mnt_point, file_path); 32 | if (err <= 0 || err > sizeof(fname)) { 33 | return -ENOMEM; 34 | } 35 | 36 | fs_file_t_init(&file); 37 | err = fs_open(&file, fname, FS_O_CREATE | FS_O_RDWR); 38 | if (err) { 39 | return err; 40 | } 41 | 42 | err = fs_seek(&file, 0, FS_SEEK_END); 43 | if (err) { 44 | return err; 45 | } 46 | 47 | bytes_written = fs_write(&file, file_contents, contents_len); 48 | if (bytes_written != contents_len) { 49 | return -ENOMEM; 50 | } 51 | 52 | err = fs_close(&file); 53 | if (err) { 54 | return err; 55 | } 56 | 57 | return 0; 58 | } 59 | 60 | APP_EVENT_TYPE_DEFINE(fs_event, 61 | log_fs_event, 62 | NULL, 63 | APP_EVENT_FLAGS_CREATE( 64 | IF_ENABLED(CONFIG_BRIDGE_LOG_FS_EVENT, 65 | (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE)))); 66 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/fs_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #ifndef _FS_EVENT_H_ 8 | #define _FS_EVENT_H_ 9 | 10 | /** 11 | * @brief File system event 12 | * @defgroup fs_event File system event 13 | * @{ 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | enum fs_request { 27 | FS_REQUEST_CREATE_FILE, 28 | FS_REQUEST_PARSE_FILE, /* Triggered to detect user changes */ 29 | }; 30 | 31 | /** Peer connection event. */ 32 | struct fs_event { 33 | struct app_event_header header; 34 | 35 | enum fs_request req; 36 | const char *mnt_point; 37 | }; 38 | 39 | APP_EVENT_TYPE_DECLARE(fs_event); 40 | 41 | int fs_event_helper_file_write( 42 | const char *mnt_point, 43 | const char *file_path, 44 | char const *file_contents, 45 | size_t contents_len); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | #endif /* _FS_EVENT_H_ */ 56 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/module_state_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include "module_state_event.h" 11 | 12 | 13 | static const char * const state_name[] = { 14 | #define X(name) STRINGIFY(name), 15 | MODULE_STATE_LIST 16 | #undef X 17 | }; 18 | 19 | static void log_module_state_event(const struct app_event_header *aeh) 20 | { 21 | const struct module_state_event *event = cast_module_state_event(aeh); 22 | 23 | BUILD_ASSERT(ARRAY_SIZE(state_name) == MODULE_STATE_COUNT, 24 | "Invalid number of elements"); 25 | 26 | __ASSERT_NO_MSG(event->state < MODULE_STATE_COUNT); 27 | 28 | APP_EVENT_MANAGER_LOG(aeh, "module:%s state:%s", 29 | (const char *)event->module_id, state_name[event->state]); 30 | } 31 | 32 | APP_EVENT_TYPE_DEFINE(module_state_event, 33 | log_module_state_event, 34 | NULL, 35 | APP_EVENT_FLAGS_CREATE( 36 | IF_ENABLED(CONFIG_BRIDGE_LOG_MODULE_STATE_EVENT, 37 | (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE)))); 38 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/module_state_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #ifndef _MODULE_STATE_EVENT_H_ 8 | #define _MODULE_STATE_EVENT_H_ 9 | 10 | /** 11 | * @brief Module Event 12 | * @defgroup module_state_event Module State Event 13 | * @{ 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | 27 | /** Module state list. */ 28 | #define MODULE_STATE_LIST \ 29 | X(READY) \ 30 | X(OFF) \ 31 | X(STANDBY) \ 32 | X(ERROR) 33 | 34 | /** Module states. */ 35 | enum module_state { 36 | #define X(name) _CONCAT(MODULE_STATE_, name), 37 | MODULE_STATE_LIST 38 | #undef X 39 | 40 | MODULE_STATE_COUNT 41 | }; 42 | 43 | /** Module event. */ 44 | struct module_state_event { 45 | struct app_event_header header; 46 | 47 | const void *module_id; 48 | enum module_state state; 49 | }; 50 | 51 | APP_EVENT_TYPE_DECLARE(module_state_event); 52 | 53 | 54 | #if defined(MODULE) 55 | 56 | #define MODULE_NAME STRINGIFY(MODULE) 57 | 58 | const void * const _CONCAT(__module_, MODULE) = MODULE_NAME; 59 | 60 | static inline void module_set_state(enum module_state state) 61 | { 62 | __ASSERT_NO_MSG(state < MODULE_STATE_COUNT); 63 | 64 | struct module_state_event *event = new_module_state_event(); 65 | 66 | event->module_id = _CONCAT(__module_, MODULE); 67 | event->state = state; 68 | APP_EVENT_SUBMIT(event); 69 | } 70 | 71 | #endif 72 | 73 | 74 | static inline bool check_state(const struct module_state_event *event, 75 | const void *module_id, enum module_state state) 76 | { 77 | if ((event->module_id == module_id) && (event->state == state)) { 78 | return true; 79 | } 80 | return false; 81 | } 82 | 83 | 84 | #define MODULE_ID(mname) ({ \ 85 | extern const void * const _CONCAT(__module_, mname); \ 86 | _CONCAT(__module_, mname); \ 87 | }) 88 | 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | #endif /* _MODULE_STATE_EVENT_H_ */ 99 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/peer_conn_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include "peer_conn_event.h" 11 | 12 | static const char * const peer_name[] = { 13 | #define X(name) STRINGIFY(name), 14 | PEER_ID_LIST 15 | #undef X 16 | }; 17 | 18 | static void log_peer_conn_event(const struct app_event_header *aeh) 19 | { 20 | const struct peer_conn_event *event = cast_peer_conn_event(aeh); 21 | 22 | BUILD_ASSERT(ARRAY_SIZE(peer_name) == PEER_ID_COUNT, 23 | "Invalid number of elements"); 24 | 25 | __ASSERT_NO_MSG(event->peer_id < PEER_ID_COUNT); 26 | 27 | APP_EVENT_MANAGER_LOG(aeh, 28 | "%s:%s_%d baud:%d", 29 | event->conn_state == PEER_STATE_CONNECTED ? 30 | "CONNECTED" : "DISCONNECTED", 31 | peer_name[event->peer_id], 32 | event->dev_idx, 33 | event->baudrate); 34 | } 35 | 36 | APP_EVENT_TYPE_DEFINE(peer_conn_event, 37 | log_peer_conn_event, 38 | NULL, 39 | APP_EVENT_FLAGS_CREATE( 40 | IF_ENABLED(CONFIG_BRIDGE_LOG_PEER_CONN_EVENT, 41 | (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE)))); 42 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/peer_conn_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #ifndef _PEER_CONN_EVENT_H_ 8 | #define _PEER_CONN_EVENT_H_ 9 | 10 | /** 11 | * @brief Peer Connection Event 12 | * @defgroup peer_conn_event Peer Connection Event 13 | * @{ 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** Peer type list. */ 27 | #define PEER_ID_LIST \ 28 | X(USB) \ 29 | X(BLE) 30 | 31 | /** Peer ID list. */ 32 | enum peer_id { 33 | #define X(name) _CONCAT(PEER_ID_, name), 34 | PEER_ID_LIST 35 | #undef X 36 | 37 | PEER_ID_COUNT 38 | }; 39 | 40 | enum peer_conn_state { 41 | PEER_STATE_CONNECTED, 42 | PEER_STATE_DISCONNECTED 43 | }; 44 | 45 | /** Peer connection event. */ 46 | struct peer_conn_event { 47 | struct app_event_header header; 48 | 49 | enum peer_id peer_id; 50 | uint8_t dev_idx; 51 | enum peer_conn_state conn_state; 52 | uint32_t baudrate; 53 | }; 54 | 55 | APP_EVENT_TYPE_DECLARE(peer_conn_event); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | #endif /* _PEER_CONN_EVENT_H_ */ 66 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/power_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include "power_event.h" 8 | 9 | APP_EVENT_TYPE_DEFINE(power_down_event, 10 | NULL, 11 | NULL, 12 | APP_EVENT_FLAGS_CREATE( 13 | IF_ENABLED(CONFIG_BRIDGE_LOG_POWER_DOWN_EVENT, 14 | (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE)))); 15 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/power_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #ifndef _POWER_EVENT_H_ 8 | #define _POWER_EVENT_H_ 9 | 10 | /** 11 | * @brief Power Event 12 | * @defgroup power_event Power Event 13 | * @{ 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | struct power_down_event { 24 | struct app_event_header header; 25 | bool error; 26 | }; 27 | 28 | APP_EVENT_TYPE_DECLARE(power_down_event); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | /** 35 | * @} 36 | */ 37 | 38 | #endif /* _POWER_EVENT_H_ */ 39 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/uart_data_event.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include "uart_data_event.h" 11 | 12 | static void log_uart_data_event(const struct app_event_header *aeh) 13 | { 14 | const struct uart_data_event *event = cast_uart_data_event(aeh); 15 | 16 | APP_EVENT_MANAGER_LOG(aeh, 17 | "dev:%u buf:%p len:%d", 18 | event->dev_idx, 19 | event->buf, 20 | event->len); 21 | } 22 | 23 | APP_EVENT_TYPE_DEFINE(uart_data_event, 24 | log_uart_data_event, 25 | NULL, 26 | APP_EVENT_FLAGS_CREATE( 27 | IF_ENABLED(CONFIG_BRIDGE_LOG_UART_DATA_EVENT, 28 | (APP_EVENT_TYPE_FLAGS_INIT_LOG_ENABLE)))); 29 | -------------------------------------------------------------------------------- /connectivity_bridge/src/events/uart_data_event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #ifndef _UART_DATA_EVENT_H_ 8 | #define _UART_DATA_EVENT_H_ 9 | 10 | /** 11 | * @brief UART Data Event 12 | * @defgroup uart_data_event UART Data Event 13 | * @{ 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /** Peer connection event. */ 27 | struct uart_data_event { 28 | struct app_event_header header; 29 | 30 | uint8_t dev_idx; 31 | uint8_t *buf; 32 | size_t len; 33 | }; 34 | 35 | APP_EVENT_TYPE_DECLARE(uart_data_event); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | #endif /* _UART_DATA_EVENT_H_ */ 46 | -------------------------------------------------------------------------------- /connectivity_bridge/src/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | #define MODULE main 12 | #include "module_state_event.h" 13 | 14 | #include 15 | LOG_MODULE_REGISTER(MODULE); 16 | 17 | #define USB_SERIALNUMBER_TEMPLATE "THINGY91_%04X%08X" 18 | 19 | static uint8_t usb_serial_str[] = "THINGY91_12PLACEHLDRS"; 20 | 21 | /* Overriding weak function to set iSerialNumber at runtime. */ 22 | uint8_t *usb_update_sn_string_descriptor(void) 23 | { 24 | snprintk(usb_serial_str, sizeof(usb_serial_str), USB_SERIALNUMBER_TEMPLATE, 25 | (uint32_t)(NRF_FICR->DEVICEADDR[1] & 0x0000FFFF)|0x0000C000, 26 | (uint32_t)NRF_FICR->DEVICEADDR[0]); 27 | 28 | return usb_serial_str; 29 | } 30 | 31 | int main(void) 32 | { 33 | if (app_event_manager_init()) { 34 | LOG_ERR("Application Event Manager not initialized"); 35 | } else { 36 | module_set_state(MODULE_STATE_READY); 37 | } 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /connectivity_bridge/src/modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2020 Nordic Semiconductor 3 | # 4 | # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | # 6 | 7 | target_sources_ifdef(CONFIG_PM_DEVICE 8 | app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/power_handler.c) 9 | 10 | target_sources_ifdef(CONFIG_SERIAL 11 | app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/uart_handler.c) 12 | 13 | target_sources_ifdef(CONFIG_BRIDGE_CDC_ENABLE 14 | app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/usb_cdc_handler.c) 15 | 16 | target_sources_ifdef(CONFIG_BRIDGE_BLE_ENABLE 17 | app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ble_handler.c) 18 | 19 | target_sources_ifdef(CONFIG_BRIDGE_MSC_ENABLE 20 | app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/fs_handler.c) 21 | -------------------------------------------------------------------------------- /connectivity_bridge/src/modules/power_handler.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Nordic Semiconductor ASA 3 | * 4 | * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define MODULE power_handler 13 | #include "module_state_event.h" 14 | #include "power_event.h" 15 | 16 | #include 17 | LOG_MODULE_REGISTER(MODULE, CONFIG_BRIDGE_POWER_MGMT_LOG_LEVEL); 18 | 19 | static void power_down_handler(struct k_work *work); 20 | 21 | static K_WORK_DELAYABLE_DEFINE(power_down_work, power_down_handler); 22 | static int module_active_count; 23 | 24 | static void power_down_handler(struct k_work *work) 25 | { 26 | if (module_active_count == 0) { 27 | struct power_down_event *event = new_power_down_event(); 28 | 29 | event->error = 0; 30 | APP_EVENT_SUBMIT(event); 31 | 32 | /* Keep submitting events as they may be consumed to delay shutdown */ 33 | k_work_reschedule(&power_down_work, K_SECONDS(1)); 34 | } 35 | } 36 | 37 | static bool app_event_handler(const struct app_event_header *aeh) 38 | { 39 | if (is_module_state_event(aeh)) { 40 | const struct module_state_event *event = 41 | cast_module_state_event(aeh); 42 | 43 | if (check_state(event, MODULE_ID(main), MODULE_STATE_READY)) { 44 | module_active_count = 0; 45 | } else if (event->state == MODULE_STATE_READY) { 46 | module_active_count += 1; 47 | } else if (event->state == MODULE_STATE_STANDBY) { 48 | module_active_count -= 1; 49 | __ASSERT_NO_MSG(module_active_count >= 0); 50 | 51 | if (module_active_count == 0) { 52 | k_work_reschedule(&power_down_work, K_SECONDS(1)); 53 | } 54 | } 55 | return false; 56 | } 57 | 58 | if (is_power_down_event(aeh)) { 59 | nrf_power_system_off(NRF_POWER); 60 | } 61 | 62 | /* If event is unhandled, unsubscribe. */ 63 | __ASSERT_NO_MSG(false); 64 | 65 | return false; 66 | } 67 | 68 | APP_EVENT_LISTENER(MODULE, app_event_handler); 69 | APP_EVENT_SUBSCRIBE(MODULE, module_state_event); 70 | APP_EVENT_SUBSCRIBE_FINAL(MODULE, power_down_event); 71 | -------------------------------------------------------------------------------- /doc/online-mqtt-client-connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/firmware-nordic-thingy91/840d17a01a716ad852a0f40b647ce2fd96e62e22/doc/online-mqtt-client-connect.png -------------------------------------------------------------------------------- /doc/online-mqtt-client-messages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/firmware-nordic-thingy91/840d17a01a716ad852a0f40b647ce2fd96e62e22/doc/online-mqtt-client-messages.png -------------------------------------------------------------------------------- /doc/online-mqtt-client-subscribe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/firmware-nordic-thingy91/840d17a01a716ad852a0f40b647ce2fd96e62e22/doc/online-mqtt-client-subscribe.png -------------------------------------------------------------------------------- /doc/online-mqtt-client-topic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/firmware-nordic-thingy91/840d17a01a716ad852a0f40b647ce2fd96e62e22/doc/online-mqtt-client-topic.png -------------------------------------------------------------------------------- /doc/thingy91-swd-select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/firmware-nordic-thingy91/840d17a01a716ad852a0f40b647ce2fd96e62e22/doc/thingy91-swd-select.png -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | utensor/CTestTestfile.cmake 2 | utensor/cmake_install.cmake 3 | utensor/CMakeFiles/ 4 | utensor/Makefile 5 | utensor/CMakeCache.txt 6 | utensor.lib 7 | utensor/libutensor.a 8 | *.o 9 | *.d 10 | doc/ 11 | node_modules/ 12 | package-lock.json 13 | package.json -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/.mbedignore: -------------------------------------------------------------------------------- 1 | utensor/CMakeFiles/ 2 | tensorflow/lite/micro/mbed/ 3 | porting/arduino/ 4 | porting/espressif/ 5 | porting/himax/ 6 | porting/posix/ 7 | porting/silabs/ 8 | porting/stm32-cubeai/ 9 | porting/zephyr/ 10 | classifier/ei_run_classifier_c* 11 | third_party/arc_mli_package/ 12 | tensorflow-lite/ 13 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/Core/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.5 5 | * @date 02. February 2022 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2022 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 ( 6U) /*!< [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 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Include/dsp/controller_functions_f16.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file controller_functions_f16.h 3 | * @brief Public header file for CMSIS DSP Library 4 | * @version V1.10.0 5 | * @date 08 July 2021 6 | * Target Processor: Cortex-M and Cortex-A cores 7 | ******************************************************************************/ 8 | /* 9 | * Copyright (c) 2010-2020 Arm Limited or its affiliates. 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 | * 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 | 27 | #ifndef _CONTROLLER_FUNCTIONS_F16_H_ 28 | #define _CONTROLLER_FUNCTIONS_F16_H_ 29 | 30 | #ifdef __cplusplus 31 | extern "C" 32 | { 33 | #endif 34 | 35 | #if defined(ARM_FLOAT16_SUPPORTED) 36 | #endif /*defined(ARM_FLOAT16_SUPPORTED)*/ 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* ifndef _CONTROLLER_FUNCTIONS_F16_H_ */ 42 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Include/dsp/svm_defines.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file svm_defines.h 3 | * @brief Public header file for CMSIS DSP Library 4 | * @version V1.10.0 5 | * @date 08 July 2021 6 | * 7 | * Target Processor: Cortex-M and Cortex-A cores 8 | ******************************************************************************/ 9 | /* 10 | * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved. 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the License); you may 15 | * not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 22 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | */ 26 | 27 | 28 | #ifndef _SVM_DEFINES_H_ 29 | #define _SVM_DEFINES_H_ 30 | 31 | /** 32 | * @brief Struct for specifying SVM Kernel 33 | */ 34 | typedef enum 35 | { 36 | ARM_ML_KERNEL_LINEAR = 0, 37 | /**< Linear kernel */ 38 | ARM_ML_KERNEL_POLYNOMIAL = 1, 39 | /**< Polynomial kernel */ 40 | ARM_ML_KERNEL_RBF = 2, 41 | /**< Radial Basis Function kernel */ 42 | ARM_ML_KERNEL_SIGMOID = 3 43 | /**< Sigmoid kernel */ 44 | } arm_ml_kernel_type; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/PrivateInclude/README.md: -------------------------------------------------------------------------------- 1 | Note: All files have been moved from this folder into Include to simplify build management 2 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_f32.c 6 | * Description: Floating-point PID Control reset function 7 | * 8 | * $Date: 23 April 2021 9 | * $Revision: V1.9.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/dsp/controller_functions.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the floating-point PID Control. 40 | @param[in,out] S points to an instance of the floating-point PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_f32( 48 | arm_pid_instance_f32 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(float32_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q15.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_q15.c 6 | * Description: Q15 PID Control reset function 7 | * 8 | * $Date: 23 April 2021 9 | * $Revision: V1.9.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/dsp/controller_functions.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the Q15 PID Control. 40 | @param[in,out] S points to an instance of the Q15 PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_q15( 48 | arm_pid_instance_q15 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(q15_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Source/ControllerFunctions/arm_pid_reset_q31.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_pid_reset_q31.c 6 | * Description: Q31 PID Control reset function 7 | * 8 | * $Date: 23 April 2021 9 | * $Revision: V1.9.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/dsp/controller_functions.h" 32 | 33 | /** 34 | @addtogroup PID 35 | @{ 36 | */ 37 | 38 | /** 39 | @brief Reset function for the Q31 PID Control. 40 | @param[in,out] S points to an instance of the Q31 PID structure 41 | @return none 42 | 43 | @par Details 44 | The function resets the state buffer to zeros. 45 | */ 46 | 47 | void arm_pid_reset_q31( 48 | arm_pid_instance_q31 * S) 49 | { 50 | /* Reset state to zero, The size will be always 3 samples */ 51 | memset(S->state, 0, 3U * sizeof(q31_t)); 52 | } 53 | 54 | /** 55 | @} end of PID group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Source/FastMathFunctions/arm_vlog_f64.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_vlog_f64.c 6 | * Description: Fast vectorized log 7 | * 8 | * $Date: 13 September 2021 9 | * $Revision: V1.10.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/dsp/fast_math_functions.h" 32 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_common_tables.h" 33 | 34 | void arm_vlog_f64( 35 | const float64_t * pSrc, 36 | float64_t * pDst, 37 | uint32_t blockSize) 38 | { 39 | uint32_t blkCnt; 40 | 41 | blkCnt = blockSize; 42 | 43 | while (blkCnt > 0U) 44 | { 45 | /* C = log(A) */ 46 | 47 | /* Calculate log and store result in destination buffer. */ 48 | *pDst++ = log(*pSrc++); 49 | 50 | /* Decrement loop counter */ 51 | blkCnt--; 52 | } 53 | } 54 | 55 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 56 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_std_f64.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_std_f64.c 6 | * Description: Standard deviation of the elements of a floating-point vector 7 | * 8 | * $Date: 13 September 2021 9 | * $Revision: V1.10.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/dsp/statistics_functions.h" 32 | 33 | /** 34 | @ingroup groupStats 35 | */ 36 | 37 | /** 38 | @addtogroup STD 39 | @{ 40 | */ 41 | 42 | /** 43 | @brief Standard deviation of the elements of a floating-point vector. 44 | @param[in] pSrc points to the input vector 45 | @param[in] blockSize number of samples in input vector 46 | @param[out] pResult standard deviation value returned here 47 | @return none 48 | */ 49 | void arm_std_f64( 50 | const float64_t * pSrc, 51 | uint32_t blockSize, 52 | float64_t * pResult) 53 | { 54 | float64_t var; 55 | arm_var_f64(pSrc,blockSize,&var); 56 | *pResult = sqrt(var); 57 | } 58 | 59 | /** 60 | @} end of STD group 61 | */ 62 | 63 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 64 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/arm_merge_sort_init_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_merge_sort_init_f32.c 6 | * Description: Floating point merge sort initialization function 7 | * 8 | * $Date: 23 April 2021 9 | * $Revision: V1.9.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/dsp/support_functions.h" 32 | 33 | /** 34 | @ingroup groupSupport 35 | */ 36 | 37 | /** 38 | @addtogroup Sorting 39 | @{ 40 | */ 41 | 42 | 43 | /** 44 | * @param[in,out] S points to an instance of the sorting structure. 45 | * @param[in] dir Sorting order. 46 | * @param[in] buffer Working buffer. 47 | */ 48 | void arm_merge_sort_init_f32(arm_merge_sort_instance_f32 * S, arm_sort_dir dir, float32_t * buffer) 49 | { 50 | S->dir = dir; 51 | S->buffer = buffer; 52 | } 53 | /** 54 | @} end of Sorting group 55 | */ 56 | 57 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 58 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/arm_sort_init_f32.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/dsp/config.hpp" 2 | #if EIDSP_LOAD_CMSIS_DSP_SOURCES 3 | /* ---------------------------------------------------------------------- 4 | * Project: CMSIS DSP Library 5 | * Title: arm_sort_init_f32.c 6 | * Description: Floating point sort initialization function 7 | * 8 | * $Date: 23 April 2021 9 | * $Revision: V1.9.0 10 | * 11 | * Target Processor: Cortex-M and Cortex-A cores 12 | * -------------------------------------------------------------------- */ 13 | /* 14 | * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | * 18 | * Licensed under the Apache License, Version 2.0 (the License); you may 19 | * not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at 21 | * 22 | * www.apache.org/licenses/LICENSE-2.0 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 26 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | */ 30 | 31 | #include "edge-impulse-sdk/CMSIS/DSP/Include/arm_sorting.h" 32 | 33 | /** 34 | @ingroup groupSupport 35 | */ 36 | 37 | /** 38 | @addtogroup Sorting 39 | @{ 40 | */ 41 | 42 | 43 | /** 44 | * @param[in,out] S points to an instance of the sorting structure. 45 | * @param[in] alg Selected algorithm. 46 | * @param[in] dir Sorting order. 47 | */ 48 | void arm_sort_init_f32(arm_sort_instance_f32 * S, arm_sort_alg alg, arm_sort_dir dir) 49 | { 50 | S->alg = alg; 51 | S->dir = dir; 52 | } 53 | 54 | /** 55 | @} end of Sorting group 56 | */ 57 | 58 | #endif // EIDSP_LOAD_CMSIS_DSP_SOURCES 59 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/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. August 2021 7 | * $Revision: V.1.0.2 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 "edge-impulse-sdk/CMSIS/NN/Include/arm_nn_math_types.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 | #endif /* ARM_NN_TABLES_H */ 57 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/NN/Source/ActivationFunctions/arm_relu6_s8.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/classifier/ei_classifier_config.h" 2 | #if EI_CLASSIFIER_TFLITE_LOAD_CMSIS_NN_SOURCES 3 | /* 4 | * Copyright (C) 2010-2019 Arm Limited or its affiliates. All rights reserved. 5 | * 6 | * SPDX-License-Identifier: Apache-2.0 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the License); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | /* ---------------------------------------------------------------------- 22 | * Project: CMSIS NN Library 23 | * Title: arm_relu6_s8.c 24 | * Description: Basic s8 version of ReLU6 25 | * 26 | * $Date: 09. October 2020 27 | * $Revision: V.1.0.1 28 | * 29 | * Target Processor: Cortex-M cores 30 | * 31 | * -------------------------------------------------------------------- */ 32 | 33 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 34 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnsupportfunctions.h" 35 | 36 | /** 37 | * @ingroup groupNN 38 | */ 39 | 40 | /** 41 | * @addtogroup Acti 42 | * @{ 43 | */ 44 | 45 | /* 46 | * Basic ReLU6 function 47 | * 48 | * Refer to header file for details. 49 | * 50 | */ 51 | 52 | void arm_relu6_s8(q7_t *data, uint16_t size) 53 | { 54 | int32_t i; 55 | 56 | for (i = 0; i < size; i++) 57 | { 58 | int32_t ip = data[i]; 59 | 60 | ip = MAX(ip, 0); 61 | data[i] = MIN(ip, 6); 62 | } 63 | } 64 | 65 | /** 66 | * @} end of Acti group 67 | */ 68 | 69 | #endif // EI_CLASSIFIER_TFLITE_LOAD_CMSIS_NN_SOURCES 70 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/NN/Source/ReshapeFunctions/arm_reshape_s8.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/classifier/ei_classifier_config.h" 2 | #if EI_CLASSIFIER_TFLITE_LOAD_CMSIS_NN_SOURCES 3 | /* 4 | * SPDX-FileCopyrightText: Copyright 2010-2022 Arm Limited and/or its affiliates 5 | * 6 | * SPDX-License-Identifier: Apache-2.0 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the License); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | /* ---------------------------------------------------------------------- 22 | * Project: CMSIS NN Library 23 | * Title: arm_reshape_s8.c 24 | * Description: Reshape a s8 vector 25 | * 26 | * $Date: 4 Aug 2022 27 | * $Revision: V.1.0.1 28 | * 29 | * Target Processor: Cortex-M cores 30 | * 31 | * -------------------------------------------------------------------- */ 32 | 33 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 34 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnsupportfunctions.h" 35 | 36 | /** 37 | * @ingroup groupNN 38 | */ 39 | 40 | /** 41 | * @addtogroup Reshape 42 | * @{ 43 | */ 44 | 45 | /* 46 | * Basic s8 reshape function. 47 | * 48 | * Refer header file for details. 49 | * 50 | */ 51 | 52 | void arm_reshape_s8(const int8_t *input, int8_t *output, const uint32_t total_size) 53 | { 54 | arm_memcpy_q7(output, input, total_size); 55 | } 56 | 57 | /** 58 | * @} end of Reshape group 59 | */ 60 | 61 | #endif // EI_CLASSIFIER_TFLITE_LOAD_CMSIS_NN_SOURCES 62 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/NN/Source/SoftmaxFunctions/arm_softmax_s8_s16.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/classifier/ei_classifier_config.h" 2 | #if EI_CLASSIFIER_TFLITE_LOAD_CMSIS_NN_SOURCES 3 | /* 4 | * Copyright (C) 2022 Arm Limited or its affiliates. 5 | * 6 | * SPDX-License-Identifier: Apache-2.0 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the License); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | /* ---------------------------------------------------------------------- 22 | * Project: CMSIS NN Library 23 | * Title: arm_softmax_s8_s16.c 24 | * Description: S8 to s16 softmax function 25 | * 26 | * $Date: 7 January 2022 27 | * $Revision: V.1.0.0 28 | * 29 | * Target Processor: Cortex-M cores 30 | * 31 | * -------------------------------------------------------------------- */ 32 | 33 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnfunctions.h" 34 | #include "edge-impulse-sdk/CMSIS/NN/Include/arm_nnsupportfunctions.h" 35 | 36 | /** 37 | * @ingroup groupNN 38 | */ 39 | 40 | /** 41 | * @addtogroup Softmax 42 | * @{ 43 | */ 44 | 45 | void arm_softmax_s8_s16(const int8_t *input, 46 | const int32_t num_rows, 47 | const int32_t row_size, 48 | const int32_t mult, 49 | const int32_t shift, 50 | const int32_t diff_min, 51 | int16_t *output) 52 | { 53 | arm_nn_softmax_common_s8(input, num_rows, row_size, mult, shift, diff_min, true, (void *)output); 54 | } 55 | /** 56 | * @} end of Softmax group 57 | */ 58 | 59 | #endif // EI_CLASSIFIER_TFLITE_LOAD_CMSIS_NN_SOURCES 60 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/CMSIS/sources.txt: -------------------------------------------------------------------------------- 1 | Created by update_tflite.sh 2 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/LICENSE: -------------------------------------------------------------------------------- 1 | Unless specifically indicated otherwise in a file, files are licensed under the BSD 3-Clause Clear license, as can be found in: LICENSE.3-clause-bsd-clear 2 | 3 | Folders containing third party code and libraries are listed below. Each folder contains its own license specified for its files. 4 | 5 | * CMSIS - Apache 2.0 6 | * dsp/kissfft - BSD-3-Clause 7 | * porting/espressif/ESP-NN - Apache 2.0 8 | * porting/ethos-core-driver - Apache 2.0 9 | * tensorflow - Apache 2.0 10 | * third_party/arc_mli_package - BSD-3-Clause 11 | * third_party/flatbuffers - Apache 2.0 12 | * third_party/gemmlowp - Apache 2.0 13 | * third_party/incbin - Public domain 14 | * third_party/ruy - Apache 2.0 15 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/LICENSE.3-clause-bsd-clear: -------------------------------------------------------------------------------- 1 | The Clear BSD License 2 | 3 | Copyright (c) 2025 EdgeImpulse Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted (subject to the limitations in the disclaimer 8 | below) provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/README.md: -------------------------------------------------------------------------------- 1 | # Edge Impulse DSP and Inferencing SDK 2 | 3 | Portable library for digital signal processing and machine learning inferencing. This repository contains the device implementation in C++ for both processing and learning blocks in [Edge Impulse](https://www.edgeimpulse.com). 4 | 5 | [Documentation](https://docs.edgeimpulse.com/reference#inferencing-sdk) 6 | 7 | ## Develop locally 8 | 9 | If you want to develop locally the easiest is to grab the [example-standalone-inferencing](https://github.com/edgeimpulse/example-standalone-inferencing) (Desktop) or [example-standalone-inferencing-mbed](https://github.com/edgeimpulse/example-standalone-inferencing-mbed) (ST IoT Discovery Kit, f.e. to test CMSIS-DSP / CMSIS-NN integration) example applications, add your Edge Impulse project (use the C++ Library export option), then symlink this repository in. 10 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/classifier/ei_constants.h: -------------------------------------------------------------------------------- 1 | #ifndef __EI_CONSTANTS__H__ 2 | #define __EI_CONSTANTS__H__ 3 | 4 | #define EI_CLASSIFIER_RESIZE_NONE 0 5 | #define EI_CLASSIFIER_RESIZE_FIT_SHORTEST 1 6 | #define EI_CLASSIFIER_RESIZE_FIT_LONGEST 2 7 | #define EI_CLASSIFIER_RESIZE_SQUASH 3 8 | 9 | // This exists for linux runner, etc 10 | __attribute__((unused)) static const char *EI_RESIZE_STRINGS[] = { "none", "fit-shortest", "fit-longest", "squash" }; 11 | 12 | #endif //!__EI_CONSTANTS__H__ -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/classifier/ei_run_classifier_image.h: -------------------------------------------------------------------------------- 1 | /* The Clear BSD License 2 | * 3 | * Copyright (c) 2025 EdgeImpulse Inc. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted (subject to the limitations in the disclaimer 8 | * below) provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * * Neither the name of the copyright holder nor the names of its 18 | * contributors may be used to endorse or promote products derived from this 19 | * software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 36 | #define _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 37 | 38 | #include "ei_run_classifier.h" 39 | 40 | 41 | 42 | #endif // _EDGE_IMPULSE_RUN_CLASSIFIER_IMAGE_H_ 43 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/classifier/postprocessing/tinyEKF/LICENSE.md: -------------------------------------------------------------------------------- 1 | TinyEKF 2 | 3 | Copyright (c) Simon D. Levy 4 | 5 | All rights reserved. 6 | 7 | MIT License 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of 10 | this software and associated documentation files (the ""Software""), to deal in 11 | the Software without restriction, including without limitation the rights to 12 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 13 | of the Software, and to permit persons to whom the Software is furnished to do 14 | so, subject to the following conditions: The above copyright notice and this 15 | permission notice shall be included in all copies or substantial portions of 16 | the Software. THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 19 | EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 20 | OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 | DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/cmake/zephyr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13.1) 2 | 3 | if(NOT TARGET app) 4 | message(FATAL_ERROR "Please create a target named 'app' (ex: add_executable(app)) before adding this file") 5 | endif() 6 | 7 | set(CMAKE_CXX_STANDARD 11) 8 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 9 | 10 | set(EI_SDK_FOLDER ../../) 11 | 12 | include(${EI_SDK_FOLDER}/cmake/utils.cmake) 13 | 14 | target_include_directories(app PRIVATE 15 | ${EI_SDK_FOLDER} 16 | ) 17 | 18 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}" "*.cpp") 19 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}" "*.cc") 20 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}" "*.s") 21 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/DSP/Source/TransformFunctions" "*.c") 22 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/DSP/Source/CommonTables" "*.c") 23 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/DSP/Source/BasicMathFunctions" "*.c") 24 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/DSP/Source/ComplexMathFunctions" "*.c") 25 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/DSP/Source/FastMathFunctions" "*.c") 26 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/DSP/Source/SupportFunctions" "*.c") 27 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/DSP/Source/MatrixFunctions" "*.c") 28 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/DSP/Source/StatisticsFunctions" "*.c") 29 | RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES "${EI_SDK_FOLDER}/CMSIS/NN/Source" "*.c") 30 | LIST(APPEND EI_SOURCE_FILES "${EI_SDK_FOLDER}/tensorflow/lite/c/common.c") 31 | 32 | target_sources(app PRIVATE ${EI_SOURCE_FILES}) -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/README.md: -------------------------------------------------------------------------------- 1 | See notes in the various block folders in studio/dsp-pipeline 2 | 3 | studio/dsp-pipeline/mfcc/README.md -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/dct/.clang-format: -------------------------------------------------------------------------------- 1 | "DisableFormat": true 2 | "SortIncludes": false 3 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/dct/fast-dct-fft.cpp: -------------------------------------------------------------------------------- 1 | // This file intentinally left blank 2 | // Function moved to numpy.hpp -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/dct/fast-dct-fft.h: -------------------------------------------------------------------------------- 1 | #ifndef __FAST_DCT_FFT__H__ 2 | #define __FAST_DCT_FFT__H__ 3 | 4 | // This file intentinally left blank 5 | // Function moved to numpy.hpp 6 | 7 | #endif //!__FAST-DCT-FFT__H__ -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/ei_vector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 EdgeImpulse Inc. 3 | * 4 | * Generated by Edge Impulse and licensed under the applicable Edge Impulse 5 | * Terms of Service. Community and Professional Terms of Service 6 | * (https://edgeimpulse.com/legal/terms-of-service) or Enterprise Terms of 7 | * Service (https://edgeimpulse.com/legal/enterprise-terms-of-service), 8 | * according to your product plan subscription (the “License”). 9 | * 10 | * This software, documentation and other associated files (collectively referred 11 | * to as the “Software”) is a single SDK variation generated by the Edge Impulse 12 | * platform and requires an active paid Edge Impulse subscription to use this 13 | * Software for any purpose. 14 | * 15 | * You may NOT use this Software unless you have an active Edge Impulse subscription 16 | * that meets the eligibility requirements for the applicable License, subject to 17 | * your full and continued compliance with the terms and conditions of the License, 18 | * including without limitation any usage restrictions under the applicable License. 19 | * 20 | * If you do not have an active Edge Impulse product plan subscription, or if use 21 | * of this Software exceeds the usage limitations of your Edge Impulse product plan 22 | * subscription, you are not permitted to use this Software and must immediately 23 | * delete and erase all copies of this Software within your control or possession. 24 | * Edge Impulse reserves all rights and remedies available to enforce its rights. 25 | * 26 | * Unless required by applicable law or agreed to in writing, the Software is 27 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 28 | * either express or implied. See the License for the specific language governing 29 | * permissions, disclaimers and limitations under the License. 30 | */ 31 | #ifndef __EI_VECTOR__H__ 32 | #define __EI_VECTOR__H__ 33 | 34 | #include "ei_alloc.h" 35 | #include 36 | 37 | template 38 | using ei_vector = std::vector>; 39 | 40 | #endif //!__EI_VECTOR__H__ -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/image/image.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 EdgeImpulse Inc. 3 | * 4 | * Generated by Edge Impulse and licensed under the applicable Edge Impulse 5 | * Terms of Service. Community and Professional Terms of Service 6 | * (https://edgeimpulse.com/legal/terms-of-service) or Enterprise Terms of 7 | * Service (https://edgeimpulse.com/legal/enterprise-terms-of-service), 8 | * according to your product plan subscription (the “License”). 9 | * 10 | * This software, documentation and other associated files (collectively referred 11 | * to as the “Software”) is a single SDK variation generated by the Edge Impulse 12 | * platform and requires an active paid Edge Impulse subscription to use this 13 | * Software for any purpose. 14 | * 15 | * You may NOT use this Software unless you have an active Edge Impulse subscription 16 | * that meets the eligibility requirements for the applicable License, subject to 17 | * your full and continued compliance with the terms and conditions of the License, 18 | * including without limitation any usage restrictions under the applicable License. 19 | * 20 | * If you do not have an active Edge Impulse product plan subscription, or if use 21 | * of this Software exceeds the usage limitations of your Edge Impulse product plan 22 | * subscription, you are not permitted to use this Software and must immediately 23 | * delete and erase all copies of this Software within your control or possession. 24 | * Edge Impulse reserves all rights and remedies available to enforce its rights. 25 | * 26 | * Unless required by applicable law or agreed to in writing, the Software is 27 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 28 | * either express or implied. See the License for the specific language governing 29 | * permissions, disclaimers and limitations under the License. 30 | */ 31 | #ifndef _EIDSP_IMAGE_H_ 32 | #define _EIDSP_IMAGE_H_ 33 | 34 | #include "edge-impulse-sdk/dsp/image/processing.hpp" 35 | 36 | #endif -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/kissfft/.clang-format: -------------------------------------------------------------------------------- 1 | "DisableFormat": true 2 | "SortIncludes": false 3 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/kissfft/LICENSE: -------------------------------------------------------------------------------- 1 | Revised BSD License, see COPYING for verbiage. 2 | Basically, "free to use&change, give credit where due, no guarantees" 3 | Note this license is compatible with GPL at one end of the spectrum and closed, commercial software at 4 | the other end. See http://www.fsf.org/licensing/licenses 5 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/kissfft/README.md: -------------------------------------------------------------------------------- 1 | # KissFFT 2 | 3 | Software FFT library used for devices that do not have hardware accelerated RFFT, or where we want to use mixed-radix FFT. Based off of https://github.com/mborgerding/kissfft. 4 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/kissfft/kiss_fftr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2010, Mark Borgerding. All rights reserved. 3 | * This file is part of KISS FFT - https://github.com/mborgerding/kissfft 4 | * 5 | * SPDX-License-Identifier: BSD-3-Clause 6 | * See COPYING file for more information. 7 | */ 8 | 9 | #ifndef KISS_FTR_H 10 | #define KISS_FTR_H 11 | 12 | #include "kiss_fft.h" 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | 18 | /* 19 | 20 | Real optimized version can save about 45% cpu time vs. complex fft of a real seq. 21 | 22 | 23 | 24 | */ 25 | 26 | typedef struct kiss_fftr_state *kiss_fftr_cfg; 27 | 28 | 29 | kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem, size_t * memallocated = NULL); 30 | /* 31 | nfft must be even 32 | 33 | If you don't care to allocate space, use mem = lenmem = NULL 34 | */ 35 | 36 | 37 | void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata); 38 | /* 39 | input timedata has nfft scalar points 40 | output freqdata has nfft/2+1 complex points 41 | */ 42 | 43 | void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata); 44 | /* 45 | input freqdata has nfft/2+1 complex points 46 | output timedata has nfft scalar points 47 | */ 48 | 49 | #define kiss_fftr_free KISS_FFT_FREE 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | #endif 55 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/memory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 EdgeImpulse Inc. 3 | * 4 | * Generated by Edge Impulse and licensed under the applicable Edge Impulse 5 | * Terms of Service. Community and Professional Terms of Service 6 | * (https://edgeimpulse.com/legal/terms-of-service) or Enterprise Terms of 7 | * Service (https://edgeimpulse.com/legal/enterprise-terms-of-service), 8 | * according to your product plan subscription (the “License”). 9 | * 10 | * This software, documentation and other associated files (collectively referred 11 | * to as the “Software”) is a single SDK variation generated by the Edge Impulse 12 | * platform and requires an active paid Edge Impulse subscription to use this 13 | * Software for any purpose. 14 | * 15 | * You may NOT use this Software unless you have an active Edge Impulse subscription 16 | * that meets the eligibility requirements for the applicable License, subject to 17 | * your full and continued compliance with the terms and conditions of the License, 18 | * including without limitation any usage restrictions under the applicable License. 19 | * 20 | * If you do not have an active Edge Impulse product plan subscription, or if use 21 | * of this Software exceeds the usage limitations of your Edge Impulse product plan 22 | * subscription, you are not permitted to use this Software and must immediately 23 | * delete and erase all copies of this Software within your control or possession. 24 | * Edge Impulse reserves all rights and remedies available to enforce its rights. 25 | * 26 | * Unless required by applicable law or agreed to in writing, the Software is 27 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 28 | * either express or implied. See the License for the specific language governing 29 | * permissions, disclaimers and limitations under the License. 30 | */ 31 | #include "memory.hpp" 32 | 33 | size_t ei_memory_in_use = 0; 34 | size_t ei_memory_peak_use = 0; 35 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/spectral/spectral.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 EdgeImpulse Inc. 3 | * 4 | * Generated by Edge Impulse and licensed under the applicable Edge Impulse 5 | * Terms of Service. Community and Professional Terms of Service 6 | * (https://edgeimpulse.com/legal/terms-of-service) or Enterprise Terms of 7 | * Service (https://edgeimpulse.com/legal/enterprise-terms-of-service), 8 | * according to your product plan subscription (the “License”). 9 | * 10 | * This software, documentation and other associated files (collectively referred 11 | * to as the “Software”) is a single SDK variation generated by the Edge Impulse 12 | * platform and requires an active paid Edge Impulse subscription to use this 13 | * Software for any purpose. 14 | * 15 | * You may NOT use this Software unless you have an active Edge Impulse subscription 16 | * that meets the eligibility requirements for the applicable License, subject to 17 | * your full and continued compliance with the terms and conditions of the License, 18 | * including without limitation any usage restrictions under the applicable License. 19 | * 20 | * If you do not have an active Edge Impulse product plan subscription, or if use 21 | * of this Software exceeds the usage limitations of your Edge Impulse product plan 22 | * subscription, you are not permitted to use this Software and must immediately 23 | * delete and erase all copies of this Software within your control or possession. 24 | * Edge Impulse reserves all rights and remedies available to enforce its rights. 25 | * 26 | * Unless required by applicable law or agreed to in writing, the Software is 27 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 28 | * either express or implied. See the License for the specific language governing 29 | * permissions, disclaimers and limitations under the License. 30 | */ 31 | #ifndef _EIDSP_SPECTRAL_SPECTRAL_H_ 32 | #define _EIDSP_SPECTRAL_SPECTRAL_H_ 33 | 34 | #include "../config.hpp" 35 | #include "processing.hpp" 36 | #include "feature.hpp" 37 | 38 | #endif // _EIDSP_SPECTRAL_SPECTRAL_H_ 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/dsp/speechpy/speechpy.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 EdgeImpulse Inc. 3 | * 4 | * Generated by Edge Impulse and licensed under the applicable Edge Impulse 5 | * Terms of Service. Community and Professional Terms of Service 6 | * (https://edgeimpulse.com/legal/terms-of-service) or Enterprise Terms of 7 | * Service (https://edgeimpulse.com/legal/enterprise-terms-of-service), 8 | * according to your product plan subscription (the “License”). 9 | * 10 | * This software, documentation and other associated files (collectively referred 11 | * to as the “Software”) is a single SDK variation generated by the Edge Impulse 12 | * platform and requires an active paid Edge Impulse subscription to use this 13 | * Software for any purpose. 14 | * 15 | * You may NOT use this Software unless you have an active Edge Impulse subscription 16 | * that meets the eligibility requirements for the applicable License, subject to 17 | * your full and continued compliance with the terms and conditions of the License, 18 | * including without limitation any usage restrictions under the applicable License. 19 | * 20 | * If you do not have an active Edge Impulse product plan subscription, or if use 21 | * of this Software exceeds the usage limitations of your Edge Impulse product plan 22 | * subscription, you are not permitted to use this Software and must immediately 23 | * delete and erase all copies of this Software within your control or possession. 24 | * Edge Impulse reserves all rights and remedies available to enforce its rights. 25 | * 26 | * Unless required by applicable law or agreed to in writing, the Software is 27 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 28 | * either express or implied. See the License for the specific language governing 29 | * permissions, disclaimers and limitations under the License. 30 | */ 31 | #ifndef _EIDSP_SPEECHPY_SPEECHPY_H_ 32 | #define _EIDSP_SPEECHPY_SPEECHPY_H_ 33 | 34 | #include "../config.hpp" 35 | #include "feature.hpp" 36 | #include "functions.hpp" 37 | #include "processing.hpp" 38 | 39 | #endif // _EIDSP_SPEECHPY_SPEECHPY_H_ 40 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/.clang-format: -------------------------------------------------------------------------------- 1 | "DisableFormat": true 2 | "SortIncludes": false 3 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions to ESP-NN project in the form of pull requests, bug reports, and feature requests are welcome! 4 | 5 | This document covers various topics related to contributions to the ESP-NN projects. Please read it if you plan to submit a PR! 6 | 7 | ## CLA 8 | 9 | We require accepting the contributor's license agreement for all pull requests. When opening a pull request the first time you will be prompted to sign the CLA by the [CLA Assistant](https://cla-assistant.io/) service. 10 | 11 | ## Large-scale Changes 12 | 13 | If you'd like to propose a change to the existing APIs or a large-scale refactoring of the implementation, we recommend opening an issue first to discuss this. 14 | 15 | ## Updating the Benchmarks Table 16 | 17 | The benchmarks table in [README.md](README.md) contains benchmarks for ESP32-S3. The benchmarks are collected by running the app in [test_app](test_app/) directory. Please update this table if you have changed the implementations of some of the functions or added the new ones. 18 | 19 | ## Releasing a new version 20 | 21 | Maintainers should follow the steps below to release a new version of ESP-NN component. Assuming the new version is `vX.Y.Z`: 22 | 23 | 1. Ensure you are on the latest `master` branch: 24 | ```bash 25 | git checkout master 26 | git pull --ff-only origin master 27 | ``` 28 | 1. Create the new tag: 29 | ```bash 30 | git tag -s -a -m "vX.Y.Z" vX.Y.Z 31 | ``` 32 | 1. Push the tag and the branch to the internal repository: 33 | ```bash 34 | git push origin vX.Y.Z 35 | ``` 36 | 1. CI will automatically push the tag to Github and will upload the new version to the IDF Component Registry. 37 | 1. Go to https://github.com/espressif/esp-nn/releases and create a release from the tag vX.Y.Z. 38 | 1. Write the release notes and publish the release. 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "ESP-NN" 2 | 3 | choice NN_OPTIMIZATIONS 4 | bool "Optimization for nn functions" 5 | default NN_OPTIMIZED 6 | help 7 | Use ANSI-C versions for verification and debug purpose. 8 | Optimisations are automatically picked up for a chipset. 9 | For ESP32-S3, assembly optimisations are selected. 10 | For other platforms(viz., ESP32, ESP32-C3), generic optimisations are used. 11 | 12 | config NN_ANSI_C 13 | bool "ANSI C" 14 | help 15 | ANSI C versions for verification and debug purposes. 16 | config NN_OPTIMIZED 17 | bool "Optimized versions" 18 | help 19 | Optimisations are automatically picked up for a chipset. 20 | For ESP32-S3, assembly optimisations are selected. 21 | For other platforms(viz., ESP32, ESP32-C3), generic optimisations are used. 22 | endchoice 23 | 24 | config NN_OPTIMIZATIONS 25 | int 26 | default 0 if NN_ANSI_C 27 | default 1 if NN_OPTIMIZED 28 | 29 | endmenu 30 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/README.md: -------------------------------------------------------------------------------- 1 | Internal Edge Impulse fork of ESP-NN. Derived from https://github.com/edgeimpulse/esp-nn/commit/6b3ef8e226a05554a6d874f6456f5ca1771c01c2. 2 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/idf_component.yml: -------------------------------------------------------------------------------- 1 | description: Optimized NN (Neural Network) functions for Espressif chips 2 | url: https://github.com/espressif/esp-nn 3 | repository: https://github.com/espressif/esp-nn.git 4 | issues: https://github.com/espressif/esp-nn/issues 5 | dependencies: 6 | idf: 7 | version: ">=4.2" 8 | files: 9 | exclude: 10 | - test_app 11 | - tests 12 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/include/esp_nn.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #pragma once 16 | 17 | #if defined(EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN) 18 | // select apt optimisations 19 | #ifdef CONFIG_IDF_TARGET_ESP32P4 20 | #define ARCH_ESP32_P4 1 21 | #endif 22 | #ifdef CONFIG_IDF_TARGET_ESP32S3 23 | #define ARCH_ESP32_S3 1 24 | #endif 25 | #ifdef CONFIG_IDF_TARGET_ESP32 26 | #define ARCH_ESP32 1 27 | #endif 28 | #endif 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | /* reference kernels included by default */ 35 | #include "esp_nn_ansi_headers.h" 36 | 37 | #if defined(EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN) 38 | #if defined(ARCH_ESP32_P4) 39 | #include "esp_nn_esp32p4.h" 40 | #elif defined(ARCH_ESP32_S3) 41 | #include "esp_nn_esp32s3.h" 42 | #else // for other platforms use generic optimisations 43 | #include "esp_nn_generic_opt.h" 44 | #endif // #if defined(ARCH_ESP32_S3) 45 | #else 46 | #include "esp_nn_ansi_c.h" 47 | #endif 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/include/esp_nn_ansi_c.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @file Header definitions to include for ANSI C versions. 17 | * These are just typedefs to pick up ANSI versions. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "esp_nn_defs.h" 23 | #include "esp_nn_ansi_headers.h" 24 | 25 | #define esp_nn_add_elementwise_s8 esp_nn_add_elementwise_s8_ansi 26 | #define esp_nn_mul_elementwise_s8 esp_nn_mul_elementwise_s8_ansi 27 | 28 | #define esp_nn_depthwise_conv_s8 esp_nn_depthwise_conv_s8_ansi 29 | 30 | #define esp_nn_conv_s8 esp_nn_conv_s8_ansi 31 | 32 | #define esp_nn_get_conv_scratch_size esp_nn_get_conv_scratch_size_ansi 33 | #define esp_nn_set_conv_scratch_buf esp_nn_set_conv_scratch_buf_ansi 34 | 35 | #define esp_nn_get_depthwise_conv_scratch_size esp_nn_get_depthwise_conv_scratch_size_ansi 36 | #define esp_nn_set_depthwise_conv_scratch_buf esp_nn_set_depthwise_conv_scratch_buf_ansi 37 | 38 | #define esp_nn_relu6_s8 esp_nn_relu6_s8_ansi 39 | 40 | #define esp_nn_avg_pool_s8 esp_nn_avg_pool_s8_ansi 41 | #define esp_nn_max_pool_s8 esp_nn_max_pool_s8_ansi 42 | 43 | #define esp_nn_fully_connected_s8 esp_nn_fully_connected_s8_ansi 44 | 45 | #define esp_nn_get_softmax_scratch_size esp_nn_get_softmax_scratch_size_ansi 46 | #define esp_nn_set_softmax_scratch_buf esp_nn_set_softmax_scratch_buf_ansi 47 | #define esp_nn_softmax_s8 esp_nn_softmax_s8_ansi 48 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/include/esp_nn_generic_opt.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /** 16 | * @file Header definitions to include for esp_nn generic optimisations 17 | * For functions which not having optimisations, _ansi versions are picked. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include "esp_nn_defs.h" 23 | #include "esp_nn_ansi_headers.h" 24 | 25 | #define esp_nn_add_elementwise_s8 esp_nn_add_elementwise_s8_ansi 26 | #define esp_nn_mul_elementwise_s8 esp_nn_mul_elementwise_s8_ansi 27 | 28 | #define esp_nn_depthwise_conv_s8 esp_nn_depthwise_conv_s8_opt 29 | 30 | #define esp_nn_conv_s8 esp_nn_conv_s8_opt 31 | 32 | #define esp_nn_get_conv_scratch_size esp_nn_get_conv_scratch_size_opt 33 | #define esp_nn_set_conv_scratch_buf esp_nn_set_conv_scratch_buf_opt 34 | 35 | #define esp_nn_get_depthwise_conv_scratch_size esp_nn_get_depthwise_conv_scratch_size_opt 36 | #define esp_nn_set_depthwise_conv_scratch_buf esp_nn_set_depthwise_conv_scratch_buf_opt 37 | 38 | #define esp_nn_relu6_s8 esp_nn_relu6_s8_ansi 39 | 40 | #define esp_nn_avg_pool_s8 esp_nn_avg_pool_s8_ansi 41 | #define esp_nn_max_pool_s8 esp_nn_max_pool_s8_ansi 42 | 43 | #define esp_nn_fully_connected_s8 esp_nn_fully_connected_s8_ansi 44 | 45 | #define esp_nn_get_softmax_scratch_size esp_nn_get_softmax_scratch_size_opt 46 | #define esp_nn_set_softmax_scratch_buf esp_nn_set_softmax_scratch_buf_opt 47 | #define esp_nn_softmax_s8 esp_nn_softmax_s8_opt 48 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/src/activation_functions/esp_nn_relu_ansi.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/classifier/ei_classifier_config.h" 2 | #if EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 3 | // Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | void esp_nn_relu6_s8_ansi(int8_t *data, uint16_t size) 23 | { 24 | int32_t i; 25 | 26 | for (i = 0; i < size; i++) { 27 | int32_t ip = data[i]; 28 | 29 | ip = max(ip, 0); 30 | data[i] = min(ip, 6); 31 | } 32 | } 33 | 34 | #endif // EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 35 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/espressif/ESP-NN/src/basic_math/esp_nn_mul_ansi.c: -------------------------------------------------------------------------------- 1 | #include "edge-impulse-sdk/classifier/ei_classifier_config.h" 2 | #if EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 3 | // Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | #include 18 | 19 | #include 20 | 21 | void esp_nn_mul_elementwise_s8_ansi(const int8_t *input1_data, 22 | const int8_t *input2_data, 23 | const int32_t input1_offset, 24 | const int32_t input2_offset, 25 | int8_t *output, 26 | const int32_t out_offset, 27 | const int32_t out_mult, 28 | const int32_t out_shift, 29 | const int32_t activation_min, 30 | const int32_t activation_max, 31 | const int32_t size) 32 | { 33 | for (int i = 0; i < size; i++) { 34 | int32_t tmp1 = input1_data[i] + input1_offset; 35 | int32_t tmp2 = input2_data[i] + input2_offset; 36 | 37 | int32_t out = tmp1 * tmp2; 38 | out = esp_nn_multiply_by_quantized_mult(out, out_mult, out_shift); 39 | out = out + out_offset; 40 | 41 | out = max(activation_min, min(out, activation_max)); 42 | output[i] = (int8_t) out; 43 | } 44 | } 45 | 46 | #endif // EI_CLASSIFIER_TFLITE_ENABLE_ESP_NN 47 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/ethos-core-driver/src/ethosu_interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020-2021 Arm Limited. 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 | // clang-format off 19 | #ifndef ETHOSU_INTERFACE_WRAPPER_ 20 | #define ETHOSU_INTERFACE_WRAPPER_ 21 | 22 | #define xstr(a) str(a) 23 | #define str(a) #a 24 | 25 | #define catm(a, b) catm_(a, b) 26 | #define catm_(a, b) a##b 27 | 28 | #define ETHOSU_INTERFACE_FILE xstr(catm(ethos, ETHOSU_ARCH)_interface.h) 29 | 30 | #include ETHOSU_INTERFACE_FILE 31 | 32 | #endif // ETHOSU_INTERFACE_WRAPPER_ 33 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/ethos-core-driver/version.txt: -------------------------------------------------------------------------------- 1 | v1.24.11 -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/porting/himax-we2/ethosu_driver.c: -------------------------------------------------------------------------------- 1 | #include "../ei_classifier_porting.h" 2 | #if EI_PORTING_HIMAX_WE2 == 1 3 | #include "WE2_core.h" 4 | 5 | // Impelements weak functions from edge-impulse-sdk/porting/ethos-core-driver/src/ethosu_driver.c 6 | void ethosu_flush_dcache(uint32_t *p, size_t bytes) 7 | { 8 | hx_CleanDCache_by_Addr((volatile void *)p, bytes); 9 | } 10 | 11 | void ethosu_invalidate_dcache(uint32_t *p, size_t bytes) 12 | { 13 | hx_InvalidateDCache_by_Addr((volatile void *)p, bytes); 14 | } 15 | 16 | #endif // #if EI_PORTING_HIMAX_WE2 == 1 -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/sources.txt: -------------------------------------------------------------------------------- 1 | tensorflow and third_party folders based on: https://github.com/tensorflow/tensorflow/#c903b4607821a03c36c17b0befa2535c7dd0e066 2 | TensorFlow source was prepared using `make -f tensorflow/lite/micro/tools/make/Makefile generate_projects` 3 | The folders were taken from `tensorflow/lite/micro/tools/make/gen/osx_x86_64/prj/hello_world/make` 4 | These files and directories were then deleted: 5 | - `tensorflow/lite/micro/debug_log.cc` 6 | - `tensorflow/lite/micro/examples/hello_world` 7 | CMSIS-DSP based on: https://github.com/ARM-software/CMSIS_5/tree/4d378e81968c6bec5441a42885b24db7cf189bca 8 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/builtin_op_data.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | // Compatibility shim for new location of interface definitions. 16 | 17 | #ifndef TENSORFLOW_LITE_BUILTIN_OP_DATA_H_ 18 | #define TENSORFLOW_LITE_BUILTIN_OP_DATA_H_ 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/core/c/builtin_op_data.h" 21 | 22 | #endif // TENSORFLOW_LITE_BUILTIN_OP_DATA_H_ 23 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_C_BUILTIN_OP_DATA_H_ 16 | #define TENSORFLOW_LITE_C_BUILTIN_OP_DATA_H_ 17 | 18 | /// For documentation, see 19 | /// third_party/tensorflow/lite/core/c/builtin_op_data.h. 20 | #include "edge-impulse-sdk/tensorflow/lite/core/c/builtin_op_data.h" // IWYU pragma: export 21 | 22 | #endif // TENSORFLOW_LITE_C_BUILTIN_OP_DATA_H_ 23 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/c/c_api_types.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | // This file declares types used by the pure C inference API defined in c_api.h, 17 | // some of which are also used in the C++ and C kernel and interpreter APIs. 18 | 19 | #ifndef TENSORFLOW_LITE_C_C_API_TYPES_H_ 20 | #define TENSORFLOW_LITE_C_C_API_TYPES_H_ 21 | 22 | /// For documentation, see 23 | /// third_party/tensorflow/lite/core/c/c_api_types.h. 24 | #include "edge-impulse-sdk/tensorflow/lite/core/c/c_api_types.h" // IWYU pragma: export 25 | 26 | #endif // TENSORFLOW_LITE_C_C_API_TYPES_H_ 27 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/c/common.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | // Dummy file for backwards compatibility. 16 | // See core/api/common.cc 17 | 18 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/c/common.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | // This file defines common C types and APIs for implementing operations, 17 | // delegates and other constructs in TensorFlow Lite. The actual operations and 18 | // delegates can be defined using C++, but the interface between the interpreter 19 | // and the operations are C. 20 | // 21 | // Summary of abstractions 22 | // TF_LITE_ENSURE - Self-sufficient error checking 23 | // TfLiteStatus - Status reporting 24 | // TfLiteIntArray - stores tensor shapes (dims), 25 | // TfLiteContext - allows an op to access the tensors 26 | // TfLiteTensor - tensor (a multidimensional array) 27 | // TfLiteNode - a single node or operation 28 | // TfLiteRegistration - the implementation of a conceptual operation. 29 | // TfLiteDelegate - allows delegation of nodes to alternative backends. 30 | // 31 | // Some abstractions in this file are created and managed by Interpreter. 32 | // 33 | // NOTE: The order of values in these structs are "semi-ABI stable". New values 34 | // should be added only to the end of structs and never reordered. 35 | 36 | #ifndef TENSORFLOW_LITE_C_COMMON_H_ 37 | #define TENSORFLOW_LITE_C_COMMON_H_ 38 | 39 | /// For documentation, see 40 | /// third_party/tensorflow/lite/core/c/common.h. 41 | #include "edge-impulse-sdk/tensorflow/lite/core/c/common.h" // IWYU pragma: export 42 | 43 | #endif // TENSORFLOW_LITE_C_COMMON_H_ 44 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/context_util.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | /// \file 16 | /// 17 | /// This provides a few C++ helpers that are useful for manipulating C 18 | /// structures in C++. 19 | #ifndef TENSORFLOW_LITE_CONTEXT_UTIL_H_ 20 | #define TENSORFLOW_LITE_CONTEXT_UTIL_H_ 21 | 22 | #include 23 | 24 | #include "edge-impulse-sdk/tensorflow/lite/core/c/common.h" 25 | 26 | namespace tflite { 27 | 28 | /// Provides a range iterable wrapper for TfLiteIntArray* (C lists) that TfLite 29 | /// C api uses. 30 | // Can't use the google array_view, since we can't depend on even 31 | // absl for embedded device reasons. 32 | class TfLiteIntArrayView { 33 | public: 34 | /// Construct a view of a TfLiteIntArray*. Note, `int_array` should be 35 | /// non-null and this view does not take ownership of it. 36 | explicit TfLiteIntArrayView(const TfLiteIntArray* int_array) 37 | : int_array_(int_array) {} 38 | 39 | TfLiteIntArrayView(const TfLiteIntArrayView&) = default; 40 | TfLiteIntArrayView& operator=(const TfLiteIntArrayView& rhs) = default; 41 | 42 | typedef const int* const_iterator; 43 | const_iterator begin() const { return int_array_->data; } 44 | const_iterator end() const { return &int_array_->data[int_array_->size]; } 45 | size_t size() const { return end() - begin(); } 46 | int operator[](size_t pos) const { return int_array_->data[pos]; } 47 | 48 | private: 49 | const TfLiteIntArray* int_array_; 50 | }; 51 | 52 | } // namespace tflite 53 | 54 | #endif // TENSORFLOW_LITE_CONTEXT_UTIL_H_ 55 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 16 | #include 17 | 18 | namespace tflite { 19 | 20 | int ErrorReporter::Report(const char* format, ...) { 21 | va_list args; 22 | va_start(args, format); 23 | int code = Report(format, args); 24 | va_end(args); 25 | return code; 26 | } 27 | 28 | // TODO(aselle): Make the name of ReportError on context the same, so 29 | // we can use the ensure functions w/o a context and w/ a reporter. 30 | int ErrorReporter::ReportError(void*, const char* format, ...) { 31 | va_list args; 32 | va_start(args, format); 33 | int code = Report(format, args); 34 | va_end(args); 35 | return code; 36 | } 37 | 38 | } // namespace tflite 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.h" 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/core/c/common.h" 21 | 22 | namespace tflite { 23 | 24 | TfLiteStatus ResetVariableTensor(TfLiteTensor* tensor) { 25 | if (!tensor->is_variable) { 26 | return kTfLiteOk; 27 | } 28 | // TODO(b/115961645): Implement - If a variable tensor has a buffer, reset it 29 | // to the value of the buffer. 30 | int value = 0; 31 | if (tensor->type == kTfLiteInt8) { 32 | value = tensor->params.zero_point; 33 | } 34 | // TODO(b/139446230): Provide a platform header to better handle these 35 | // specific scenarios. 36 | #if __ANDROID__ || defined(__x86_64__) || defined(__i386__) || \ 37 | defined(__i386) || defined(__x86__) || defined(__X86__) || \ 38 | defined(_X86_) || defined(_M_IX86) || defined(_M_X64) 39 | memset(tensor->data.raw, value, tensor->bytes); 40 | #else 41 | char* raw_ptr = tensor->data.raw; 42 | for (size_t i = 0; i < tensor->bytes; ++i) { 43 | *raw_ptr = value; 44 | raw_ptr++; 45 | } 46 | #endif 47 | return kTfLiteOk; 48 | } 49 | 50 | } // namespace tflite 51 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/core/api/tensor_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 17 | #define TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/core/c/common.h" 20 | 21 | namespace tflite { 22 | 23 | // Resets a variable tensor to the default value. 24 | TfLiteStatus ResetVariableTensor(TfLiteTensor* tensor); 25 | 26 | } // namespace tflite 27 | 28 | #endif // TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_ 29 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | #if defined(TF_LITE_USE_GLOBAL_CMATH_FUNCTIONS) || \ 23 | (defined(__ANDROID__) && !defined(__NDK_MAJOR__)) || defined(__ZEPHYR__) 24 | #define TF_LITE_GLOBAL_STD_PREFIX 25 | #else 26 | #define TF_LITE_GLOBAL_STD_PREFIX std 27 | #endif 28 | 29 | #define DECLARE_STD_GLOBAL_SWITCH1(tf_name, std_name) \ 30 | template \ 31 | inline T tf_name(const T x) { \ 32 | return TF_LITE_GLOBAL_STD_PREFIX::std_name(x); \ 33 | } 34 | 35 | DECLARE_STD_GLOBAL_SWITCH1(TfLiteRound, round); 36 | DECLARE_STD_GLOBAL_SWITCH1(TfLiteExpm1, expm1); 37 | 38 | } // namespace tflite 39 | 40 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_ 41 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/max.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | // Patched by Edge Impulse, remove std::fmax 23 | template 24 | inline T TfLiteMax(const T& x, const T& y) { 25 | return std::max(x, y); 26 | } 27 | 28 | } // namespace tflite 29 | 30 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_ 31 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/min.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | // Patched by Edge Impulse, remove std::fmin 23 | template 24 | inline T TfLiteMin(const T& x, const T& y) { 25 | return std::min(x, y); 26 | } 27 | 28 | } // namespace tflite 29 | 30 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_ 31 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/optimized/neon_check.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 17 | 18 | // TFLM does not need to utilize any Neon optimizations. 19 | 20 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_ 21 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reduce_common.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REDUCE_COMMON_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REDUCE_COMMON_H_ 17 | 18 | namespace tflite { 19 | namespace ops { 20 | namespace builtin { 21 | namespace reduce { 22 | 23 | enum ReduceType { 24 | kSum, 25 | kProd, 26 | kMax, 27 | kMin, 28 | kAny, 29 | kAll, 30 | }; 31 | 32 | } // namespace reduce 33 | } // namespace builtin 34 | } // namespace ops 35 | } // namespace tflite 36 | 37 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REDUCE_COMMON_H_ 38 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/ceil.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline void Ceil(const RuntimeShape& input_shape, const float* input_data, 27 | const RuntimeShape& output_shape, float* output_data) { 28 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 29 | 30 | for (int i = 0; i < flat_size; ++i) { 31 | output_data[i] = std::ceil(input_data[i]); 32 | } 33 | } 34 | 35 | } // namespace reference_ops 36 | } // namespace tflite 37 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ 38 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/elu.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ELU_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ELU_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/cppmath.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 20 | 21 | namespace tflite { 22 | 23 | namespace reference_ops { 24 | 25 | inline void Elu(const RuntimeShape& input_shape, const float* input_data, 26 | const RuntimeShape& output_shape, float* output_data) { 27 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 28 | for (int i = 0; i < flat_size; ++i) { 29 | const float val = input_data[i]; 30 | output_data[i] = val < 0.0f ? TfLiteExpm1(val) : val; 31 | } 32 | } 33 | 34 | } // namespace reference_ops 35 | } // namespace tflite 36 | 37 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ELU_H_ 38 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/exp.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_EXP_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_EXP_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/third_party/ruy/ruy/profiler/instrumentation.h" // from @ruy 21 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 22 | 23 | namespace tflite { 24 | namespace reference_ops { 25 | 26 | template 27 | inline void Exp(const T* input_data, const size_t num_elements, 28 | T* output_data) { 29 | ruy::profiler::ScopeLabel label("Exp"); 30 | for (size_t idx = 0; idx < num_elements; ++idx) { 31 | output_data[idx] = std::exp(input_data[idx]); 32 | } 33 | } 34 | 35 | } // namespace reference_ops 36 | } // namespace tflite 37 | 38 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_EXP_H_ 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/fill.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FILL_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FILL_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | namespace reference_ops { 24 | 25 | template 26 | void Fill(const RuntimeShape& value_shape, const T* value_data, 27 | const RuntimeShape& output_shape, T* output_data) { 28 | TFLITE_DCHECK_EQ(value_shape.DimensionsCount(), 0); 29 | const int flat_size = output_shape.FlatSize(); 30 | for (int i = 0; i < flat_size; ++i) { 31 | output_data[i] = *value_data; 32 | } 33 | } 34 | 35 | } // namespace reference_ops 36 | } // namespace tflite 37 | 38 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FILL_H_ 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/floor.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline void Floor(const RuntimeShape& input_shape, const float* input_data, 27 | const RuntimeShape& output_shape, float* output_data) { 28 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 29 | 30 | for (int i = 0; i < flat_size; i++) { 31 | int offset = i; 32 | output_data[offset] = std::floor(input_data[offset]); 33 | } 34 | } 35 | 36 | } // namespace reference_ops 37 | } // namespace tflite 38 | 39 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ 40 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/floor_div.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_DIV_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_DIV_H_ 17 | 18 | #include 19 | #include 20 | 21 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 22 | 23 | namespace tflite { 24 | namespace reference_ops { 25 | 26 | template 27 | T FloorDiv(T input1, T input2) { 28 | return std::floor(std::divides()(static_cast(input1), 29 | static_cast(input2))); 30 | } 31 | 32 | } // namespace reference_ops 33 | } // namespace tflite 34 | 35 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_DIV_H_ 36 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/floor_mod.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_MOD_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_MOD_H_ 17 | 18 | #include 19 | #include 20 | 21 | namespace tflite { 22 | 23 | namespace reference_ops { 24 | 25 | template 26 | T FloorMod(T input1, T input2) { 27 | struct FloatMod { 28 | float operator()(const float lhs, const float rhs) const { 29 | return std::fmod(lhs, rhs); 30 | } 31 | }; 32 | using ModFunc = typename std::conditional::value, 33 | std::modulus, FloatMod>::type; 34 | ModFunc mod_func; 35 | T trunc_mod = mod_func(input1, input2); 36 | return (trunc_mod != 0) && ((input2 < 0) != (trunc_mod < 0)) 37 | ? (trunc_mod + input2) 38 | : trunc_mod; 39 | } 40 | 41 | } // namespace reference_ops 42 | } // namespace tflite 43 | 44 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_MOD_H_ 45 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/neg.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 19 | 20 | namespace tflite { 21 | 22 | namespace reference_ops { 23 | 24 | template 25 | inline void Negate(const RuntimeShape& input_shape, const T* input_data, 26 | const RuntimeShape& output_shape, T* output_data) { 27 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 28 | 29 | for (int i = 0; i < flat_size; ++i) { 30 | output_data[i] = -input_data[i]; 31 | } 32 | } 33 | 34 | } // namespace reference_ops 35 | } // namespace tflite 36 | 37 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ 38 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/round.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | namespace reference_ops { 25 | 26 | inline float RoundToNearest(float value) { 27 | auto floor_val = std::floor(value); 28 | auto diff = value - floor_val; 29 | if ((diff < 0.5f) || 30 | ((diff == 0.5f) && (static_cast(floor_val) % 2 == 0))) { 31 | return floor_val; 32 | } else { 33 | return floor_val = floor_val + 1.0f; 34 | } 35 | } 36 | 37 | inline void Round(const RuntimeShape& input_shape, const float* input_data, 38 | const RuntimeShape& output_shape, float* output_data) { 39 | const int flat_size = MatchingFlatSize(input_shape, output_shape); 40 | for (int i = 0; i < flat_size; ++i) { 41 | // Note that this implementation matches that of tensorFlow tf.round 42 | // and corresponds to the bankers rounding method. 43 | // cfenv (for fesetround) is not yet supported universally on Android, so 44 | // using a work around. 45 | output_data[i] = RoundToNearest(input_data[i]); 46 | } 47 | } 48 | 49 | } // namespace reference_ops 50 | } // namespace tflite 51 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ 52 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 16 | #define TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/core/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 20 | 21 | namespace tflite { 22 | 23 | template 24 | inline T* GetTensorData(TfLiteTensor* tensor) { 25 | return tensor != nullptr ? reinterpret_cast(tensor->data.raw) : nullptr; 26 | } 27 | 28 | template 29 | inline const T* GetTensorData(const TfLiteTensor* tensor) { 30 | return tensor != nullptr ? reinterpret_cast(tensor->data.raw) 31 | : nullptr; 32 | } 33 | 34 | inline RuntimeShape GetTensorShape(const TfLiteTensor* tensor) { 35 | if (tensor == nullptr) { 36 | return RuntimeShape(); 37 | } 38 | 39 | TfLiteIntArray* dims = tensor->dims; 40 | const int dims_size = dims->size; 41 | const int32_t* dims_data = reinterpret_cast(dims->data); 42 | return RuntimeShape(dims_size, dims_data); 43 | } 44 | 45 | } // namespace tflite 46 | 47 | #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ 48 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_utils.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ============================================================================== 15 | */ 16 | 17 | // internal/reference_portable_tensor_utils.h has the implementation of the 18 | // functions declared in internal/portable_tensor_utils.h. This somewhat 19 | // confusing setup is derived from how the code is organized in TfLite where it 20 | // is used to select between NEON, SSE and portable implementaitons. See 21 | // https://github.com/tensorflow/tensorflow/blob/d76c23975c4a3a0d7987cfe3f45c76566df06180/tensorflow/lite/kernels/internal/tensor_utils.cc 22 | // for how the code is written in TfLite. 23 | 24 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/portable_tensor_utils.h" 25 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference_portable_tensor_utils.h" 26 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/kernels/op_macros.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_KERNELS_OP_MACROS_H_ 16 | #define TENSORFLOW_LITE_KERNELS_OP_MACROS_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/micro/debug_log.h" 19 | 20 | #if !defined(TF_LITE_MCU_DEBUG_LOG) 21 | #include 22 | #define TFLITE_ABORT abort() 23 | #else 24 | inline void AbortImpl() { 25 | DebugLog("HALTED\n"); 26 | while (1) { 27 | } 28 | } 29 | #define TFLITE_ABORT AbortImpl(); 30 | #endif 31 | 32 | #if defined(NDEBUG) 33 | #define TFLITE_ASSERT_FALSE (static_cast(0)) 34 | #else 35 | #define TFLITE_ASSERT_FALSE TFLITE_ABORT 36 | #endif 37 | 38 | #endif // TENSORFLOW_LITE_KERNELS_OP_MACROS_H_ 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/all_ops_resolver.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 16 | #define TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_mutable_op_resolver.h" 20 | 21 | namespace tflite { 22 | 23 | // The magic number in the template parameter is the maximum number of ops that 24 | // can be added to AllOpsResolver. It can be increased if needed. And most 25 | // applications that care about the memory footprint will want to directly use 26 | // MicroMutableOpResolver and have an application specific template parameter. 27 | // The examples directory has sample code for this. 28 | class AllOpsResolver : public MicroMutableOpResolver<128> { 29 | public: 30 | AllOpsResolver(); 31 | 32 | private: 33 | TF_LITE_REMOVE_VIRTUAL_DELETE 34 | }; 35 | 36 | } // namespace tflite 37 | 38 | #endif // TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/compatibility.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 16 | #define TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 17 | 18 | // C++ will automatically create class-specific delete operators for virtual 19 | // objects, which by default call the global delete function. For embedded 20 | // applications we want to avoid this, and won't be calling new/delete on these 21 | // objects, so we need to override the default implementation with one that does 22 | // nothing to avoid linking in ::delete(). 23 | // This macro needs to be included in all subclasses of a virtual base class in 24 | // the private section. 25 | 26 | // Patched by Edge Impulse, 27 | // actually declaring `void operator delete(void* p) {}` 28 | // yields compiler errors on some compilers 29 | #define TF_LITE_REMOVE_VIRTUAL_DELETE 30 | 31 | #endif // TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ 32 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/debug_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 16 | #define TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 17 | 18 | // This function should be implemented by each target platform, and provide a 19 | // way for strings to be output to some text stream. For more information, see 20 | // tensorflow/lite/micro/debug_log.cc. 21 | #if defined(__cplusplus) && EI_C_LINKAGE == 1 22 | extern "C" void DebugLog(const char* s); 23 | #else 24 | void DebugLog(const char* s); 25 | #endif // defined(__cplusplus) && EI_C_LINKAGE == 1 26 | 27 | #endif // TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ 28 | 29 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/flatbuffer_conversions_bridge.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #include "edge-impulse-sdk/tensorflow/lite/micro/flatbuffer_conversions_bridge.h" 16 | 17 | #include "edge-impulse-sdk/tensorflow/lite/c/c_api_types.h" 18 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/core/api/flatbuffer_conversions.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.h" 21 | #include "edge-impulse-sdk/tensorflow/lite/schema/schema_generated.h" 22 | 23 | namespace tflite { 24 | TfLiteStatus ConvertTensorType(TensorType tensor_type, TfLiteType* type) { 25 | return ConvertTensorType(tensor_type, type, tflite::GetMicroErrorReporter()); 26 | } 27 | 28 | TfLiteStatus CallBuiltinParseFunction(TfLiteBridgeBuiltinParseFunction parser, 29 | const Operator* op, 30 | BuiltinDataAllocator* allocator, 31 | void** builtin_data) { 32 | return parser(op, tflite::GetMicroErrorReporter(), allocator, builtin_data); 33 | } 34 | } // namespace tflite 35 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/circular_buffer.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_CIRCULAR_BUFFER_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_CIRCULAR_BUFFER_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 21 | 22 | namespace tflite { 23 | 24 | // The CircularBuffer op has one input and one output tensor. 25 | extern const int kCircularBufferInputTensor; 26 | extern const int kCircularBufferOutputTensor; 27 | 28 | // Indices into the init flexbuffer's vector. 29 | // The parameter's name is in the comment that follows. 30 | // Elements in the vectors are ordered alphabetically by parameter name. 31 | extern const int kCircularBufferCyclesMaxIndex; // 'cycles_max' 32 | 33 | // TODO(b/149795762): Add this to TfLiteStatus enum. 34 | extern const TfLiteStatus kTfLiteAbort; 35 | 36 | // These fields control the stride period of a strided streaming model. This op 37 | // returns kTfLiteAbort until cycles_until_run-- is zero. At this time, 38 | // cycles_until_run is reset to cycles_max. 39 | struct OpDataCircularBuffer { 40 | int cycles_until_run; 41 | int cycles_max; 42 | }; 43 | 44 | TfLiteStatus CircularBufferPrepare(TfLiteContext* context, TfLiteNode* node); 45 | 46 | } // namespace tflite 47 | 48 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_CIRCULAR_BUFFER_H_ 49 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/circular_buffer_flexbuffers_generated_data.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_FLEXBUFFERS_GENERATED_DATA_H 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_FLEXBUFFERS_GENERATED_DATA_H 18 | 19 | extern const int g_gen_data_size_circular_buffer_config; 20 | extern const unsigned char g_gen_data_circular_buffer_config[]; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/dequantize.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_DEQUANTIZE_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_DEQUANTIZE_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 21 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 22 | 23 | namespace tflite { 24 | 25 | struct DequantizeOpData { 26 | tflite::DequantizationParams quantization_params; 27 | // The scaling factor from input to output (aka the 'real multiplier') can 28 | // be represented as a fixed point multiplier plus a left shift. 29 | int32_t output_multiplier; 30 | int output_shift; 31 | int32_t output_zero_point; 32 | }; 33 | 34 | TfLiteStatus DequantizePrepare(TfLiteContext* context, TfLiteNode* node); 35 | 36 | } // namespace tflite 37 | 38 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_DEQUANTIZE_H_ 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/detection_postprocess_flexbuffers_generated_data.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_FLEXBUFFERS_GENERATED_DATA_H 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_FLEXBUFFERS_GENERATED_DATA_H 18 | 19 | extern const int g_gen_data_size_none_regular_nms; 20 | extern const unsigned char g_gen_data_none_regular_nms[]; 21 | 22 | extern const int g_gen_data_size_regular_nms; 23 | extern const unsigned char g_gen_data_regular_nms[]; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/ethosu.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_ETHOSU_H_ 16 | #define TENSORFLOW_LITE_MICRO_KERNELS_ETHOSU_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | 20 | namespace tflite { 21 | 22 | TfLiteRegistration* Register_ETHOSU(); 23 | 24 | const char* GetString_ETHOSU(); 25 | 26 | } // namespace tflite 27 | 28 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_ETHOSU_H_ 29 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/floor.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/floor.h" 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/kernel_util.h" 21 | 22 | namespace tflite { 23 | 24 | namespace { 25 | 26 | constexpr int kInputTensor = 0; 27 | constexpr int kOutputTensor = 0; 28 | 29 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { 30 | const TfLiteEvalTensor* input = 31 | tflite::micro::GetEvalInput(context, node, kInputTensor); 32 | TF_LITE_ENSURE_TYPES_EQ(context, input->type, kTfLiteFloat32); 33 | TfLiteEvalTensor* output = 34 | tflite::micro::GetEvalOutput(context, node, kOutputTensor); 35 | reference_ops::Floor(tflite::micro::GetTensorShape(input), 36 | tflite::micro::GetTensorData(input), 37 | tflite::micro::GetTensorShape(output), 38 | tflite::micro::GetTensorData(output)); 39 | return kTfLiteOk; 40 | } 41 | 42 | } // namespace 43 | 44 | TfLiteRegistration Register_FLOOR() { 45 | return tflite::micro::RegisterOp(nullptr, nullptr, Eval); 46 | } 47 | 48 | } // namespace tflite 49 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/hard_swish.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_HARD_SWISH_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_HARD_SWISH_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 21 | 22 | namespace tflite { 23 | 24 | extern const int kHardSwishInputTensor; 25 | extern const int kHardSwishOutputTensor; 26 | 27 | TfLiteStatus HardSwishPrepare(TfLiteContext* context, TfLiteNode* node); 28 | } // namespace tflite 29 | 30 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_HARD_SWISH_H_ 31 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/leaky_relu.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_LEAKY_RELU_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_LEAKY_RELU_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | 21 | namespace tflite { 22 | 23 | // Input/output tensor index. 24 | extern const int kInputTensor; 25 | extern const int kOutputTensor; 26 | 27 | struct LeakyReluOpData { 28 | // quantization parameters 29 | int32_t output_multiplier_alpha; 30 | int32_t output_shift_alpha; 31 | int32_t output_multiplier_identity; 32 | int32_t output_shift_identity; 33 | int32_t input_zero_point; 34 | int32_t output_zero_point; 35 | }; 36 | 37 | TfLiteStatus CalculateOpDataLeakyRelu(TfLiteContext* context, TfLiteNode* node); 38 | 39 | TfLiteStatus LeakyReluPrepare(TfLiteContext* context, TfLiteNode* node); 40 | 41 | } // namespace tflite 42 | 43 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_LEAKY_RELU_H_ 44 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/logical.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/logical.h" 16 | 17 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 18 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/binary_function.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/op_macros.h" 21 | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/kernel_util.h" 22 | 23 | namespace tflite { 24 | namespace { 25 | 26 | TfLiteStatus LogicalOrEval(TfLiteContext* context, TfLiteNode* node) { 27 | return LogicalImpl(context, node, LogicalOr); 28 | } 29 | 30 | TfLiteStatus LogicalAndEval(TfLiteContext* context, TfLiteNode* node) { 31 | return LogicalImpl(context, node, LogicalAnd); 32 | } 33 | 34 | } // namespace 35 | 36 | TfLiteRegistration Register_LOGICAL_OR() { 37 | return tflite::micro::RegisterOp(nullptr, nullptr, LogicalOrEval); 38 | } 39 | 40 | TfLiteRegistration Register_LOGICAL_AND() { 41 | return tflite::micro::RegisterOp(nullptr, nullptr, LogicalAndEval); 42 | } 43 | 44 | } // namespace tflite 45 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/logical.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_LOGICAL_H_ 16 | #define TENSORFLOW_LITE_MICRO_KERNELS_LOGICAL_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | 21 | namespace tflite { 22 | // Input/output tensor index. 23 | extern const int kLogicalInputTensor1; 24 | extern const int kLogicalInputTensor2; 25 | extern const int kLogicalOutputTensor; 26 | 27 | TfLiteStatus LogicalImpl(TfLiteContext* context, TfLiteNode* node, 28 | bool (*func)(bool, bool)); 29 | 30 | bool LogicalOr(bool x, bool y); 31 | bool LogicalAnd(bool x, bool y); 32 | 33 | } // namespace tflite 34 | 35 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_LOGICAL_H_ 36 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/logistic.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_LOGISTIC_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_LOGISTIC_H_ 18 | 19 | #include 20 | 21 | #include "edge-impulse-sdk/tensorflow/lite/c/builtin_op_data.h" 22 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 23 | 24 | namespace tflite { 25 | extern const int kLogisticInputTensor; 26 | extern const int kLogisticOutputTensor; 27 | 28 | struct OpDataLogistic { 29 | int32_t input_zero_point; 30 | int32_t input_range_radius; 31 | int32_t input_multiplier; 32 | int input_left_shift; 33 | }; 34 | 35 | TfLiteStatus CalculateArithmeticOpDataLogistic(TfLiteContext* context, 36 | TfLiteNode* node, 37 | OpDataLogistic* data); 38 | 39 | TfLiteStatus LogisticPrepare(TfLiteContext* context, TfLiteNode* node); 40 | 41 | } // namespace tflite 42 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_LOGISTIC_H_ 43 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/mli_slicers.h: -------------------------------------------------------------------------------- 1 | // Patched by Edge Impulse to include reference and hardware-accelerated kernels 2 | #include "../../../../classifier/ei_classifier_config.h" 3 | #if EI_CLASSIFIER_TFLITE_ENABLE_ARC == 1 4 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://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, 14 | WITHOUT 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 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ 20 | #define TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ 21 | 22 | #include "mli_api.h" // NOLINT 23 | namespace tflite { 24 | namespace ops { 25 | namespace micro { 26 | 27 | class TensorSlicer { 28 | public: 29 | TensorSlicer(const mli_tensor* full_tensor, int slice_dim, int slice_size, 30 | int padding_pre = 0, int padding_post = 0, int overlap = 0, 31 | bool interleave_mode = false); 32 | ~TensorSlicer() = default; 33 | 34 | void Next(); 35 | bool Done(); 36 | int GetPaddingPre(); 37 | int GetPaddingPost(); 38 | 39 | mli_tensor* Sub(); 40 | 41 | // Default constructor is deleted 42 | TensorSlicer() = delete; 43 | 44 | private: 45 | const mli_tensor* full_tensor_; 46 | mli_tensor sub_tensor_; 47 | mli_sub_tensor_cfg sub_cfg_; 48 | bool done_; 49 | int sliceDim_; 50 | int pad_pre_, pad_post_, overlap_; 51 | int actual_padding_pre, actual_padding_post; 52 | 53 | void ComputeSubTensor(); 54 | }; 55 | 56 | } // namespace micro 57 | } // namespace ops 58 | } // namespace tflite 59 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ 60 | 61 | #endif // EI_CLASSIFIER_TFLITE_ENABLE_ARC == 1 62 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/pad.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_PAD_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_PAD_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | 21 | namespace tflite { 22 | 23 | TfLiteStatus PadPrepare(TfLiteContext* context, TfLiteNode* node); 24 | 25 | } // namespace tflite 26 | 27 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_PAD_H_ 28 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/prelu.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_PRELU_H_ 17 | #define TENSORFLOW_LITE_MICRO_KERNELS_PRELU_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 21 | 22 | namespace tflite { 23 | 24 | TfLiteStatus CalculatePreluParams(const TfLiteTensor* input, 25 | const TfLiteTensor* alpha, 26 | TfLiteTensor* output, PreluParams* params); 27 | 28 | void BroadcastPrelu4DSlowFloat(const RuntimeShape& unextended_input1_shape, 29 | const float* input1_data, 30 | const RuntimeShape& unextended_input2_shape, 31 | const float* input2_data, 32 | const RuntimeShape& unextended_output_shape, 33 | float* output_data); 34 | 35 | TfLiteStatus PreluPrepare(TfLiteContext* context, TfLiteNode* node); 36 | 37 | } // namespace tflite 38 | 39 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_PRELU_H_ 40 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/quantize.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/quantize.h" 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/quantization_util.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h" 21 | #include "edge-impulse-sdk/tensorflow/lite/kernels/kernel_util.h" 22 | #include "edge-impulse-sdk/tensorflow/lite/micro/kernels/kernel_util.h" 23 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_utils.h" 24 | 25 | namespace tflite { 26 | namespace { 27 | 28 | void* Init(TfLiteContext* context, const char* buffer, size_t length) { 29 | TFLITE_DCHECK(context->AllocatePersistentBuffer != nullptr); 30 | return context->AllocatePersistentBuffer(context, 31 | sizeof(OpDataQuantizeReference)); 32 | } 33 | 34 | } // namespace 35 | 36 | TfLiteRegistration Register_QUANTIZE() { 37 | return tflite::micro::RegisterOp(Init, PrepareQuantizeReference, 38 | EvalQuantizeReference); 39 | } 40 | 41 | } // namespace tflite 42 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/kernels/quantize.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_KERNELS_QUANTIZE_H_ 16 | #define TENSORFLOW_LITE_MICRO_KERNELS_QUANTIZE_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/kernels/internal/types.h" 20 | 21 | namespace tflite { 22 | 23 | struct OpDataQuantizeReference { 24 | tflite::QuantizationParams quantization_params; 25 | // The scaling factor from input to output (aka the 'real multiplier') can 26 | // be represented as a fixed point multiplier plus a left shift. 27 | int32_t requantize_output_multiplier; 28 | int requantize_output_shift; 29 | 30 | int32_t input_zero_point; 31 | }; 32 | 33 | TfLiteStatus EvalQuantizeReference(TfLiteContext* context, TfLiteNode* node); 34 | TfLiteStatus PrepareQuantizeReference(TfLiteContext* context, TfLiteNode* node); 35 | } // namespace tflite 36 | 37 | #endif // TENSORFLOW_LITE_MICRO_KERNELS_QUANTIZE_H_ 38 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/memory_planner/linear_memory_planner.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 17 | #define TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 18 | 19 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/micro/memory_planner/micro_memory_planner.h" 21 | 22 | namespace tflite { 23 | 24 | // The simplest possible memory planner that just lays out all buffers at 25 | // increasing offsets without trying to reuse memory. 26 | class LinearMemoryPlanner : public MicroMemoryPlanner { 27 | public: 28 | LinearMemoryPlanner(); 29 | ~LinearMemoryPlanner() override; 30 | 31 | TfLiteStatus AddBuffer(int size, int first_time_used, 32 | int last_time_used) override; 33 | 34 | size_t GetMaximumMemorySize() override; 35 | int GetBufferCount() override; 36 | TfLiteStatus GetOffsetForBuffer(int buffer_index, int* offset) override; 37 | 38 | private: 39 | static constexpr int kMaxBufferCount = 1024; 40 | size_t buffer_offsets_[kMaxBufferCount]; 41 | int current_buffer_count_; 42 | size_t next_free_offset_; 43 | 44 | TF_LITE_REMOVE_VIRTUAL_DELETE 45 | }; 46 | 47 | } // namespace tflite 48 | 49 | #endif // TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ 50 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/micro_arena_constants.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_ARENA_CONSTANTS_H_ 17 | #define TENSORFLOW_LITE_MICRO_MICRO_ARENA_CONSTANTS_H_ 18 | 19 | namespace tflite { 20 | 21 | // The default buffer alignment requirement. 22 | // We align tensor buffers to 16-byte boundaries, since this is a common 23 | // requirement for SIMD extensions. 24 | constexpr int MicroArenaBufferAlignment() { return 16; } 25 | 26 | } // namespace tflite 27 | 28 | #endif // TENSORFLOW_LITE_MICRO_MICRO_ARENA_CONSTANTS_H_ 29 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.h" 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_log.h" 23 | 24 | namespace { 25 | uint8_t micro_error_reporter_buffer[sizeof(tflite::MicroErrorReporter)]; 26 | tflite::MicroErrorReporter* error_reporter_ = nullptr; 27 | 28 | } // namespace 29 | 30 | namespace tflite { 31 | ErrorReporter* GetMicroErrorReporter() { 32 | if (error_reporter_ == nullptr) { 33 | error_reporter_ = new (micro_error_reporter_buffer) MicroErrorReporter(); 34 | } 35 | return error_reporter_; 36 | } 37 | 38 | int MicroErrorReporter::Report(const char* format, va_list args) { 39 | Log(format, args); 40 | return 0; 41 | } 42 | 43 | } // namespace tflite 44 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_MICRO_ERROR_REPORTER_H_ 16 | #define TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_MICRO_ERROR_REPORTER_H_ 17 | 18 | #include 19 | 20 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 21 | #include "edge-impulse-sdk/tensorflow/lite/micro/compatibility.h" 22 | 23 | namespace tflite { 24 | // Get a pointer to a singleton global error reporter. 25 | ErrorReporter* GetMicroErrorReporter(); 26 | class MicroErrorReporter : public ErrorReporter { 27 | public: 28 | ~MicroErrorReporter() override {} 29 | int Report(const char* format, va_list args) override; 30 | 31 | private: 32 | TF_LITE_REMOVE_VIRTUAL_DELETE 33 | }; 34 | 35 | } // namespace tflite 36 | 37 | #endif // TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_MICRO_ERROR_REPORTER_H_ 38 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/micro_log.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_log.h" 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #if !defined(TF_LITE_STRIP_ERROR_STRINGS) 23 | #include "edge-impulse-sdk/tensorflow/lite/micro/debug_log.h" 24 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_string.h" 25 | #endif 26 | 27 | void Log(const char* format, va_list args) { 28 | #if !defined(TF_LITE_STRIP_ERROR_STRINGS) 29 | // Only pulling in the implementation of this function for builds where we 30 | // expect to make use of it to be extra cautious about not increasing the code 31 | // size. 32 | static constexpr int kMaxLogLen = 256; 33 | char log_buffer[kMaxLogLen]; 34 | MicroVsnprintf(log_buffer, kMaxLogLen, format, args); 35 | DebugLog(log_buffer); 36 | DebugLog("\r\n"); 37 | #endif 38 | } 39 | 40 | #if !defined(TF_LITE_STRIP_ERROR_STRINGS) 41 | void MicroPrintf(const char* format, ...) { 42 | va_list args; 43 | va_start(args, format); 44 | Log(format, args); 45 | va_end(args); 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/micro_log.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_LOG_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_LOG_H_ 17 | 18 | #include 19 | 20 | // do this by default except when running EON compiler 21 | #ifndef EON_COMPILER_RUN 22 | #define TF_LITE_STRIP_ERROR_STRINGS 23 | #endif 24 | 25 | // This is a free function used to perform the actual logging. 26 | // This function will be used by MicroPrintf and MicroErrorReporter::Report() 27 | void Log(const char* format, va_list args); 28 | 29 | #if !defined(TF_LITE_STRIP_ERROR_STRINGS) 30 | // This function can be used independent of the MicroErrorReporter to get 31 | // printf-like functionalitys and are common to all target platforms. 32 | void MicroPrintf(const char* format, ...); 33 | #else 34 | // We use a #define to ensure that the strings are completely stripped, to 35 | // prevent an unnecessary increase in the binary size. 36 | #define MicroPrintf(...) 37 | #endif 38 | 39 | #endif // TENSORFLOW_LITE_MICRO_MICRO_LOG_H_ 40 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/micro_profiler_interface.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_PROFILER_INTERFACE_H_ 17 | #define TENSORFLOW_LITE_MICRO_MICRO_PROFILER_INTERFACE_H_ 18 | 19 | #include 20 | 21 | namespace tflite { 22 | 23 | // Interface class that the TFLM framework relies on for profiling. 24 | class MicroProfilerInterface { 25 | public: 26 | virtual ~MicroProfilerInterface() {} 27 | 28 | // Marks the start of a new event and returns an event handle that can be used 29 | // to mark the end of the event via EndEvent. 30 | virtual uint32_t BeginEvent(const char* tag) = 0; 31 | 32 | // Marks the end of an event associated with event_handle. 33 | virtual void EndEvent(uint32_t event_handle) = 0; 34 | }; 35 | 36 | } // namespace tflite 37 | 38 | #endif // TENSORFLOW_LITE_MICRO_MICRO_PROFILER_INTERFACE_H_ 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/micro_string.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 17 | 18 | #include 19 | 20 | // Implements simple string formatting for numeric types. Returns the number of 21 | // bytes written to output. 22 | extern "C" { 23 | // Functionally equivalent to vsnprintf, trimmed down for TFLite Micro. 24 | // MicroSnprintf() is implemented using MicroVsnprintf(). 25 | int MicroVsnprintf(char* output, int len, const char* format, va_list args); 26 | // Functionally equavalent to snprintf, trimmed down for TFLite Micro. 27 | // For example, MicroSnprintf(buffer, 10, "int %d", 10) will put the string 28 | // "int 10" in the buffer. 29 | // Floating point values are logged in exponent notation (1.XXX*2^N). 30 | int MicroSnprintf(char* output, int len, const char* format, ...); 31 | } 32 | 33 | #endif // TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ 34 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/micro_time.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 16 | #define TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 17 | 18 | #include 19 | 20 | namespace tflite { 21 | 22 | // These functions should be implemented by each target platform, and provide an 23 | // accurate tick count along with how many ticks there are per second. 24 | uint32_t ticks_per_second(); 25 | 26 | // Return time in ticks. The meaning of a tick varies per platform. 27 | uint32_t GetCurrentTimeTicks(); 28 | 29 | inline uint32_t TicksToMs(int32_t ticks) { 30 | return static_cast(1000.0f * static_cast(ticks) / 31 | static_cast(ticks_per_second())); 32 | } 33 | 34 | } // namespace tflite 35 | 36 | #endif // TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ 37 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/op_resolver_bridge.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/op_resolver_bridge.h" 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/core/api/error_reporter.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/core/api/op_resolver.h" 21 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_error_reporter.h" 22 | #include "edge-impulse-sdk/tensorflow/lite/schema/schema_utils.h" 23 | 24 | namespace tflite { 25 | 26 | TfLiteStatus GetRegistrationFromOpCode( 27 | const OperatorCode* opcode, const OpResolver& op_resolver, 28 | const TfLiteRegistration** registration) { 29 | return GetRegistrationFromOpCode( 30 | opcode, op_resolver, tflite::GetMicroErrorReporter(), registration); 31 | } 32 | } // namespace tflite 33 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/op_resolver_bridge.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_OP_RESOLVER_BRIDGE_H_ 16 | #define TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_OP_RESOLVER_BRIDGE_H_ 17 | 18 | #include "edge-impulse-sdk/tensorflow/lite/c/c_api_types.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/c/common.h" 20 | #include "edge-impulse-sdk/tensorflow/lite/core/api/op_resolver.h" // needed for the Using declarative 21 | 22 | namespace tflite { 23 | 24 | // Forward declaration of the classes and structs used here. 25 | struct OperatorCode; 26 | 27 | using TfLiteBridgeOpResolver = OpResolver; 28 | 29 | // Handles the logic for converting between an OperatorCode structure extracted 30 | // from a flatbuffer and information about a registered operator 31 | // implementation. 32 | TfLiteStatus GetRegistrationFromOpCode(const OperatorCode* opcode, 33 | const OpResolver& op_resolver, 34 | const TfLiteRegistration** registration); 35 | 36 | } // namespace tflite 37 | 38 | #endif // TENSORFLOW_LITE_MICRO_TFLITE_BRIDGE_OP_RESOLVER_BRIDGE_H_ 39 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/persistent_arena_buffer_allocator.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #include "edge-impulse-sdk/tensorflow/lite/micro/persistent_arena_buffer_allocator.h" 16 | 17 | #include "edge-impulse-sdk/tensorflow/lite/micro/memory_helpers.h" 18 | #include "edge-impulse-sdk/tensorflow/lite/micro/micro_log.h" 19 | 20 | namespace tflite { 21 | 22 | PersistentArenaBufferAllocator::PersistentArenaBufferAllocator( 23 | uint8_t* buffer, size_t buffer_size) 24 | : buffer_head_(buffer), 25 | buffer_tail_(buffer + buffer_size), 26 | tail_temp_(buffer_tail_) {} 27 | 28 | PersistentArenaBufferAllocator::~PersistentArenaBufferAllocator() {} 29 | 30 | uint8_t* PersistentArenaBufferAllocator::AllocatePersistentBuffer( 31 | size_t size, size_t alignment) { 32 | uint8_t* const aligned_result = 33 | AlignPointerDown(tail_temp_ - size, alignment); 34 | if (aligned_result < buffer_head_) { 35 | #ifndef TF_LITE_STRIP_ERROR_STRINGS 36 | const size_t missing_memory = buffer_head_ - aligned_result; 37 | MicroPrintf( 38 | "Failed to allocate tail memory. Requested: %u, " 39 | "available %u, missing: %u", 40 | size, size - missing_memory, missing_memory); 41 | #endif 42 | return nullptr; 43 | } 44 | tail_temp_ = aligned_result; 45 | return aligned_result; 46 | } 47 | 48 | size_t PersistentArenaBufferAllocator::GetPersistentUsedBytes() const { 49 | return buffer_tail_ - tail_temp_; 50 | } 51 | 52 | } // namespace tflite 53 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/system_setup.cc: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | #include "edge-impulse-sdk/tensorflow/lite/micro/system_setup.h" 17 | 18 | namespace tflite { 19 | 20 | // To add an equivalent function for your own platform, create your own 21 | // implementation file, and place it in a subfolder named after the target. See 22 | // tensorflow/lite/micro/debug_log.cc for a similar example. 23 | void InitializeTarget() {} 24 | 25 | } // namespace tflite 26 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/micro/system_setup.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_MICRO_SYSTEM_SETUP_H_ 16 | #define TENSORFLOW_LITE_MICRO_SYSTEM_SETUP_H_ 17 | 18 | namespace tflite { 19 | 20 | // This should called during initialization of TFLM binaries and tests. It can 21 | // be specialized if there is a need for custom target-specific intialization. 22 | // For more information, see tensorflow/lite/micro/system_setup.cc. 23 | void InitializeTarget(); 24 | 25 | } // namespace tflite 26 | 27 | #endif // TENSORFLOW_LITE_MICRO_SYSTEM_SETUP_H_ 28 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/tensorflow/lite/schema/schema_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | #ifndef TENSORFLOW_LITE_SCHEMA_SCHEMA_UTILS_H_ 16 | #define TENSORFLOW_LITE_SCHEMA_SCHEMA_UTILS_H_ 17 | 18 | #include "edge-impulse-sdk/third_party/flatbuffers/include/flatbuffers/flatbuffers.h" 19 | #include "edge-impulse-sdk/tensorflow/lite/schema/schema_generated.h" 20 | 21 | namespace tflite { 22 | 23 | // The following methods are introduced to resolve op builtin code shortage 24 | // problem. The new builtin operator will be assigned to the extended builtin 25 | // code field in the flatbuffer schema. Those methods helps to hide builtin code 26 | // details. 27 | BuiltinOperator GetBuiltinCode(const OperatorCode *op_code); 28 | 29 | BuiltinOperator GetBuiltinCode(const OperatorCodeT *op_code); 30 | 31 | } // namespace tflite 32 | 33 | #endif // TENSORFLOW_LITE_SCHEMA_SCHEMA_UTILS_H_ 34 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/third_party/arc_mli_package/LICENSE: -------------------------------------------------------------------------------- 1 | embARC Machine Learning Inference (embARC MLI) library 2 | 3 | Copyright (c) 2019-2020 Synopsys, Inc. All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | 1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | 9 | 2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | 11 | 3) Neither the name of the Synopsys, Inc., nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/third_party/arc_mli_package/bin/emsdp_em11d_em9d_dfss/release/libmli.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/firmware-nordic-thingy91/840d17a01a716ad852a0f40b647ce2fd96e62e22/ei-model/edge-impulse-sdk/third_party/arc_mli_package/bin/emsdp_em11d_em9d_dfss/release/libmli.a -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/third_party/arc_mli_package/include/api/mli_helpers_api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edgeimpulse/firmware-nordic-thingy91/840d17a01a716ad852a0f40b647ce2fd96e62e22/ei-model/edge-impulse-sdk/third_party/arc_mli_package/include/api/mli_helpers_api.h -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/third_party/arc_mli_package/include/mli_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020, Synopsys, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-3-Clause license found in 6 | * the LICENSE file in the root directory of this source tree. 7 | * 8 | */ 9 | 10 | /** 11 | * @file MLI Library API 12 | * 13 | * @brief This header includes all necessary files for using MLI Library 14 | */ 15 | 16 | #ifndef _MLI_API_H_ 17 | #define _MLI_API_H_ 18 | 19 | #include "mli_types.h" 20 | 21 | #include "api/mli_helpers_api.h" 22 | #include "api/mli_kernels_api.h" 23 | #include "api/mli_mov_api.h" 24 | 25 | #endif //#ifndef _MLI_API_H_ 26 | -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/third_party/flatbuffers/include/flatbuffers/fb_buffer_ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FLATBUFFERS_BUFFER_REF_H_ 18 | #define FLATBUFFERS_BUFFER_REF_H_ 19 | 20 | #include "edge-impulse-sdk/third_party/flatbuffers/include/flatbuffers/fb_base.h" 21 | #include "edge-impulse-sdk/third_party/flatbuffers/include/flatbuffers/fb_verifier.h" 22 | 23 | namespace flatbuffers { 24 | 25 | // Convenient way to bundle a buffer and its length, to pass it around 26 | // typed by its root. 27 | // A BufferRef does not own its buffer. 28 | struct BufferRefBase {}; // for std::is_base_of 29 | 30 | template struct BufferRef : BufferRefBase { 31 | BufferRef() : buf(nullptr), len(0), must_free(false) {} 32 | BufferRef(uint8_t *_buf, uoffset_t _len) 33 | : buf(_buf), len(_len), must_free(false) {} 34 | 35 | ~BufferRef() { 36 | if (must_free) free(buf); 37 | } 38 | 39 | const T *GetRoot() const { return flatbuffers::GetRoot(buf); } 40 | 41 | bool Verify() { 42 | Verifier verifier(buf, len); 43 | return verifier.VerifyBuffer(nullptr); 44 | } 45 | 46 | uint8_t *buf; 47 | uoffset_t len; 48 | bool must_free; 49 | }; 50 | 51 | } // namespace flatbuffers 52 | 53 | #endif // FLATBUFFERS_BUFFER_REF_H_ -------------------------------------------------------------------------------- /ei-model/edge-impulse-sdk/third_party/flatbuffers/include/flatbuffers/fb_struct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef FLATBUFFERS_STRUCT_H_ 18 | #define FLATBUFFERS_STRUCT_H_ 19 | 20 | #include "edge-impulse-sdk/third_party/flatbuffers/include/flatbuffers/fb_base.h" 21 | 22 | namespace flatbuffers { 23 | 24 | // "structs" are flat structures that do not have an offset table, thus 25 | // always have all members present and do not support forwards/backwards 26 | // compatible extensions. 27 | 28 | class Struct FLATBUFFERS_FINAL_CLASS { 29 | public: 30 | template T GetField(uoffset_t o) const { 31 | return ReadScalar(&data_[o]); 32 | } 33 | 34 | template T GetStruct(uoffset_t o) const { 35 | return reinterpret_cast(&data_[o]); 36 | } 37 | 38 | const uint8_t *GetAddressOf(uoffset_t o) const { return &data_[o]; } 39 | uint8_t *GetAddressOf(uoffset_t o) { return &data_[o]; } 40 | 41 | private: 42 | // private constructor & copy constructor: you obtain instances of this 43 | // class by pointing to existing data only 44 | Struct(); 45 | Struct(const Struct &); 46 | Struct &operator=(const Struct &); 47 | 48 | uint8_t data_[1]; 49 | }; 50 | 51 | } // namespace flatbuffers 52 | 53 | #endif // FLATBUFFERS_STRUCT_H_ -------------------------------------------------------------------------------- /firmware-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | -------------------------------------------------------------------------------- /firmware-sdk/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `firmware-sdk` will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [Unreleased] 9 | ### Added 10 | - 11 | - Added `CMakeLists.txt` for CMake based build systems (#4459) 12 | - `ei_device_info_lib`: new `init_device_id` method to force developers to implement such a functionality (#4459) 13 | - `ei_device_info_lib`: now device has a default `device_id` value (#4459) 14 | - `EiDeviceMemory`: new `flush_data` method (#4152) 15 | - `at_base64_lib`: new API allowing for chunked data to be encoded and processed by UART (#4678) 16 | - `jpeg`: new API to encode and send in the base64 images from RAW RGB888, RGB565 or Grayscale buffers (#3579) 17 | 18 | ### Changed 19 | - Global define of `EI_SENSOR_AQ_STREAM=FILE` is not needed anymore (#4459) 20 | - Adding all `QCBOR` directories to include path is not needed anymore (#4459) 21 | - extended `set_*` methods of the `EiDeviceInfo` allowing to not save config after changeing value (#4543) 22 | - remove all references to old `ei_config_t` struct from `ei_fusion` module and use a new `EiDeviceInfo` interface (#4426) 23 | - Removed `const` qualifier from some of `EiDeviceMemory` fields (#4459) 24 | - Small fixes and code clean-up 25 | -------------------------------------------------------------------------------- /firmware-sdk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13.1) 2 | 3 | if(NOT TARGET app) 4 | message(FATAL_ERROR "Please create a target named 'app' (ex: add_executable(app)) before adding this file") 5 | endif() 6 | 7 | target_include_directories(app PRIVATE .) 8 | 9 | # add all sources to the project 10 | RECURSIVE_FIND_FILE_APPEND(MODEL_SOURCE "." "*.cpp") 11 | RECURSIVE_FIND_FILE_APPEND(MODEL_C_SOURCE "." "*.c") 12 | target_sources(app PRIVATE ${MODEL_SOURCE} ${MODEL_C_SOURCE}) 13 | -------------------------------------------------------------------------------- /firmware-sdk/README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | The firmware-sdk provides portable code for commonly needed processing tasks. It in turn relies on drivers provided for specific targets. 4 | 5 | # Core functions 6 | Chip specific implementations must be provided for the following header files: 7 | - ei_classifier_porting.h 8 | - ei_device_info_lib.h 9 | - ei_device_interface.h 10 | 11 | # Sensors 12 | 13 | ## Camera 14 | 15 | - Ingestion (snapshot, snapshot_stream) format: 16 | The daemon (and the frame-to-jpeg debug tool) expect packed RGB 17 | (3B per pixel, as opposed to 4B with high B to 0 for inference) 18 | - Big endian format (uint8_t image[i] is R, image[i+1] is G, ... 19 | 20 | - Inference format: 21 | - The "get_data" function expects RGB encoded into floats, respecting the endianness of the platform 22 | - If you encode with bit shifting, you'll encode with the endianness of the chip 23 | - something like: static_cast((r << 16) + (g << 8 ) + b)) 24 | - The encoding is 4B, so there's a pad byte in the MSB of the float 25 | 26 | ### Porting 27 | 28 | - The top level of all firmware is chip specific. ei_image_lib provides portable, convenient functions for binding to AT commands. 29 | ``` 30 | config_ctx.take_snapshot = &ei_camera_take_snapshot_output_on_serial; 31 | config_ctx.start_snapshot_stream = &ei_camera_start_snapshot_stream; 32 | ``` 33 | - To support these two functions, one must provide a driver implementation for the following interface class: ei_camera_interface.h 34 | - This is a singleton class pattern with a port provided factory. All needed functions are prototyped in ei_camera_interface.h 35 | - (The "core" functions must also be present, see "Core functions" above) 36 | - Other support functions exist in ei_image_lib 37 | - YUV422 to RGB conversion 38 | - ei_image_nn.h supports inference, but does not need to be touched. It calls the camera factory. 39 | 40 | ### Interface notes 41 | 42 | at_get_snapshot_list : Return possible resolutions, greyscale, etc 43 | - const char **color_depth >-should be-> "Greyscale" or "RGB" -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(app PRIVATE .) 2 | target_sources(app PRIVATE 3 | ${CMAKE_CURRENT_SOURCE_DIR}/ei_at_handlers.cpp 4 | ${CMAKE_CURRENT_SOURCE_DIR}/ei_device_nrf91.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/ei_memory.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/ei_sampler.cpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 8 | ) 9 | 10 | target_sources_ifdef(CONFIG_REMOTE_INGESTION app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ei_ws_client.cpp) 11 | -------------------------------------------------------------------------------- /src/ei_sampler.h: -------------------------------------------------------------------------------- 1 | /* The Clear BSD License 2 | * 3 | * Copyright (c) 2025 EdgeImpulse Inc. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted (subject to the limitations in the disclaimer 8 | * below) provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * * Neither the name of the copyright holder nor the names of its 18 | * contributors may be used to endorse or promote products derived from this 19 | * software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef _EI_SAMPLER_H 36 | #define _EI_SAMPLER_H 37 | 38 | #include "firmware-sdk/ei_config_types.h" 39 | 40 | /* Function prototypes ----------------------------------------------------- */ 41 | bool ei_sampler_start_sampling(void *v_ptr_payload, starter_callback ei_sample_start, uint32_t sample_size); 42 | 43 | #endif -------------------------------------------------------------------------------- /src/inference/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(app PRIVATE 2 | ${CMAKE_CURRENT_SOURCE_DIR}/ei_run_fusion_impulse.cpp 3 | ) 4 | -------------------------------------------------------------------------------- /src/sensors/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(app PRIVATE .) 2 | target_sources(app PRIVATE 3 | ${CMAKE_CURRENT_SOURCE_DIR}/ei_accelerometer.cpp 4 | ${CMAKE_CURRENT_SOURCE_DIR}/ei_environment.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/ei_light.cpp 6 | ) -------------------------------------------------------------------------------- /src/sensors/ei_fusion_sensors_config.h: -------------------------------------------------------------------------------- 1 | /* The Clear BSD License 2 | * 3 | * Copyright (c) 2025 EdgeImpulse Inc. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted (subject to the limitations in the disclaimer 8 | * below) provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * * Neither the name of the copyright holder nor the names of its 18 | * contributors may be used to endorse or promote products derived from this 19 | * software without specific prior written permission. 20 | * 21 | * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | * THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef EI_FUSION_SENSORS_CONFIG_H 36 | #define EI_FUSION_SENSORS_CONFIG_H 37 | 38 | #define NUM_MAX_FUSIONS 3 39 | 40 | #define MULTI_FREQ_ENABLED 1 41 | 42 | /** Format used for fusion */ 43 | typedef float fusion_sample_format_t; 44 | 45 | #endif // EI_FUSION_SENSORS_CONFIG_H --------------------------------------------------------------------------------