diff --git a/tensorflow/lite/micro/cortex_m_generic/README.md b/tensorflow/lite/micro/cortex_m_generic/README.md index c76483c79e9..da502c93a5e 100644 --- a/tensorflow/lite/micro/cortex_m_generic/README.md +++ b/tensorflow/lite/micro/cortex_m_generic/README.md @@ -1,3 +1,5 @@ +<!-- mdformat off(b/169948621#comment2) --> + # Generic Cortex-Mx customizations The customization requires a definition where the debug log goes to. The purpose @@ -13,42 +15,50 @@ See debug_log_callback.h # How to build -Required parameters: - TARGET: cortex_m_generic - TARGET_ARCH: cortex-mXX (For -all options see: -tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc) +Required parameters: -Optional parameters: - TOOLCHAIN: armgcc (default) or armmclang - For -Cortex-M55, ARM Compiler 6.14 or later is required. + - TARGET: cortex_m_generic + - TARGET_ARCH: cortex-mXX (For all options see: tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc) + +Optional parameters: + + - TOOLCHAIN: armgcc (default) or armmclang + - For Cortex-M55, ARM Compiler 6.14 or later is required. Some examples: -Building with arm-gcc ``` make -f tensorflow/lite/micro/tools/make/Makefile -TARGET=cortex_m_generic TARGET_ARCH=cortex-m7 microlite make -f -tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic -TARGET_ARCH=cortex-m7 TAGS=cmsis-nn microlite +Building with arm-gcc +``` +make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m7 microlite +make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m7 TAGS=cmsis-nn microlite -make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic -TARGET_ARCH=cortex-m4 TAGS=cmsis-nn microlite make -f -tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic -TARGET_ARCH=cortex-m4+fp TAGS=cmsis-nn microlite ``` +make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m4 TAGS=cmsis-nn microlite +make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m4+fp TAGS=cmsis-nn microlite +``` -Building with armclang `make -f tensorflow/lite/micro/tools/make/Makefile -TOOLCHAIN=armclang TARGET=cortex_m_generic TARGET_ARCH=cortex-m55 microlite make --f tensorflow/lite/micro/tools/make/Makefile TOOLCHAIN=armclang -TARGET=cortex_m_generic TARGET_ARCH=cortex-m55 TAGS=cmsis-nn microlite make -f -tensorflow/lite/micro/tools/make/Makefile TOOLCHAIN=armclang -TARGET=cortex_m_generic TARGET_ARCH=cortex-m55+nofp TAGS=cmsis-nn microlite` +Building with armclang + +``` +make -f tensorflow/lite/micro/tools/make/Makefile TOOLCHAIN=armclang TARGET=cortex_m_generic TARGET_ARCH=cortex-m55 microlite +make -f tensorflow/lite/micro/tools/make/Makefile TOOLCHAIN=armclang TARGET=cortex_m_generic TARGET_ARCH=cortex-m55 TAGS=cmsis-nn microlite +make -f tensorflow/lite/micro/tools/make/Makefile TOOLCHAIN=armclang TARGET=cortex_m_generic TARGET_ARCH=cortex-m55+nofp TAGS=cmsis-nn microlite +``` The Tensorflow Lite Micro makefiles download a specific version of the arm-gcc -compiler to tensorflow/lite/micro/tools/make/downloads/gcc_embedded. If desired, -a different version can be used by providing `TARGET_TOOLCHAIN_ROOT` option to -the Makefile. `make -f tensorflow/lite/micro/tools/make/Makefile -TARGET=cortex_m_generic TARGET_ARCH=cortex-m4 -TARGET_TOOLCHAIN_ROOT=/path/to/arm-gcc/ microlite` +compiler to tensorflow/lite/micro/tools/make/downloads/gcc_embedded. + +If desired, a different version can be used by providing `TARGET_TOOLCHAIN_ROOT` +option to the Makefile: + +``` +make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m4+fp TARGET_TOOLCHAIN_ROOT=/path/to/arm-gcc/ microlite +``` Similarly, `TAGS=cmsis-nn` downloads a specific version of CMSIS to tensorflow/lite/micro/tools/make/downloads/cmsis. While this is the only version that is regularly tested, you can use your own version of CMSIS as well by -providing `CMSIS_PATH` to the Makefile: `make -f -tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic -TARGET_ARCH=cortex-m4 TAGS=cmsis-nn CMSIS_PATH=/path/to/own/cmsis microlite` +providing `CMSIS_PATH` to the Makefile: + +``` +make -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_generic TARGET_ARCH=cortex-m4+fp TAGS=cmsis-nn CMSIS_PATH=/path/to/own/cmsis microlite +``` diff --git a/tensorflow/lite/micro/docs/memory_management.md b/tensorflow/lite/micro/docs/memory_management.md index a936cb6d7c3..36b7228fe08 100644 --- a/tensorflow/lite/micro/docs/memory_management.md +++ b/tensorflow/lite/micro/docs/memory_management.md @@ -1,3 +1,5 @@ +<!-- mdformat off(b/169948621#comment2) --> + <!-- Semi-automated TOC generation with instructions from https://github.com/ekalinin/github-markdown-toc#auto-insert-and-update-toc @@ -38,13 +40,14 @@ sections: The illustration below represents typical allocations in TFLM: -## ``` - -| | | | | HEAD |<-- TEMPORARY -->| TAIL | - -## | | | | - -* Lowest Address Highest Address * ``` +``` +-------------------------------------------------------------------------------- +| | | | +| HEAD |<-- TEMPORARY -->| TAIL | +| | | | +-------------------------------------------------------------------------------- +* Lowest Address Highest Address * +``` ### Head Section @@ -129,20 +132,18 @@ interpreter.PrintAllocations(); The output of this call will look something similar to this (output from the [memory_arena_threshold_test](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/micro/memory_arena_threshold_test.cc#L205)): -`sh [RecordingMicroAllocator] Arena allocation total 9568 bytes + +```bash +[RecordingMicroAllocator] Arena allocation total 9568 bytes [RecordingMicroAllocator] Arena allocation head 7744 bytes [RecordingMicroAllocator] Arena allocation tail 1824 bytes -[RecordingMicroAllocator] 'TfLiteEvalTensor data' used 360 bytes with alignment -overhead (requested 360 bytes for 15 allocations) [RecordingMicroAllocator] -'Persistent TfLiteTensor data' used 0 bytes with alignment overhead (requested 0 -bytes for 0 tensors) [RecordingMicroAllocator] 'Persistent TfLiteTensor -quantization data' used 0 bytes with alignment overhead (requested 0 bytes for 0 -allocations) [RecordingMicroAllocator] 'TfLiteTensor variable buffer data' used -0 bytes with alignment overhead (requested 0 bytes for 0 allocations) -[RecordingMicroAllocator] 'NodeAndRegistration struct' used 392 bytes with -alignment overhead (requested 392 bytes for 7 NodeAndRegistration structs) -[RecordingMicroAllocator] 'Operator runtime data' used 136 bytes with alignment -overhead (requested 136 bytes for 5 OpData structs)` +[RecordingMicroAllocator] 'TfLiteEvalTensor data' used 360 bytes with alignment overhead (requested 360 bytes for 15 allocations) +[RecordingMicroAllocator] 'Persistent TfLiteTensor data' used 0 bytes with alignment overhead (requested 0 bytes for 0 tensors) +[RecordingMicroAllocator] 'Persistent TfLiteTensor quantization data' used 0 bytes with alignment overhead (requested 0 bytes for 0 allocations) +[RecordingMicroAllocator] 'TfLiteTensor variable buffer data' used 0 bytes with alignment overhead (requested 0 bytes for 0 allocations) +[RecordingMicroAllocator] 'NodeAndRegistration struct' used 392 bytes with alignment overhead (requested 392 bytes for 7 NodeAndRegistration structs) +[RecordingMicroAllocator] 'Operator runtime data' used 136 bytes with alignment overhead (requested 136 bytes for 5 OpData structs) +``` ### Allocation Section Details