Академический Документы
Профессиональный Документы
Культура Документы
I.
INTRODUCTION
Embedded systems can be defined as information processing systems embedded into enclosing products such as
cars, telecommunication or fabrication equipment. [1]. Because of its multifaceted applications and complex designs,
they are only developable based on standardized design flows.
In the academic field, Embedded System Design (ESD) [1] has
become a very important research area. It comprises the design
flow itself and scientific achievements in the particular steps.
During the implementation phase of ESD, the right partitioning
of hardware and software components has to be determined.
This so-called hardware/software co-design is an iterative task.
After each partitioning cycle, a system simulation run reveals
whether the specification is met or possible specification violations are determined. Open issues must be reduced and eliminated in each cycle, in order to meet all requirements of the
system specification.
II.
Besides the validation of functional correctness, nonfunctional requirements are equally important in ESD. Especially power consumption constraints are essential in mobile
embedded systems. Battery driven ultra-low power applica-
c
978-1-4673-6136-1/13/$31.00
2013
IEEE
RELATED WORK
Regarding power analysis and optimization, todays approaches and innovations concentrate on two distinct domains
in ESD.
232
Simulation
The second domain addresses the power optimization potential in the embedded software of the microcontroller. In the
approaches [8][9][10], the executed code is analyzed to minimize the power of the microcontroller. In our work, we reuse
the power profiler developed in [9] which provides an analyzing mechanism to estimate the power consumption according
to each source code line. In these approaches the external peripherals are not regarded.
Code Compilation
Processing
2) Simulation
The actual simulation is investigated under different aspects. The software and the hardware domain influence each
other and are highly related. They are discussed separately to
distinct the informations origin.
A. Example Platform
The methodology is discussed using the example platform
illustrated in Fig. 1. The example basically consists of a MixedSignal Microcontroller (MSP430F1611) running the embedded
software along with the following external peripherals described in SystemC: a Light-Emitting Diode (LED), a button
and a Sensor for Humidity and Temperature (SHT). The LED
and the button are connected directly to the processors pins,
while the SHT sensor is connected via Inter-Integrated Circuit
(IC), which is a serial bus interface provided by the processors
internal peripherals.
Button
Annotation
1) Code Compilation
The embedded software in form of C-code represents the
input which is compiled during the first step. The program is
assembled and debugging information is created by the compiler. These are used to aid the annotation process. The assembled instructions (ASM) of the program and the debug information are stored together in an elf file [12], which represents
the input for the subsequent simulation step. The compiler used
here exemplarily is msp430-gcc version 4.4.5. It provides the
needed debugging information in the stabs+ format specified
in the GNU debugger documentation [13].
PROPOSED METHODOLOGY
MSP430
annotation.xml
The power characteristics available from hardware simulation are used to aid the software development. First, an example platform is specified for illustration, followed by the procedure of the proposed co-design. We denote internal and external peripherals to distinguish between hardware components
within the microcontroller e.g. timers and externally connected
components e.g. sensors.
LED
Peripheral
models
file.elf
Controller
model
SHT
IC Bus
Fig. 1 Example platform including a MSP430, a button, a LED and a SHT
connected via IC bus
233
tion is denoted as active, because the communication is triggered directly by the source of the microcontroller. The measurement is finished after a certain time, which is unrelated to
the executed code. This circumstance is denoted as a passive.
The distinction between active and passive is needed to explain
the marker position used for annotation. Markers thereby are
links between power state transitions and the embedded software.
3) Processing
After the simulation, the file_eprof.c and system.xml have
to be processed to extract and combine all relevant information
needed for the visualization in the IDE. During this process, a
combination of the information from the program run with the
debugging output from the compiler is done, and post statistical
information is calculated. The first step is to map the ASM
instructions back to their corresponding C-code lines, which is
done with the stabs+ debugging information. The power values
and memory accesses of each ASM instruction belonging to
this line have to be accumulated. The results are fine grained
profiles about each source code line containing the number of
executions and their power value. Also memory reads and
writes are presented to allow code optimization without the
need of a disassembly. Important to note is that the back annotation strongly depends on the debug information. Concerning
our approach, the stabs+ format of the msp430-gcc provides
the necessary information, even for higher optimization levels.
In addition to the power annotation to the source code, statistical information of the hardware is generated from the results of the system simulation. Therefore, the timeline is analyzed to determine the duty cycles of each peripheral powerstates by accumulation the time, in which the state is active.
The power consumption and the accumulated time are used to
calculate the total energy of each state. Together with the
source annotation, they can be used for extensive program
analyses.
In case of passive or semi-active changes, defining a marker is a manual process. Passive types therefore refer to the
program lines where the execution is altered, e.g. an interrupt
starting point in case of a pressed button. For semi-active types
such as the entering of the measurement state, the program line
is considered which initially caused the IC communication. To
mark a peripheral controlled by a state machine, the state variable itself is used as marker.
4) Annotation
In order to provide power information to an IDE, a second
XML is proposed. It stores information about each source code
line and the peripherals of the system (see Annotation.xml in
Fig. 4.)
The part regarding the software of the microcontroller
combines the annotation of several files in different file nodes.
Each of them has a name attribute which includes an absolute
or relative path to the source code file for identification. Each
file node consists of at least one line node which again can
possess one or more marker nodes. Attributes of the line node
are the line number (nr), bytes of it in ASM (membytes), power
consumed (power), the times executed (exe), the number of
memory reads and writes (memread, memwrite). As depicted,
the marker node contains the attributes peripheral and state.
The line number is identified by nr, while the other attributes
store profiler information. The marker attribute peripheral is
needed for identification, while state is an optional attribute
used if the line can be mapped to a certain power state change.
In that case a specified color can be used to highlight the marker of the state transition.
</peripheral>
<timeline timescale="ms">
<!-- init start! -->
<signal time="0" peripheral="LED" state="off"/>
</timline>
</system>
234
<annotation>
<file name='test.c' >
</file>
<file name='include.c'>
</file>
<system timescale="ms">
<peripheral name="LED" powerscale="mW">
<state name="on" power="66.0" dutycycle="0.102"
time="1224"/>
<state name="off" power="0.01" dutycycle="0.898"
time="10776"/>
</peripheral>
</system>
</annotation>
In order to meet tight power constrains, a lot of development time has to be spent in ESD. To ease this process, a workflow to annotate power characteristics back into to the source
code of the microcontroller has been developed. The workflow
is based on the embedded software. An example platform has
been presented to illustrate the process. Also, interfaces have
been specified to make the workflow applicable in general.
Precisely as exchange formats, two XML Schemas have been
defined. One describes the output of the system simulation and
the other enables the back annotation into the source. We illustrated the advantages of the novel concept, which eases future
software developments by investigating hardware interaction
during the partition cycle of the ESD. It is based on software/hardware co-simulation and allows power optimizations
as well as manual driven design space explorations. The methodology has been investigated for systems with single microcontroller applications and different types of external peripherals. Since our contribution seems to open a promising path, in
future work we will investigate multi master systems.
IV.
EXPERIMENTAL RESULTS
Different visualization concepts of the XML format presented above are possible. It can be used to show the consumed
energy or the execution frequency of each source code line.
Tooltips may aid optimization by including memory reads and
writes or internal execution cycles. These visualization concepts offer power optimization in software. They help to identify the variable implementation in terms of memory or register
use. They can be used to optimize functions calls with minimum data transfer or to identify often executed code. The uses
of markers help to identify inefficient use of hardware. They
reflect the interaction with the hardware and fasten the process
of understanding unfamiliar code. These markers are added
hierarchically, which helps to identify the use of the hardware
in nested function calls. Furthermore, a table reviewing the
power states of the peripherals is helpful, showing the duty
cycle between the power states and the consumed energy. All
features together allow direct feedback from the system simulation, providing a way of optimization or manual driven design
explorations.
REFERENCES
[1]
[2]
[3]
[4]
[5]
For optimization purpose, the peripherals have to be reconsidered. Referring to the manual driven design exploration
along with our strict specification, the LED cannot be exchanged, since it has to have a minimum brightness to catch
attention. Also the SHT21 sensor is already very energy saving, making an economical replacement impossible. Only in
the button peripheral, power saving are possible using a higher
pull up resistor. Also, the software may be optimized for example by using better data structures. All of it makes a difference, nevertheless the power saving is small compared to the
one presented below, improving the software and hardware
interaction. Based on the post statistical information about the
peripherals together with the markers, the critical code sections
are easily investigated by the developer. Therefore, the code is
changed and the system is re-simulated again, directly showing
the results of the improvements.
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
235
energyAware
Profiler
http://www.energymicro.com/downloads/online-help-energyawareprofiler, accessed January 2013.
World Wide Web Consortium (W3C), Extensible Markup Language
(XML). http://www.w3.org/XML/, accessed January 2013.
W. Mauerer, Linux Kernelarchitektur, Carl Hanser Verlag GmbH & CO.
KG, 2003.
J. Menapace, J. Kingdon, D. MacKenzie, The stabs debug format,
http://docs.freebsd.org/info/stabs/stabs.pdf, accessed January 2013.