# Modeling the Power Consumption of Function-Level Code Relocation for Low-Power Embedded Systems
## 3 Configuration of Entire Environment
### Instruction Trace  
Instruction trace is one of the tracking methods employed to extract memory transactions and instructions from the MCU. This method makes it possible to step through and debug code execution, a process which is useful for analyzing the performance of software. Rather than being a set of assembly codes directly translated from a programming language, the trace method is the sequential collection of actual executing instructions. The combination of instructions, i.e., instruction trace description, therefore, enables the complete flow of a program to be understood. The MSP432E401Y Launchpad manufactured by Texas Instruments (TI) is a high-performance ARM Cortex-M4F-based microcontroller that uses a 32-bit ARM instruction set. In addition, this MCU combines 1024 KB Flash memory, 256 KB SRAM, and 6 KB EEPROM. A distinctive feature of the MCU is that it includes GPIO ports that enable the use of Embedded Trace Macrocells (ETM). All the information tracked via the ETM buffer interface is stored by the processor. This information \begin{table}
\begin{tabular}{l l l l} \hline \hline \multicolumn{2}{c}{_Component_} & \multicolumn{2}{c}{_Environment_} \\ \cline{3-4} \multicolumn{2}{c}{} & \multicolumn{1}{c}{} & **Instruction Trace** & **Power Measurement** \\ \hline
**Hardware** & MCU & MSP432E401Y [10] & MSP432P401R [11] \\  & Debugger & Keil ULINK_pro_[12] & TI XDS-110 [13] \\ \hline
**Software** & Compiler & ARM CC Compiler [14] & TI Compiler [15] \\  & Instruction Set & ARM Instruction Set [16] & ARM Instruction Set [16] \\  & IDE & Keil uVision5 [17] & Code Composer Studio [18] \\  & Method & ETM Trace [19] & EnergyTraceTM [20] \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Environment configurations. Figure 2: Flow of language transformation. includes all instructions executed and a real-time stream of read/write data. Despite these impressive characteristics, ETM is non-intrusive, i.e., it has no influence on program execution. Hence, using this MCU and the ETM feature is an attractive option to understand the operating content of a program without the effect of external interference. Keil ULINKpro, which is designed for experimentation, has a debugging function and uses a unique technique for trace streaming. In other words, MSP432E401Y Launchpad would have to be combined with the debugger to make use of ETM instruction trace. In this study, we connected MSP432E401Y MCU and ULINKpro to construct the tracing environment. ETM required a 20 pin CoreSight connector with a pin size of 1.27 mm. Because this component is not usually installed on the MCU, a custom adapter was necessary, as shown in Figure 3. In addition, five signals sized 2.54 mm, four GPIO pins for data transfer, and one clock pin, were placed on the other side of the custom adapter. The trace results are shown in raw assembly code based on the ARM instruction set. All groups were restructured to conduct further in-depth analysis, and abbreviations were prepared based on the instruction group defined in the ARM instruction set. Among these, the instructions included in the \"Multiple Register Load and Store\" group access memory require several general-purpose registers. The \"Register Load and Store\" group could include the aforementioned group in a large sense. Furthermore, as the ARM operating modes are switched by using the \"Status Register Access\" and \"Coprocessor\" groups, they are not considered. Table 2 lists all of these redefined instruction groups. Figure 3: Custom adapter. As mentioned above, an instruction trace does not constitute a translated assembly language set, but an exact trail resulting from the original execution of a program. Therefore, preprocessing is inevitable prior to further analysis. * In this study, a unit selected for relocation is a single function in a program. An effective analysis requires the instruction trace result to be separated at the function level.