1 /*
2 * Copyright (c) 2015, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 /** @mainpage Processor SDK Utilities
33 *
34 * @section intro Introduction
35 *
36 * This document describes the Processor SDK Utilities used for profiling, and
37 * potentially other tools developed by TI in the future.
38 * - @subpage profCCS
39 * - @subpage profDSS
40 *
41 */
42 /** @defgroup pdk_profiling_tool PDK Profiling tools
43 * @{
44 */
45 /** @} */
46 /** @defgroup pdk_profiling_hooks PDK Instrumentation hooks
47 * @ingroup pdk_profiling_tool
48 * For more information, see:
49 * - @subpage profCCS
50 * - @subpage profDSS
51 */
52 /**
53 * @file profilingHooks.h
54 *
55 * @brief Declarations for the runtime programming hooks of the Processor SDK Profiling Tool.
56 *
57 * For more information, see:
58 * - @subpage profCCS
59 * - @subpage profDSS
60 *
61 * ## Usage ##
62 *
63 * Applications that are included in a profiling session must set these
64 * compiler flags for the desired platform:
65 * - ARM: `-finstrument-functions -gdwarf-3 -g`
66 * - DSP: `--entry_parm=address --exit_hook=ti_utils_exit --exit_parm=address --entry_hook=ti_utils_entry -g`
67 * - M4: `--entry_parm=address --exit_hook=ti_utils_exit --exit_parm=address --entry_hook=ti_utils_entry -g`
68 *
69 * For best results, ensure that the optimization levels are consistent between
70 * the library and the project (typically -O3, or optimization level 3).
71 *
72 */
73 /* Defined for C66, or DSP */
74 #if defined (_TMS320C6X)
76 /*!
77 * @brief TI Toolchain Utils Entry Hook
78 *
79 * Instruments the entry point and timestamp of the current function into
80 * memory. Note that this function is automatically referenced at entry of
81 * every function by TI Toolchain.
82 *
83 * @param *func_addr Function Assembly Address (Hexadecimal)
84 */
85 void ti_utils_entry(void (* func_addr)(void));
87 /*!
88 * @brief TI Toolchain Utils Exit Hook
89 *
90 * Instruments the exit point and timestamp of the current function into
91 * memory. Note that this function is automatically referenced at end of
92 * every function by TI Toolchain.
93 *
94 * @param *func_addr Function Assembly Address (Hexadecimal)
95 */
96 void ti_utils_exit(void (* func_addr)(void));
98 #endif
99 /* Defined for M4 */
100 #if defined (__TI_ARM_V7M4__)
102 /*!
103 * @brief TI Toolchain Utils Entry Hook
104 *
105 * Instruments the entry point and timestamp of the current function into
106 * memory. Note that this function is automatically referenced at entry of
107 * every function by TI Toolchain.
108 *
109 * @param *func_addr Function Assembly Address (Hexadecimal)
110 */
111 void ti_utils_entry(void (* func_addr)(void));
113 /*!
114 * @brief TI Toolchain Utils Exit Hook
115 *
116 * Instruments the exit point and timestamp of the current function into
117 * memory. Note that this function is automatically referenced at end of
118 * every function by TI Toolchain.
119 *
120 * @param *func_addr Function Assembly Address (Hexadecimal)
121 */
122 void ti_utils_exit(void (* func_addr)(void));
123 /* Defined for ARM that is not M4 */
124 #elif defined(__arm__)
126 /*!
127 * @brief ARMv7 GCC Utils Entry Hook
128 *
129 * Instruments the entry point, call site and timestamp of the current function
130 * into memory. Note that this is a standard GCC library prototype function and
131 * is automatically referenced at the entry of every function by GCC.
132 *
133 * @param *this_fn Function Assembly Address (Hexadecimal)
134 * @param *call_site Call Site Assembly Address (Hexadecimal)
135 */
136 void __attribute__((no_instrument_function))__cyg_profile_func_enter(const void *this_fn, const void *call_site);
138 /*!
139 * @brief ARMv7 GCC Utils Exit Hook
140 *
141 * Instruments the entry point, call site and timestamp of the current function
142 * into memory. Note that this is a standard GCC library prototype function and
143 * is automatically referenced at the entry of every function by GCC.
144 *
145 * @param *this_fn Function Assembly Address (Hexadecimal)
146 * @param *call_site Call Site Assembly Address (Hexadecimal)
147 */
148 void __attribute__((no_instrument_function))__cyg_profile_func_exit(const void *this_fn, void *call_site);
150 #endif