tum-ei-eda / transform_allocs_static

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

A sum of python and C++ scripts to attach for embedded solutions on TFLite to analyze dynamic and avoid memory allocations, as decribed in this figure. transform_allocs_static_workflow

Requirements

  • newlib (modified and compiled with extra hook options) !update link to fork/downloadables!
  • python (tested on 3.7)
  • Libre Office, or any .xlsx file editor
  • C++11 or newer.

Who's who?

/python : Python scripts to run and analyze data cought from the hooks running in a specific mode. Read more inside.

/C : .cc and .h to include to enable custom malloc(), free() hooks on the C Library. Read more inside.

pics: Images used for README.md. (added to .gitignore)

tflite: Tensorflow Lite Micro (TFLite) optimized audio operators (MFCC and audio_spectrogram)

Getting started

To start using the scripts, clone the repo to a local dir.

  1. Place the c files into your TFLlite's main.cpp dir. (Complete CMakeLists.txt/Linker accordingly)
  2. Include the header files into your main.cpp to be used by the built TFLite bin.
  3. (Optional) If also using the above mentioned TFLite ops, please copy the files into tf/tflite/micro/kernel/
  4. Comment the line inside malloc_hook.h to start in default mode: (If already done skip.)
#define _STATIC_MALLOC
  1. Introduce memory hooks into main.cpp
  2. Compile (preferably in DEBUG mode) and run.
  3. Copy the important data into the clipboard.
  4. Use the python scripts in /python to analyze the memory data and generate offsets.
  5. Copy the offsets into malloc_array.cc
  6. Comment out the same line from step 4. to start in STATIC MODE.
  7. Compile and run.
  8. If uncontent with the results, repeat from step 4.

note: Inside each folder is a more extensive README concerning each theme. Please read carefully.

About

License:Apache License 2.0


Languages

Language:C++ 75.9%Language:Python 22.7%Language:C 1.4%