Using custom GCC toolchains
If your applications are built using GCC based cross compilers, targeting other platforms, you can still use MTuner to profile memory with some additional work. Each capture file (*.MTuner) starts with a header defining the host platform and a few additional parameters like endianess and word size of the host platform. Adding a custom toolchain is a matter of porting the MTuner SDK library to your target platform and this page will provide a detailed guideline how to do that.
MTuner SDK comes with full source code and file names will be referred to here directly. For information on directory structure please visit the MTuner SDK page.
Linking custom toolchains to MTuner
rmem_enums.h header file has an enum ToolChain that lists toolchains that may be supported by MTuner. Some of the toolchains will be supported in the future but the focus in this page is on ‘CustomX’ enums. Each of those enum values corresponds to an entry in toolchain combo box in GCC toolchains dialog. These values are the toolchain identifier written in the header of the capture (*.MTuner) file. See the MemoryHook constructor in rmem_hook.cpp for details.
When MTuner loads the capture file it will use the toolchain identifier in order to use the correct way to resolve debug symbols. For GCC based toolchains this normally means locating addr2line, nm and C++filt utilities.
Adding a new custom toolchain
All of the code that needs porting work is located in three header files, rmem.h, rmem_mutex.h and rmem_platform.h. Following the implementation for any of the already supported platforms should provide you with sufficient information to add a new platform but here is the breakdown of the process:
That’s it! Once the porting is done, build the library with the target toolchain. GENie may be used for easy builds but creating a library and manually adding files to your favourite IDE will work fine as well.