mlonmcu 0.3.0.dev0__3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mlonmcu/__init__.py +26 -0
- mlonmcu/artifact.py +172 -0
- mlonmcu/cli/__init__.py +19 -0
- mlonmcu/cli/build.py +119 -0
- mlonmcu/cli/cleanup.py +75 -0
- mlonmcu/cli/common.py +227 -0
- mlonmcu/cli/compile.py +87 -0
- mlonmcu/cli/env.py +68 -0
- mlonmcu/cli/export.py +93 -0
- mlonmcu/cli/flow.py +67 -0
- mlonmcu/cli/helper/__init__.py +18 -0
- mlonmcu/cli/helper/filter.py +25 -0
- mlonmcu/cli/helper/parse.py +159 -0
- mlonmcu/cli/init.py +130 -0
- mlonmcu/cli/load.py +87 -0
- mlonmcu/cli/main.py +116 -0
- mlonmcu/cli/models.py +48 -0
- mlonmcu/cli/run.py +56 -0
- mlonmcu/cli/setup.py +136 -0
- mlonmcu/cli/tune.py +48 -0
- mlonmcu/config.py +219 -0
- mlonmcu/context/__init__.py +22 -0
- mlonmcu/context/context.py +545 -0
- mlonmcu/context/read_write_filelock.py +327 -0
- mlonmcu/environment/__init__.py +18 -0
- mlonmcu/environment/config.py +214 -0
- mlonmcu/environment/environment.py +501 -0
- mlonmcu/environment/init.py +191 -0
- mlonmcu/environment/list.py +81 -0
- mlonmcu/environment/loader.py +250 -0
- mlonmcu/environment/templates.py +69 -0
- mlonmcu/environment/writer.py +117 -0
- mlonmcu/feature/__init__.py +18 -0
- mlonmcu/feature/feature.py +230 -0
- mlonmcu/feature/features.py +1537 -0
- mlonmcu/feature/type.py +33 -0
- mlonmcu/flow/__init__.py +61 -0
- mlonmcu/flow/backend.py +234 -0
- mlonmcu/flow/framework.py +69 -0
- mlonmcu/flow/tflm/__init__.py +23 -0
- mlonmcu/flow/tflm/backend/__init__.py +23 -0
- mlonmcu/flow/tflm/backend/backend.py +47 -0
- mlonmcu/flow/tflm/backend/tflmc.py +129 -0
- mlonmcu/flow/tflm/backend/tflmi.py +385 -0
- mlonmcu/flow/tflm/framework.py +81 -0
- mlonmcu/flow/tvm/__init__.py +23 -0
- mlonmcu/flow/tvm/backend/__init__.py +26 -0
- mlonmcu/flow/tvm/backend/backend.py +282 -0
- mlonmcu/flow/tvm/backend/model_info.py +307 -0
- mlonmcu/flow/tvm/backend/python_utils.py +36 -0
- mlonmcu/flow/tvm/backend/tuner.py +41 -0
- mlonmcu/flow/tvm/backend/tvmaot.py +162 -0
- mlonmcu/flow/tvm/backend/tvmaotplus.py +51 -0
- mlonmcu/flow/tvm/backend/tvmc_utils.py +172 -0
- mlonmcu/flow/tvm/backend/tvmcg.py +102 -0
- mlonmcu/flow/tvm/backend/tvmllvm.py +106 -0
- mlonmcu/flow/tvm/backend/tvmrt.py +151 -0
- mlonmcu/flow/tvm/backend/wrapper.py +645 -0
- mlonmcu/flow/tvm/framework.py +96 -0
- mlonmcu/logging.py +79 -0
- mlonmcu/mlonmcu.py +19 -0
- mlonmcu/models/__init__.py +31 -0
- mlonmcu/models/convert_data.py +107 -0
- mlonmcu/models/frontend.py +571 -0
- mlonmcu/models/group.py +29 -0
- mlonmcu/models/lookup.py +345 -0
- mlonmcu/models/metadata.py +133 -0
- mlonmcu/models/model.py +104 -0
- mlonmcu/models/options.py +64 -0
- mlonmcu/models/utils.py +136 -0
- mlonmcu/platform/__init__.py +27 -0
- mlonmcu/platform/_platform.py +46 -0
- mlonmcu/platform/espidf/__init__.py +25 -0
- mlonmcu/platform/espidf/espidf.py +489 -0
- mlonmcu/platform/espidf/espidf_target.py +257 -0
- mlonmcu/platform/lookup.py +126 -0
- mlonmcu/platform/microtvm/__init__.py +25 -0
- mlonmcu/platform/microtvm/microtvm.py +580 -0
- mlonmcu/platform/microtvm/microtvm_arduino_target.py +68 -0
- mlonmcu/platform/microtvm/microtvm_backend.py +64 -0
- mlonmcu/platform/microtvm/microtvm_espidf_target.py +94 -0
- mlonmcu/platform/microtvm/microtvm_etissvp_target.py +98 -0
- mlonmcu/platform/microtvm/microtvm_host_target.py +46 -0
- mlonmcu/platform/microtvm/microtvm_spike_target.py +230 -0
- mlonmcu/platform/microtvm/microtvm_target.py +189 -0
- mlonmcu/platform/microtvm/microtvm_template_target.py +55 -0
- mlonmcu/platform/microtvm/microtvm_zephyr_target.py +91 -0
- mlonmcu/platform/mlif/__init__.py +25 -0
- mlonmcu/platform/mlif/mlif.py +300 -0
- mlonmcu/platform/mlif/mlif_target.py +86 -0
- mlonmcu/platform/platform.py +244 -0
- mlonmcu/platform/tvm/__init__.py +25 -0
- mlonmcu/platform/tvm/tvm.py +429 -0
- mlonmcu/platform/tvm/tvm_backend.py +57 -0
- mlonmcu/platform/tvm/tvm_target.py +165 -0
- mlonmcu/platform/zephyr/__init__.py +25 -0
- mlonmcu/platform/zephyr/zephyr.py +450 -0
- mlonmcu/platform/zephyr/zephyr_target.py +110 -0
- mlonmcu/plugins.py +26 -0
- mlonmcu/report.py +99 -0
- mlonmcu/session/__init__.py +18 -0
- mlonmcu/session/postprocess/__init__.py +43 -0
- mlonmcu/session/postprocess/postprocess.py +62 -0
- mlonmcu/session/postprocess/postprocesses.py +487 -0
- mlonmcu/session/run.py +1008 -0
- mlonmcu/session/session.py +373 -0
- mlonmcu/setup/__init__.py +18 -0
- mlonmcu/setup/cache.py +147 -0
- mlonmcu/setup/gen_requirements.py +619 -0
- mlonmcu/setup/setup.py +285 -0
- mlonmcu/setup/task.py +380 -0
- mlonmcu/setup/tasks/__init__.py +40 -0
- mlonmcu/setup/tasks/arm_gcc.py +58 -0
- mlonmcu/setup/tasks/cmsisnn.py +151 -0
- mlonmcu/setup/tasks/common.py +36 -0
- mlonmcu/setup/tasks/corstone300.py +64 -0
- mlonmcu/setup/tasks/espidf.py +87 -0
- mlonmcu/setup/tasks/etiss.py +147 -0
- mlonmcu/setup/tasks/llvm.py +67 -0
- mlonmcu/setup/tasks/mlif.py +49 -0
- mlonmcu/setup/tasks/muriscvnn.py +166 -0
- mlonmcu/setup/tasks/pulp.py +192 -0
- mlonmcu/setup/tasks/riscv_gcc.py +146 -0
- mlonmcu/setup/tasks/spike.py +190 -0
- mlonmcu/setup/tasks/tf.py +92 -0
- mlonmcu/setup/tasks/tflite.py +59 -0
- mlonmcu/setup/tasks/tflmc.py +141 -0
- mlonmcu/setup/tasks/tvm.py +172 -0
- mlonmcu/setup/tasks/utvmcg.py +96 -0
- mlonmcu/setup/tasks/zephyr.py +119 -0
- mlonmcu/setup/utils.py +374 -0
- mlonmcu/target/__init__.py +37 -0
- mlonmcu/target/_target.py +41 -0
- mlonmcu/target/arm/__init__.py +3 -0
- mlonmcu/target/arm/corstone300.py +235 -0
- mlonmcu/target/arm/util.py +109 -0
- mlonmcu/target/common.py +194 -0
- mlonmcu/target/elf.py +256 -0
- mlonmcu/target/host_x86.py +84 -0
- mlonmcu/target/metrics.py +75 -0
- mlonmcu/target/riscv/__init__.py +7 -0
- mlonmcu/target/riscv/etiss_pulpino.py +462 -0
- mlonmcu/target/riscv/gvsoc_pulp.py +215 -0
- mlonmcu/target/riscv/ovpsim.py +301 -0
- mlonmcu/target/riscv/riscv.py +185 -0
- mlonmcu/target/riscv/riscv_qemu.py +166 -0
- mlonmcu/target/riscv/spike.py +243 -0
- mlonmcu/target/riscv/util.py +134 -0
- mlonmcu/target/target.py +200 -0
- mlonmcu/utils.py +49 -0
- mlonmcu/version.py +21 -0
- mlonmcu-0.3.0.dev0.dist-info/LICENSE +202 -0
- mlonmcu-0.3.0.dev0.dist-info/METADATA +343 -0
- mlonmcu-0.3.0.dev0.dist-info/NOTICE +8 -0
- mlonmcu-0.3.0.dev0.dist-info/RECORD +376 -0
- mlonmcu-0.3.0.dev0.dist-info/WHEEL +5 -0
- mlonmcu-0.3.0.dev0.dist-info/entry_points.txt +3 -0
- mlonmcu-0.3.0.dev0.dist-info/top_level.txt +1 -0
- resources/frameworks/tvm/crt_config/README.md +7 -0
- resources/frameworks/tvm/crt_config/crt_config.h +53 -0
- resources/frameworks/tvm/tuning_records/riscv_cpu_v0.01.log.best +46 -0
- resources/patches/fix_esp32c3_march.patch +20 -0
- resources/patches/pulp_freertos_support.patch +55 -0
- resources/platforms/espidf/micro_speech_esp32devboard/CMakeLists.txt +29 -0
- resources/platforms/espidf/micro_speech_esp32devboard/README.md +70 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/CMakeLists.txt +78 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/Kconfig +76 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/default_data.c +26 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/default_model_support/process_input.c +35 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/default_model_support/process_output.c +45 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/include/exit.h +26 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/include/ml_interface.h +70 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/include/printing.h +31 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/ml_interface.c +74 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/ml_interface_tflm.cc +64 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/mlif2/ml_interface_tvm.c +53 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/tflite-lib/CMakeLists.txt +140 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/tflite-lib/Kconfig +8 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/tvm-lib/CMakeLists.txt +66 -0
- resources/platforms/espidf/micro_speech_esp32devboard/components/tvm-lib/Kconfig +7 -0
- resources/platforms/espidf/micro_speech_esp32devboard/example_test.py +38 -0
- resources/platforms/espidf/micro_speech_esp32devboard/info.txt +9 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/CMakeLists.txt +58 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/audio_provider.cc +193 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/audio_provider.h +49 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/command_responder.cc +53 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/command_responder.h +35 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/feature_provider.cc +132 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/feature_provider.cc.orig +145 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/feature_provider.h +55 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/kissfft/COPYING +11 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/kissfft/_kiss_fft_guts.h +168 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/kissfft/kiss_fft.c +408 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/kissfft/kiss_fft.h +124 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/kissfft/tools/kiss_fftr.c +159 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/kissfft/tools/kiss_fftr.h +46 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/main.cc +63 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/main_functions.cc +204 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/main_functions.h +37 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/micro_features_generator.cc +121 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/micro_features_generator.h +38 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/micro_model_settings.cc +23 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/micro_model_settings.h +43 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/bits.h +102 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/fft.cc +52 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/fft.h +50 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/fft_util.cc +69 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/fft_util.h +34 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/filterbank.c +134 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/filterbank.h +63 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/filterbank_util.c +220 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/filterbank_util.h +50 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/frontend.c +72 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/frontend.h +64 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/frontend_util.c +85 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/frontend_util.h +52 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/kiss_fft_common.h +48 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/kiss_fft_int16.cc +8 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/kiss_fft_int16.h +34 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/log_lut.c +30 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/log_lut.h +40 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/log_scale.c +83 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/log_scale.h +39 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/log_scale_util.c +27 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/log_scale_util.h +45 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/noise_reduction.c +51 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/noise_reduction.h +46 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/noise_reduction_util.c +45 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/noise_reduction_util.h +50 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/pcan_gain_control.c +56 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/pcan_gain_control.h +47 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/pcan_gain_control_util.c +92 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/pcan_gain_control_util.h +57 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/window.c +70 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/window.h +49 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/window_util.c +73 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/microfrontend/lib/window_util.h +45 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/pins.c +14 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/pins.h +30 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/recognize_commands.cc +150 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/recognize_commands.h +173 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/ringbuf.c +333 -0
- resources/platforms/espidf/micro_speech_esp32devboard/main/ringbuf.h +74 -0
- resources/platforms/espidf/micro_speech_esp32devboard/sdkconfig.defaults +36 -0
- resources/platforms/espidf/project/CMakeLists.txt +29 -0
- resources/platforms/espidf/project/README.md +70 -0
- resources/platforms/espidf/project/components/mlif/CMakeLists.txt +77 -0
- resources/platforms/espidf/project/components/mlif/Kconfig +76 -0
- resources/platforms/espidf/project/components/mlif/default_data.c +26 -0
- resources/platforms/espidf/project/components/mlif/default_model_support/process_input.c +35 -0
- resources/platforms/espidf/project/components/mlif/default_model_support/process_output.c +45 -0
- resources/platforms/espidf/project/components/mlif/include/exit.h +26 -0
- resources/platforms/espidf/project/components/mlif/include/ml_interface.h +60 -0
- resources/platforms/espidf/project/components/mlif/include/printing.h +31 -0
- resources/platforms/espidf/project/components/mlif/ml_interface.c +54 -0
- resources/platforms/espidf/project/components/mlif/ml_interface_tflm.cc +40 -0
- resources/platforms/espidf/project/components/mlif/ml_interface_tvm.c +40 -0
- resources/platforms/espidf/project/components/tflite-lib/CMakeLists.txt +142 -0
- resources/platforms/espidf/project/components/tflite-lib/Kconfig +8 -0
- resources/platforms/espidf/project/components/tvm-lib/CMakeLists.txt +66 -0
- resources/platforms/espidf/project/components/tvm-lib/Kconfig +7 -0
- resources/platforms/espidf/project/example_test.py +38 -0
- resources/platforms/espidf/project/main/CMakeLists.txt +25 -0
- resources/platforms/espidf/project/main/main.c +57 -0
- resources/platforms/espidf/project/sdkconfig.defaults +26 -0
- resources/platforms/zephyr/project/CMakeLists.txt +22 -0
- resources/platforms/zephyr/project/Kconfig +101 -0
- resources/platforms/zephyr/project/README.rst +33 -0
- resources/platforms/zephyr/project/cmake/AddAllSubdirs.cmake +21 -0
- resources/platforms/zephyr/project/cmake/ChooseTarget.cmake +22 -0
- resources/platforms/zephyr/project/cmake/LinkTFLite.cmake +223 -0
- resources/platforms/zephyr/project/cmake/LinkTVM.cmake +68 -0
- resources/platforms/zephyr/project/cmake/LookupClang.cmake +41 -0
- resources/platforms/zephyr/project/cmake/backends/tflmc.cmake +5 -0
- resources/platforms/zephyr/project/cmake/backends/tflmi.cmake +5 -0
- resources/platforms/zephyr/project/cmake/backends/tvmaot.cmake +10 -0
- resources/platforms/zephyr/project/cmake/backends/tvmaotplus.cmake +10 -0
- resources/platforms/zephyr/project/cmake/backends/tvmcg.cmake +10 -0
- resources/platforms/zephyr/project/cmake/backends/tvmllvm.cmake +8 -0
- resources/platforms/zephyr/project/cmake/backends/tvmrt.cmake +8 -0
- resources/platforms/zephyr/project/cmake/extras.cmake +9 -0
- resources/platforms/zephyr/project/cmake/features/auto_vectorize_gcc.cmake +65 -0
- resources/platforms/zephyr/project/cmake/features/auto_vectorize_llvm.cmake +20 -0
- resources/platforms/zephyr/project/cmake/features/cmsisnn.cmake +86 -0
- resources/platforms/zephyr/project/cmake/features/muriscvnn.cmake +87 -0
- resources/platforms/zephyr/project/cmake/frameworks/tflm.cmake +1 -0
- resources/platforms/zephyr/project/cmake/frameworks/tflm_mlif.cmake +8 -0
- resources/platforms/zephyr/project/cmake/frameworks/tvm.cmake +1 -0
- resources/platforms/zephyr/project/cmake/frameworks/tvm_mlif.cmake +37 -0
- resources/platforms/zephyr/project/lib/CMakeLists.txt +13 -0
- resources/platforms/zephyr/project/lib/drivers/fake_input.c +10 -0
- resources/platforms/zephyr/project/lib/drivers/fake_input.h +8 -0
- resources/platforms/zephyr/project/lib/ml_interface/CMakeLists.txt +31 -0
- resources/platforms/zephyr/project/lib/ml_interface/default_data.c +8 -0
- resources/platforms/zephyr/project/lib/ml_interface/default_model_support/CMakeLists.txt +2 -0
- resources/platforms/zephyr/project/lib/ml_interface/default_model_support/process_input.c +17 -0
- resources/platforms/zephyr/project/lib/ml_interface/default_model_support/process_output.c +27 -0
- resources/platforms/zephyr/project/lib/ml_interface/ml_interface.c +36 -0
- resources/platforms/zephyr/project/lib/ml_interface/ml_interface.h +47 -0
- resources/platforms/zephyr/project/lib/ml_interface/ml_interface_tflm.cc +22 -0
- resources/platforms/zephyr/project/lib/ml_interface/ml_interface_tvm.c +22 -0
- resources/platforms/zephyr/project/lib/support/CMakeLists.txt +2 -0
- resources/platforms/zephyr/project/lib/support/dummy.c +0 -0
- resources/platforms/zephyr/project/lib/support/exit.h +8 -0
- resources/platforms/zephyr/project/lib/support/printing.h +11 -0
- resources/platforms/zephyr/project/lib/support/quantize.h +23 -0
- resources/platforms/zephyr/project/lib/targets/corstone300.c +62 -0
- resources/platforms/zephyr/project/lib/targets/default.c +2 -0
- resources/platforms/zephyr/project/lib/targets/etiss_pulpino.c +112 -0
- resources/platforms/zephyr/project/lib/targets/generic_riscv.c +112 -0
- resources/platforms/zephyr/project/lib/targets/riscv_qemu.c +112 -0
- resources/platforms/zephyr/project/lib/targets/target.h +2 -0
- resources/platforms/zephyr/project/prj.conf +11 -0
- resources/platforms/zephyr/project/sample.yaml +19 -0
- resources/platforms/zephyr/project/src/main.c +71 -0
- resources/platforms/zephyr/project2/CMakeLists.txt +72 -0
- resources/platforms/zephyr/project2/Kconfig +101 -0
- resources/platforms/zephyr/project2/README.rst +33 -0
- resources/platforms/zephyr/project2/cmake/AddAllSubdirs.cmake +21 -0
- resources/platforms/zephyr/project2/cmake/ChooseTarget.cmake +22 -0
- resources/platforms/zephyr/project2/cmake/LinkTFLite.cmake +223 -0
- resources/platforms/zephyr/project2/cmake/LinkTVM.cmake +68 -0
- resources/platforms/zephyr/project2/cmake/LookupClang.cmake +41 -0
- resources/platforms/zephyr/project2/cmake/backends/tflmc.cmake +5 -0
- resources/platforms/zephyr/project2/cmake/backends/tflmi.cmake +5 -0
- resources/platforms/zephyr/project2/cmake/backends/tvmaot.cmake +10 -0
- resources/platforms/zephyr/project2/cmake/backends/tvmaotplus.cmake +10 -0
- resources/platforms/zephyr/project2/cmake/backends/tvmcg.cmake +10 -0
- resources/platforms/zephyr/project2/cmake/backends/tvmllvm.cmake +8 -0
- resources/platforms/zephyr/project2/cmake/backends/tvmrt.cmake +8 -0
- resources/platforms/zephyr/project2/cmake/extras.cmake +9 -0
- resources/platforms/zephyr/project2/cmake/features/auto_vectorize_gcc.cmake +65 -0
- resources/platforms/zephyr/project2/cmake/features/auto_vectorize_llvm.cmake +20 -0
- resources/platforms/zephyr/project2/cmake/features/cmsisnn.cmake +86 -0
- resources/platforms/zephyr/project2/cmake/features/muriscvnn.cmake +87 -0
- resources/platforms/zephyr/project2/cmake/frameworks/tflm.cmake +1 -0
- resources/platforms/zephyr/project2/cmake/frameworks/tflm_mlif.cmake +8 -0
- resources/platforms/zephyr/project2/cmake/frameworks/tvm.cmake +1 -0
- resources/platforms/zephyr/project2/cmake/frameworks/tvm_mlif.cmake +37 -0
- resources/platforms/zephyr/project2/default_data.c +8 -0
- resources/platforms/zephyr/project2/default_model_support/CMakeLists.txt +3 -0
- resources/platforms/zephyr/project2/default_model_support/process_input.c +17 -0
- resources/platforms/zephyr/project2/default_model_support/process_output.c +27 -0
- resources/platforms/zephyr/project2/lib/CMakeLists.txt +13 -0
- resources/platforms/zephyr/project2/lib/drivers/fake_input.c +10 -0
- resources/platforms/zephyr/project2/lib/drivers/fake_input.h +8 -0
- resources/platforms/zephyr/project2/lib/support/CMakeLists.txt +2 -0
- resources/platforms/zephyr/project2/lib/support/dummy.c +0 -0
- resources/platforms/zephyr/project2/lib/support/exit.h +8 -0
- resources/platforms/zephyr/project2/lib/support/printing.h +11 -0
- resources/platforms/zephyr/project2/lib/support/quantize.h +23 -0
- resources/platforms/zephyr/project2/lib/targets/corstone300.c +62 -0
- resources/platforms/zephyr/project2/lib/targets/default.c +2 -0
- resources/platforms/zephyr/project2/lib/targets/etiss_pulpino.c +112 -0
- resources/platforms/zephyr/project2/lib/targets/generic_riscv.c +112 -0
- resources/platforms/zephyr/project2/lib/targets/riscv_qemu.c +112 -0
- resources/platforms/zephyr/project2/lib/targets/target.h +2 -0
- resources/platforms/zephyr/project2/ml_interface.c +36 -0
- resources/platforms/zephyr/project2/ml_interface.h +47 -0
- resources/platforms/zephyr/project2/ml_interface_tflm.cc +22 -0
- resources/platforms/zephyr/project2/ml_interface_tvm.c +22 -0
- resources/platforms/zephyr/project2/prj.conf +13 -0
- resources/platforms/zephyr/project2/sample.yaml +19 -0
- resources/platforms/zephyr/project2/settings.json +6 -0
- resources/platforms/zephyr/project2/src/main.c +35 -0
- resources/pycharm/.run/README.md +73 -0
- resources/pycharm/.run/step1_ init env.run.xml +24 -0
- resources/pycharm/.run/step2_ setup.run.xml +25 -0
- resources/pycharm/.run/step3_ run resnet on pulpxpulpissimo.run.xml +25 -0
- resources/templates/default.yml.j2 +258 -0
- resources/templates/dev.yml.j2 +212 -0
- resources/templates/minimal.yml.j2 +234 -0
- resources/templates/phi.yml.j2 +282 -0
- resources/templates/pulp.yml.j2 +267 -0
- resources/templates/research.yml.j2 +237 -0
- resources/templates/tumeda.yml.j2 +239 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
commit 1ac774cd01c6be140f728696c48c3c2466157158
|
|
2
|
+
Author: Philipp van Kempen <philipp.van-kempen@tum.de>
|
|
3
|
+
Date: Mon Aug 8 16:22:38 2022 +0200
|
|
4
|
+
|
|
5
|
+
esp32c3 related fix: missing _zicsr support
|
|
6
|
+
|
|
7
|
+
diff --git a/tools/cmake/toolchain-esp32c3.cmake b/tools/cmake/toolchain-esp32c3.cmake
|
|
8
|
+
index 012d93d07..4fac9cefa 100644
|
|
9
|
+
--- a/tools/cmake/toolchain-esp32c3.cmake
|
|
10
|
+
+++ b/tools/cmake/toolchain-esp32c3.cmake
|
|
11
|
+
@@ -5,6 +5,6 @@ set(CMAKE_SYSTEM_NAME Generic)
|
|
12
|
+
# set(CMAKE_CXX_COMPILER riscv32-esp-elf-g++)
|
|
13
|
+
# set(CMAKE_ASM_COMPILER riscv32-esp-elf-gcc)
|
|
14
|
+
|
|
15
|
+
-set(CMAKE_C_FLAGS "-march=rv32imc" CACHE STRING "C Compiler Base Flags")
|
|
16
|
+
-set(CMAKE_CXX_FLAGS "-march=rv32imc" CACHE STRING "C++ Compiler Base Flags")
|
|
17
|
+
-set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -march=rv32imc --specs=nosys.specs" CACHE STRING "Linker Base Flags")
|
|
18
|
+
+set(CMAKE_C_FLAGS "-march=rv32imc_zicsr" CACHE STRING "C Compiler Base Flags")
|
|
19
|
+
+set(CMAKE_CXX_FLAGS "-march=rv32imc_zicsr" CACHE STRING "C++ Compiler Base Flags")
|
|
20
|
+
+set(CMAKE_EXE_LINKER_FLAGS "-nostartfiles -march=rv32imc_zicsr --specs=nosys.specs" CACHE STRING "Linker Base Flags")
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
diff --git a/support/support.mk b/support/support.mk
|
|
2
|
+
index 6b22f93..fc128b4 100644
|
|
3
|
+
--- a/support/support.mk
|
|
4
|
+
+++ b/support/support.mk
|
|
5
|
+
@@ -17,26 +17,27 @@
|
|
6
|
+
|
|
7
|
+
# Try to build a full dependency tree for all libraries
|
|
8
|
+
|
|
9
|
+
+SUPPORT_INSTALL_DIR ?= $(SUPPORT_ROOT)/install
|
|
10
|
+
SUPPORT_LIB_DIR = $(SUPPORT_ROOT)/install/lib
|
|
11
|
+
|
|
12
|
+
$(SUPPORT_LIB_DIR)/libjson.a: \
|
|
13
|
+
$(shell find "$(SUPPORT_ROOT)/json-tools" -name '*.cpp' -o -name '*.hpp')
|
|
14
|
+
- INSTALL_DIR="$(SUPPORT_ROOT)/install" $(MAKE) -C "$(SUPPORT_ROOT)/json-tools" all install
|
|
15
|
+
+ INSTALL_DIR="$(SUPPORT_INSTALL_DIR)" $(MAKE) -C "$(SUPPORT_ROOT)/json-tools" all install
|
|
16
|
+
|
|
17
|
+
$(SUPPORT_LIB_DIR)/libpulpdebugbridge.so: $(SUPPORT_LIB_DIR)/libjson.a \
|
|
18
|
+
$(shell find "$(SUPPORT_ROOT)/pulp-debug-bridge" -name '*.cpp' -o -name '*.hpp')
|
|
19
|
+
- INSTALL_DIR="$(SUPPORT_ROOT)/install" $(MAKE) -C "$(SUPPORT_ROOT)/pulp-debug-bridge" build
|
|
20
|
+
+ INSTALL_DIR="$(SUPPORT_INSTALL_DIR)" $(MAKE) -C "$(SUPPORT_ROOT)/pulp-debug-bridge" build
|
|
21
|
+
|
|
22
|
+
$(SUPPORT_LIB_DIR)/libpulpperiph.so $(SUPPORT_LIB_DIR)/libpulpdpi.so: \
|
|
23
|
+
$(SUPPORT_LIB_DIR)/libjson.a $(SUPPORT_LIB_DIR)/libpulpdebugbridge.so \
|
|
24
|
+
$(shell find "$(SUPPORT_ROOT)/dpi-models" -name '*.cpp' -o -name '*.hpp')
|
|
25
|
+
- INSTALL_DIR="$(SUPPORT_ROOT)/install" $(MAKE) -C "$(SUPPORT_ROOT)/dpi-models" build
|
|
26
|
+
+ INSTALL_DIR="$(SUPPORT_INSTALL_DIR)" $(MAKE) -C "$(SUPPORT_ROOT)/dpi-models" build
|
|
27
|
+
|
|
28
|
+
-$(SUPPORT_ROOT)/install/bin/plpinfo:
|
|
29
|
+
- INSTALL_DIR="$(SUPPORT_ROOT)/install" $(MAKE) -C "$(SUPPORT_ROOT)/pulp-configs" all_scons
|
|
30
|
+
+$(SUPPORT_INSTALL_DIR)/bin/plpinfo:
|
|
31
|
+
+ INSTALL_DIR="$(SUPPORT_INSTALL_DIR)" $(MAKE) -C "$(SUPPORT_ROOT)/pulp-configs" all_scons
|
|
32
|
+
|
|
33
|
+
-$(SUPPORT_ROOT)/install/bin/plp_mkflash:
|
|
34
|
+
- INSTALL_DIR="$(SUPPORT_ROOT)/install" $(MAKE) -C "$(SUPPORT_ROOT)/runner" sdk.build
|
|
35
|
+
+$(SUPPORT_INSTALL_DIR)/bin/plp_mkflash:
|
|
36
|
+
+ INSTALL_DIR="$(SUPPORT_INSTALL_DIR)" $(MAKE) -C "$(SUPPORT_ROOT)/runner" sdk.build
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Build the gvsoc simulator
|
|
40
|
+
@@ -45,12 +46,12 @@ gvsoc: $(addprefix $(SUPPORT_LIB_DIR)/,libpulpvp.so libpulpvplauncher.so libpulp
|
|
41
|
+
# TODO: fix build configuration per chip thing
|
|
42
|
+
$(addprefix $(SUPPORT_LIB_DIR)/,libpulpvp.so libpulpvplauncher.so libpulpvp-debug.so): \
|
|
43
|
+
$(SUPPORT_LIB_DIR)/libjson.a $(SUPPORT_LIB_DIR)/libpulpdpi.so \
|
|
44
|
+
-$(SUPPORT_ROOT)/install/bin/plpinfo $(SUPPORT_ROOT)/install/bin/plp_mkflash \
|
|
45
|
+
+$(SUPPORT_INSTALL_DIR)/bin/plpinfo $(SUPPORT_INSTALL_DIR)/bin/plp_mkflash \
|
|
46
|
+
$(shell find "$(SUPPORT_ROOT)/gvsoc" -name '*.cpp' -o -name '*.hpp' -o -name '*.py')
|
|
47
|
+
PULP_CURRENT_CONFIG=pulp@config_file=chips/pulp/pulp.json \
|
|
48
|
+
PULP_CONFIGS_PATH=$(SUPPORT_ROOT)/pulp-configs/configs \
|
|
49
|
+
- PYTHONPATH=$(SUPPORT_ROOT)/install/python \
|
|
50
|
+
- INSTALL_DIR="$(SUPPORT_ROOT)/install" \
|
|
51
|
+
+ PYTHONPATH=$(SUPPORT_INSTALL_DIR)/python \
|
|
52
|
+
+ INSTALL_DIR="$(SUPPORT_INSTALL_DIR)" \
|
|
53
|
+
$(MAKE) -C "$(SUPPORT_ROOT)/gvsoc" build ARCHI_DIR=$(SUPPORT_ROOT)/archi/include
|
|
54
|
+
|
|
55
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#[[
|
|
2
|
+
Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
|
|
4
|
+
This file is part of MLonMCU.
|
|
5
|
+
See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
]]
|
|
19
|
+
|
|
20
|
+
# The following lines of boilerplate have to be in your project's
|
|
21
|
+
# CMakeLists in this exact order for cmake to work correctly
|
|
22
|
+
cmake_minimum_required(VERSION 3.5)
|
|
23
|
+
|
|
24
|
+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
set(COMPONENTS )
|
|
28
|
+
|
|
29
|
+
project(app)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
|
|
4
|
+
This file is part of MLonMCU.
|
|
5
|
+
See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-->
|
|
19
|
+
# Hello World Example
|
|
20
|
+
|
|
21
|
+
Starts a FreeRTOS task to print "Hello World".
|
|
22
|
+
|
|
23
|
+
(See the README.md file in the upper level 'examples' directory for more information about examples.)
|
|
24
|
+
|
|
25
|
+
## How to use example
|
|
26
|
+
|
|
27
|
+
Follow detailed instructions provided specifically for this example.
|
|
28
|
+
|
|
29
|
+
Select the instructions depending on Espressif chip installed on your development board:
|
|
30
|
+
|
|
31
|
+
- [ESP32 Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/index.html)
|
|
32
|
+
- [ESP32-S2 Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Example folder contents
|
|
36
|
+
|
|
37
|
+
The project **hello_world** contains one source file in C language [hello_world_main.c](main/hello_world_main.c). The file is located in folder [main](main).
|
|
38
|
+
|
|
39
|
+
ESP-IDF projects are built using CMake. The project build configuration is contained in `CMakeLists.txt` files that provide set of directives and instructions describing the project's source files and targets (executable, library, or both).
|
|
40
|
+
|
|
41
|
+
Below is short explanation of remaining files in the project folder.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
├── CMakeLists.txt
|
|
45
|
+
├── example_test.py Python script used for automated example testing
|
|
46
|
+
├── main
|
|
47
|
+
│ ├── CMakeLists.txt
|
|
48
|
+
│ ├── component.mk Component make file
|
|
49
|
+
│ └── hello_world_main.c
|
|
50
|
+
├── Makefile Makefile used by legacy GNU Make
|
|
51
|
+
└── README.md This is the file you are currently reading
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For more information on structure and contents of ESP-IDF projects, please refer to Section [Build System](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html) of the ESP-IDF Programming Guide.
|
|
55
|
+
|
|
56
|
+
## Troubleshooting
|
|
57
|
+
|
|
58
|
+
* Program upload failure
|
|
59
|
+
|
|
60
|
+
* Hardware connection is not correct: run `idf.py -p PORT monitor`, and reboot your board to see if there are any output logs.
|
|
61
|
+
* The baud rate for downloading is too high: lower your baud rate in the `menuconfig` menu, and try again.
|
|
62
|
+
|
|
63
|
+
## Technical support and feedback
|
|
64
|
+
|
|
65
|
+
Please use the following feedback channels:
|
|
66
|
+
|
|
67
|
+
* For technical queries, go to the [esp32.com](https://esp32.com/) forum
|
|
68
|
+
* For a feature request or bug report, create a [GitHub issue](https://github.com/espressif/esp-idf/issues)
|
|
69
|
+
|
|
70
|
+
We will get back to you as soon as possible.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#[[
|
|
2
|
+
Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
|
|
4
|
+
This file is part of MLonMCU.
|
|
5
|
+
See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
]]
|
|
19
|
+
|
|
20
|
+
SET(MLONMCU_CODEGEN_DIR ${CONFIG_MLONMCU_CODEGEN_DIR})
|
|
21
|
+
SET(MLONMCU_FRAMEWORK ${CONFIG_MLONMCU_FRAMEWORK})
|
|
22
|
+
SET(MLONMCU_BACKEND ${CONFIG_MLONMCU_BACKEND})
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
SET(MLIF_SRCS ml_interface.c)
|
|
26
|
+
SET(CODEGEN_INCS ${MLONMCU_CODEGEN_DIR})
|
|
27
|
+
IF("${MLONMCU_FRAMEWORK}" STREQUAL "tflm")
|
|
28
|
+
SET(LIB_NAME tflite-lib)
|
|
29
|
+
LIST(APPEND MLIF_SRCS ml_interface_tflm.cc)
|
|
30
|
+
FILE(GLOB CODEGEN_SRCS
|
|
31
|
+
${MLONMCU_CODEGEN_DIR}/*.cc
|
|
32
|
+
${MLONMCU_CODEGEN_DIR}/*.c
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
ELSEIF("${MLONMCU_FRAMEWORK}" STREQUAL "tvm")
|
|
36
|
+
SET(LIB_NAME tvm-lib)
|
|
37
|
+
LIST(APPEND MLIF_SRCS ml_interface_tvm.c)
|
|
38
|
+
FILE(GLOB CODEGEN_SRCS
|
|
39
|
+
${MLONMCU_CODEGEN_DIR}/codegen/host/src/*.c
|
|
40
|
+
${MLONMCU_CODEGEN_DIR}/codegen/host/src/*.cc
|
|
41
|
+
)
|
|
42
|
+
IF(EXISTS ${MLONMCU_CODEGEN_DIR}/codegen/host/include/)
|
|
43
|
+
LIST(APPEND CODEGEN_INCS ${MLONMCU_CODEGEN_DIR}/codegen/host/include/)
|
|
44
|
+
ENDIF()
|
|
45
|
+
|
|
46
|
+
IF ("${MLONMCU_BACKEND}" STREQUAL "tvmaot")
|
|
47
|
+
LIST(APPEND CODEGEN_SRCS ${MLONMCU_CODEGEN_DIR}/aot_wrapper.c)
|
|
48
|
+
ELSEIF ("${MLONMCU_BACKEND}" STREQUAL "tvmrt")
|
|
49
|
+
LIST(APPEND CODEGEN_SRCS ${MLONMCU_CODEGEN_DIR}/rt_wrapper.c)
|
|
50
|
+
ELSEIF ("${MLONMCU_BACKEND}" STREQUAL "tvmcg")
|
|
51
|
+
LIST(APPEND CODEGEN_SRCS ${MLONMCU_CODEGEN_DIR}/staticrt.c)
|
|
52
|
+
ELSE()
|
|
53
|
+
MESSAGE(WARNING "Invalid Backend: ${MLONMCU_BACKEND}")
|
|
54
|
+
ENDIF()
|
|
55
|
+
ELSE()
|
|
56
|
+
MESSAGE(WARNING "Invalid Framework: ${MLONMCU_FRAMEWORK}")
|
|
57
|
+
SET(LIB_NAME tflite-lib tvm-lib)
|
|
58
|
+
ENDIF()
|
|
59
|
+
|
|
60
|
+
# SET(MODEL_SUPPORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/default_model_support)
|
|
61
|
+
# SET(MODEL_SUPPORT_SRCS
|
|
62
|
+
# ${MODEL_SUPPORT_DIR}/process_input.c
|
|
63
|
+
# ${MODEL_SUPPORT_DIR}/process_output.c
|
|
64
|
+
# )
|
|
65
|
+
# SET(DATA_SRC ${CMAKE_CURRENT_SOURCE_DIR}/default_data.c)
|
|
66
|
+
|
|
67
|
+
# idf_component_register(SRCS ${CODEGEN_SRCS} ${MLIF_SRCS} ${MODEL_SUPPORT_SRCS} ${DATA_SRC}
|
|
68
|
+
# INCLUDE_DIRS ${CODEGEN_INCS} ${MODEL_SUPPORT_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
69
|
+
# REQUIRES ${LIB_NAME})
|
|
70
|
+
# SET(MLIF_EXTRA_INCS
|
|
71
|
+
# ${CMAKE_CURRENT_SOURCE_DIR}/${MLONMCU_FRAMEWORK}
|
|
72
|
+
# )
|
|
73
|
+
|
|
74
|
+
idf_component_register(SRCS ${CODEGEN_SRCS} ${MLIF_SRCS}
|
|
75
|
+
INCLUDE_DIRS ${CODEGEN_INCS} ${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
76
|
+
REQUIRES ${LIB_NAME})
|
|
77
|
+
|
|
78
|
+
# target_compile_definitions(${COMPONENT_LIB} PUBLIC NUM_RUNS=${NUM_RUNS})
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
menu "MLonMCU Options"
|
|
2
|
+
|
|
3
|
+
config MLONMCU_CODEGEN_DIR
|
|
4
|
+
string "Codegen Directory"
|
|
5
|
+
default "$(CODEGEN_SRC)"
|
|
6
|
+
help
|
|
7
|
+
Path to the directory with the codegen results.
|
|
8
|
+
|
|
9
|
+
choice MLONMCU_FRAMEWORK
|
|
10
|
+
prompt "MLonMCU framework"
|
|
11
|
+
default MLONMCU_FRAMEWORK_TFLM
|
|
12
|
+
help
|
|
13
|
+
Choose a MLonMCU framework from the list.
|
|
14
|
+
|
|
15
|
+
config MLONMCU_FRAMEWORK_TFLM
|
|
16
|
+
bool "TFLite Micro"
|
|
17
|
+
config MLONMCU_FRAMEWORK_TVM
|
|
18
|
+
bool "TVM"
|
|
19
|
+
endchoice
|
|
20
|
+
|
|
21
|
+
config MLONMCU_FRAMEWORK
|
|
22
|
+
string
|
|
23
|
+
default "tflm" if MLONMCU_FRAMEWORK_TFLM
|
|
24
|
+
default "tvm" if MLONMCU_FRAMEWORK_TVM
|
|
25
|
+
|
|
26
|
+
choice MLONMCU_BACKEND
|
|
27
|
+
prompt "MLonMCU backend"
|
|
28
|
+
default MLONMCU_BACKEND_TFLMI if MLONMCU_FRAMEWORK_TFLM
|
|
29
|
+
default MLONMCU_BACKEND_TVMAOT if MLONMCU_FRAMEWORK_TVM
|
|
30
|
+
help
|
|
31
|
+
Choose a MLonMCU backend for the chosen framwork.
|
|
32
|
+
|
|
33
|
+
config MLONMCU_BACKEND_TFLMI
|
|
34
|
+
bool "TFLite Micro Default Interpreter"
|
|
35
|
+
depends on MLONMCU_FRAMEWORK_TFLM
|
|
36
|
+
config MLONMCU_BACKEND_TFLMC
|
|
37
|
+
bool "TFLite Micro Compiler"
|
|
38
|
+
depends on MLONMCU_FRAMEWORK_TFLM
|
|
39
|
+
config MLONMCU_BACKEND_TVMAOT
|
|
40
|
+
bool "TVM AoT Executor"
|
|
41
|
+
depends on MLONMCU_FRAMEWORK_TVM
|
|
42
|
+
config MLONMCU_BACKEND_TVMRT
|
|
43
|
+
bool "TVM Graph Executor"
|
|
44
|
+
depends on MLONMCU_FRAMEWORK_TVM
|
|
45
|
+
config MLONMCU_BACKEND_TVMCG
|
|
46
|
+
bool "TVM Custom Codegenerator"
|
|
47
|
+
depends on MLONMCU_FRAMEWORK_TVM
|
|
48
|
+
endchoice
|
|
49
|
+
|
|
50
|
+
config MLONMCU_BACKEND
|
|
51
|
+
string
|
|
52
|
+
default "tflmi" if MLONMCU_BACKEND_TFLMI
|
|
53
|
+
default "tflmc" if MLONMCU_BACKEND_TFLMC
|
|
54
|
+
default "tvmaot" if MLONMCU_BACKEND_TVMAOT
|
|
55
|
+
default "tvmrt" if MLONMCU_BACKEND_TVMRT
|
|
56
|
+
default "tvmcg" if MLONMCU_BACKEND_TVMCG
|
|
57
|
+
|
|
58
|
+
config MLONMCU_NUM_RUNS
|
|
59
|
+
int "Number of inferences"
|
|
60
|
+
default 1
|
|
61
|
+
help
|
|
62
|
+
How many times the network should be invoked. A negative value maps to a infinite number of runs.
|
|
63
|
+
|
|
64
|
+
config MLONMCU_VALIDATE
|
|
65
|
+
bool "Validate model output data"
|
|
66
|
+
default false
|
|
67
|
+
help
|
|
68
|
+
Compare model outputs with expected results (if available). Only works in DEBUG mode.
|
|
69
|
+
|
|
70
|
+
config MLONMCU_MODLE_DIR
|
|
71
|
+
string "Model Directory"
|
|
72
|
+
depends on MLONMCU_VALIDATE
|
|
73
|
+
default "$(MODEL_DIR)"
|
|
74
|
+
help
|
|
75
|
+
Directory where model support code and reference data can be found.
|
|
76
|
+
endmenu
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of MLonMCU.
|
|
5
|
+
* See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
#include "ml_interface.h"
|
|
20
|
+
#include <stddef.h>
|
|
21
|
+
const int num_data_buffers_in = 0;
|
|
22
|
+
const int num_data_buffers_out = 0;
|
|
23
|
+
const unsigned char *const data_buffers_in[] = {};
|
|
24
|
+
const unsigned char *const data_buffers_out[] = {};
|
|
25
|
+
const size_t data_size_in[] = {};
|
|
26
|
+
const size_t data_size_out[] = {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of MLonMCU.
|
|
5
|
+
* See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
#include <stdlib.h>
|
|
20
|
+
#include <memory.h>
|
|
21
|
+
|
|
22
|
+
#include "printing.h"
|
|
23
|
+
#include "exit.h"
|
|
24
|
+
|
|
25
|
+
void mlif_process_input(const void *in_data, size_t in_size, void *model_input_ptr, size_t model_input_sz) {
|
|
26
|
+
if (in_size != 0) {
|
|
27
|
+
if (in_size != model_input_sz) {
|
|
28
|
+
DBGPRINTF("MLIF: Given input size (%lu) does not match model input buffer size (%lu)!\n", in_size,
|
|
29
|
+
model_input_sz);
|
|
30
|
+
exit(EXIT_MLIF_INVALID_SIZE);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
memcpy(model_input_ptr, in_data, in_size);
|
|
35
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of MLonMCU.
|
|
5
|
+
* See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
#include <stdlib.h>
|
|
20
|
+
#include <memory.h>
|
|
21
|
+
|
|
22
|
+
#include "printing.h"
|
|
23
|
+
#include "exit.h"
|
|
24
|
+
|
|
25
|
+
void mlif_process_output(void *model_output_ptr, size_t model_output_sz, const void *expected_out_data,
|
|
26
|
+
size_t expected_out_size) {
|
|
27
|
+
#ifdef _DEBUG
|
|
28
|
+
if (model_output_sz >= 4) {
|
|
29
|
+
DBGPRINTF("MLIF: First float of output: %f\n", *(float *)model_output_ptr);
|
|
30
|
+
}
|
|
31
|
+
DBGPRINTF("MLIF: Model output data: ");
|
|
32
|
+
for (size_t i = 0; i < model_output_sz; i++) {
|
|
33
|
+
DBGPRINTF("\\x%02X", ((unsigned char *)model_output_ptr)[i]);
|
|
34
|
+
fflush(0);
|
|
35
|
+
}
|
|
36
|
+
DBGPRINTF("\n");
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
if (model_output_sz == expected_out_size && memcmp(model_output_ptr, expected_out_data, model_output_sz) == 0) {
|
|
40
|
+
DBGPRINTF("MLIF: Output data matches expected data\n");
|
|
41
|
+
} else {
|
|
42
|
+
DBGPRINTF("MLIF: Wrong output data!\n");
|
|
43
|
+
exit(EXIT_MLIF_MISSMATCH);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of MLonMCU.
|
|
5
|
+
* See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
#ifndef SUPPORT_EXIT_H
|
|
20
|
+
#define SUPPORT_EXIT_H
|
|
21
|
+
|
|
22
|
+
#define EXIT_MLIF_BASE (0x10)
|
|
23
|
+
#define EXIT_MLIF_INVALID_SIZE (EXIT_MLIF_BASE + 1)
|
|
24
|
+
#define EXIT_MLIF_MISSMATCH (EXIT_MLIF_BASE + 2)
|
|
25
|
+
|
|
26
|
+
#endif // SUPPORT_EXIT_H
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of MLonMCU.
|
|
5
|
+
* See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
#ifndef ML_INTERFACE_H
|
|
20
|
+
#define ML_INTERFACE_H
|
|
21
|
+
|
|
22
|
+
#include <stddef.h>
|
|
23
|
+
#include <stdbool.h>
|
|
24
|
+
|
|
25
|
+
#ifndef NUM_RUNS
|
|
26
|
+
#define NUM_RUNS 1
|
|
27
|
+
#endif /* NUM_RUNS */
|
|
28
|
+
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
extern "C" {
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
// TODO: docs
|
|
34
|
+
void mlif_init();
|
|
35
|
+
void *mlif_input_ptr(int index);
|
|
36
|
+
size_t mlif_input_size(int index);
|
|
37
|
+
size_t mlif_inputs();
|
|
38
|
+
void mlif_invoke();
|
|
39
|
+
void *mlif_output_ptr(int index);
|
|
40
|
+
size_t mlif_output_size(int index);
|
|
41
|
+
size_t mlif_outputs();
|
|
42
|
+
|
|
43
|
+
void mlif_run(void);
|
|
44
|
+
|
|
45
|
+
// These can be overridden by use code.
|
|
46
|
+
|
|
47
|
+
// Provides input data for the model. The default implementation retrieves input from
|
|
48
|
+
// the global variables below and fills the model input with mlif_process_input.
|
|
49
|
+
bool mlif_request_input(void *model_input_ptr, size_t model_input_sz);
|
|
50
|
+
// Is called when the output data is available. The default implementation
|
|
51
|
+
void mlif_handle_result(void *model_output_ptr, size_t model_output_sz);
|
|
52
|
+
|
|
53
|
+
// Callback for any preprocessing on the input data. Responsible for copying the data.
|
|
54
|
+
void mlif_process_input(const void *in_data, size_t in_size, void *model_input_ptr, size_t model_input_sz);
|
|
55
|
+
// Callback for any postprocessing on the output data. The default implementation prints
|
|
56
|
+
// the output and verifies consistency with the expected output.
|
|
57
|
+
void mlif_process_output(void *model_output_ptr, size_t model_output_sz, const void *expected_out_data, size_t expected_out_size);
|
|
58
|
+
|
|
59
|
+
extern const int num_data_buffers_in;
|
|
60
|
+
extern const int num_data_buffers_out;
|
|
61
|
+
extern const unsigned char * const data_buffers_in[];
|
|
62
|
+
extern const unsigned char * const data_buffers_out[];
|
|
63
|
+
extern const size_t data_size_in[];
|
|
64
|
+
extern const size_t data_size_out[];
|
|
65
|
+
|
|
66
|
+
#ifdef __cplusplus
|
|
67
|
+
}
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
#endif
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of MLonMCU.
|
|
5
|
+
* See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
#ifndef SUPPORT_PRINTING_H
|
|
20
|
+
#define SUPPORT_PRINTING_H
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
#ifdef _DEBUG
|
|
24
|
+
#include <stdio.h>
|
|
25
|
+
#define DBGPRINTF(format, ...) printf(format, ##__VA_ARGS__)
|
|
26
|
+
#else
|
|
27
|
+
#define DBGPRINTF(format, ...)
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#endif
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of MLonMCU.
|
|
5
|
+
* See https://github.com/tum-ei-eda/mlonmcu.git for further info.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
#include "ml_interface.h"
|
|
20
|
+
#include "printing.h"
|
|
21
|
+
|
|
22
|
+
#include <string.h>
|
|
23
|
+
#include <stdlib.h>
|
|
24
|
+
|
|
25
|
+
void mlif_run() {
|
|
26
|
+
mlif_init();
|
|
27
|
+
|
|
28
|
+
size_t input_num = 0;
|
|
29
|
+
size_t remaining = NUM_RUNS;
|
|
30
|
+
// inout data will only be applied in the first run!
|
|
31
|
+
while (mlif_request_input(mlif_input_ptr(input_num), mlif_input_size(input_num)) || remaining) {
|
|
32
|
+
if (input_num == mlif_inputs() - 1) {
|
|
33
|
+
mlif_invoke();
|
|
34
|
+
for (size_t i = 0; i < mlif_outputs(); i++) {
|
|
35
|
+
mlif_handle_result(mlif_output_ptr(i), mlif_output_size(i));
|
|
36
|
+
}
|
|
37
|
+
input_num = 0;
|
|
38
|
+
remaining = remaining > 0 ? remaining - 1 : 0;
|
|
39
|
+
} else {
|
|
40
|
+
input_num++;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
__attribute__((weak)) bool mlif_request_input(void *model_input_ptr, size_t model_input_sz) {
|
|
46
|
+
static int num_done = 0;
|
|
47
|
+
if (num_done == num_data_buffers_in) {
|
|
48
|
+
static bool run_once = true;
|
|
49
|
+
if (num_data_buffers_in == 0 && run_once) {
|
|
50
|
+
// Minimal run. Just run the model without data.
|
|
51
|
+
run_once = false;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
mlif_process_input(data_buffers_in[num_done], data_size_in[num_done], model_input_ptr, model_input_sz);
|
|
58
|
+
num_done++;
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
__attribute__((weak)) void mlif_handle_result(void *model_output_ptr, size_t model_output_sz) {
|
|
63
|
+
static int num_done = 0;
|
|
64
|
+
|
|
65
|
+
if (num_data_buffers_out == 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (num_done < num_data_buffers_out) {
|
|
70
|
+
mlif_process_output(model_output_ptr, model_output_sz, data_buffers_out[num_done], data_size_out[num_done]);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
num_done++;
|
|
74
|
+
}
|