Professional Documents
Culture Documents
AMF-DES-T1053 - Open Source Tools Development Tools For ARM® Architectures
AMF-DES-T1053 - Open Source Tools Development Tools For ARM® Architectures
March 2015
TM
External Use
Session Introduction
External Use 2
Freescale’s ARM Devices Span from Low-End to High-End
External Use 3
Agenda
• Open-source resources for ARM
• Target Software Building Blocks
• Tools for Build and Debug
• Eclipse Linux Tools
−Dynamic analysis tools
• Beyond open-source with Freescale
TM
External Use 4
Agenda
• Open-source vs Commercial
• Target Software Building Blocks
• Tools for Build and Debug
• Eclipse Linux Tools
−Dynamic analysis tools
• Beyond open-source with Freescale
TM
External Use 5
Open Source vs Commercial
TM
External Use 6
Open Source & Commercial
Open Source Commercial
Distribution Creation Yocto
Revision Management GIT, Mercurial, CVS, etc Accurev, ClearCase, etc
Building bitbake, make, etc
CW compiler (for AIOP),
Compilation GCC (for ARM) GHS
Scripting Python, etc
Device Configuration CW QCVS tools
Configuration Validation CW QCVS tools
SW Testing Valgrind Purify, Klocwork
JTAG bare-metal debug CW, ARM DS5, etc
CW Debugger, ARM DS5,
Linux Application debug GDB etc
Performance Analysis - Core Perf CW Scenario Tool
Performance Analysis - SOC CW Scenario Tool
External Use 7
Agenda
• Open-source resources for ARM
• Target Software Building Blocks
• Tools for Build and Debug
• Eclipse Linux Tools
−Dynamic analysis tools
• Beyond open-source with Freescale
TM
External Use 8
Get the Target Software
• Kinetis MCU
− Processor Expert: Build applications with software drivers and have it deal
with the low-level microcontroller initialization.
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?
code=PE_DRIVER_SUITE&tid=PEH
− McuOnEclipse Processor Expert Components: an extensive set of added
Processor Expert components.
https://github.com/ErichStyger/mcuoneclipse/tree/master/PEupd
− Kinetis SDK
External Use 9
Processor Expert + KSDK
TM
External Use 10
Learn more at: www.freescale.com/KSDK
Middleware
Application
Specific
Stacks
TM
External Use 11 The OSI logo trademark is the trademark of Open Source Initiative.
Kinetis SDK and Processor Expert
• Processor Expert is a complimentary PC-hosted
software configuration tool (Eclipse plugin)
• Processor Expert (PEx) provides a time-saving
option for software configuration through a
graphical user interface (GUI)
• Board configuration and driver tuning tasks
include:
− Optional generation of low-level device initialization
code for post-reset configuration
− Pin Muxing tools to generate pin muxing functions
− Components based on Kinetis SDK drivers
Users configure the SoC and Peripherals in a GUI
PEx creates the configuration data structures for driver
config and init
TM
External Use 12
Yocto + Linux
TM
External Use 14
What is the Yocto Project?
www.yoctoproject.org
• “An open source collaboration project that provides templates, tools
and methods to help you create custom Linux based systems for
embedded products regardless of the hardware architecture.”
TM
External Use 15
Yocto Project Introduction: Terms
External Use 16
Yocto Project Introduction: Layers of Recipes
Source: https://www.yoctoproject.org/tools-resources/projects/openembedded-core
External Use 17
Yocto Project Tools
www.yoctoproject.org
• Hob: GUI tool to select packages to build and easily create custom
image
• GCC: Open source build tools (compiler, linker) for the ARM cores
in a Freescale device
TM
External Use 19
Yocto and BitBake Documentation
TM
External Use 21
Yocto Basics for QorIQ SDK
TM
External Use 22
Something New For LS1021
• Distribution
− Previous Freescale SDK was a Distribution.
− Full Linux and Tools release
− Twice a year releases
− All platforms, All packages
• BSP
− Leverages Yocto Poky Distribution
− Provides only changes over distro
− NPI support separately qualified
− Released with NPIs
TM
External Use 23
Freescale QorIQ SDK and the Yocto Project
• SDK 1.4 is based off the Yocto 1.4 "dylan“ release
• SDK 1.5 is based off the Yocto 1.5 “dora” release
• SDK 1.6 is based off the Yocto 1.6 “daisy” release
• SDK 1.7 is based off the Yocto 1.7 “dizzy” release
• Alignment of release numbering just coincidence
• Freescale is an active part of the upstream community and is a full Yocto
Project Member and a member of the Advisory Board
• Freescale has created QorIQ specific layers, that can be "plugged" into the
Yocto build system, allowing users to build for Freescale target machines
TM
External Use 24
Start with the Yocto Distribution
External Use 25
Add the LS1 BSP
External Use 26
Pointers to More Information
TM
External Use 27
Recent QorIQ SDK Release
www.freescale.com/webapp/sps/site/prod_summary.jsp?code=SDKLINUX
TM
External Use 28
Recent QorIQ SDK Release (continued)
Freescale Public git Server
• Public source code for the SDK can be also pulled from:
git.freescale.com/git/cgit.cgi/arm/sdk
TM
External Use 29
Recent QorIQ SDK Documentation
On-line : http://www.freescale.com/infocenter
TM
External Use 30
Recent QorIQ SDK Documentation (continued)
InfoCenter Lite : <SOURCE ISO>/documents/START_HERE.htm
TM
External Use 31
QorIQ Yocto Layers
TM
External Use 32
SDK Layers
TM
External Use 33
SDK Layers (continued)
meta-fsl-arm vs. meta-fsl-networking
• meta-fsl-arm:
− Adds basic support for all supported Freescale boards
− Recipes for all public Freescale projects : kernel, u-boot, ...
− Only defines images fsl-toolchain, fsl-image-minimal (not even
those in the future)
− Hosted on git.freescale.com
• meta-fsl-networking:
− Adds definitions for images like fsl-image-flash and fsl-image-
full
− Focuses on networking, QorIQ-specific technology
− More and more recipes are moved into meta-fsl-arm
− Hosted on git.freescale.com
TM
External Use 34
i.MX + Yocto
TM
External Use 35
Yocto Project Freescale i.MX 6 Releases: History
Release Description
TM
External Use 36
Yocto Project Freescale i.MX 6 Releases: Distribution
meta-fsl-bsp-release layer
• Distributes changes on top of community layers
− meta-fsl-arm
− meta-fsl-demos
− poky
• After each release the changes are upstreamed into the layers for
the next Yocto release to provide
TM
External Use 37
Yocto Project Freescale i.MX 6 Releases: Contents
Contents Description
TM
External Use 38
Yocto Project Build:
Configure the build environment
• What are the supported boards?
i.MX Reference Boards
TM
External Use 41
Using BitBake
TM
External Use 42
Running BitBake
External Use 43
Running Specific BitBake Tasks
TM
External Use 45
Agenda
• Open-source resources for ARM
• Target Software Building Blocks
• Tools for Build and Debug
• Eclipse Linux Tools
−Dynamic analysis tools
• Beyond open-source with Freescale
TM
External Use 47
Components of a Tools Suite
• GDB: debugger
• Debug Interface: Connection from the host to the target for debug
− MCU: third party probes like Segger.
− Linux: UART or socket
− Layerscape bare-metal: CW-TAP
• Eclipse for C/C++: the IDE and framework to edit, build and debug
projects.
• GNU ARM Eclipse plugins: integration of the GNU gcc for ARM
into Eclipse, provides panels and build tool integration including a
wizard to create new projects.
• GCC ARM Embedded: compiler, linker, build tools and gdb,
needed to compile source code.
• Cross Build Tools: some tools like ‘echo’ or ‘rm’ are not present by
default on Windows, this package closes that gap.
TM
External Use 48
GDB – Gnu Debugger
External Use 49
Two ways to run GDB
Target (self-hosted) Native (Host)
• GDB runs on the target (DUT) • GDB runs on the development
− E.g. Target OS: Linux host
− Host
OS and Target OS are not
• Debugs an application running on
the same system necessarily the same
• Interface with the target system • Remotely debugs an application
using other applications running on the target
− telnet − Socket connection or UART
into the target system to
run GDB from the Linux connection over the OS’s drivers
command prompt and interface carries GDB
commands and responses
− HostGDB communicates with
target GDB server
TM
External Use 50
GDB Self-Hosted Target Debugging ARM Target
QorIQ
TM
External Use 51
GDB Host Remote Debugging ARM Target
QorIQ
Host cross
Target GDB
GDB
GDB gdbserver
(+ ddd, Eclipse) GDB remote protocol
- Requests
- Notifications
- Data Exchange
TM
External Use 52
GDB – ARM Support
• Support for:
− ARMv7 (32-bit)
− ARMv8 (64-bit)
from GDB 7.6 add ARM AArch64 debug architecture (native and target
configuration)
TM
External Use 53
GDB – ARM Support (continued) QorIQ
TM
External Use 54
GDB – Debugging ARM Target
• GDB commands
− run/Ctrl-C(stop), next, step, nexti, stepi, breakpoint
− backtrace, frame, print, x, dump
− set, call, jump, return
TM
External Use 55
Debug Interface
TM
External Use 56
What is Eclipse?
Full ecosystem with many members, dozens of open source projects and
millions of downloads
TM
External Use 57
What is Eclipse? (contd.)
► Anextensible open source software platform made up of core
services and interoperable plug-in components.
► Anenvironment supporting a group of flexible (extensible) integrated
and inter-operable components.
► Eclipse
facilitates integration of open source and commercial
components
Third Party
Eclipse-based Development Platform
Service A
TM
External Use 58
Eclipse IDE
− For developers using Linux on the target, using Linux on the host is
preferred
TM
External Use 59
Eclipse User Interface Example
Menu bar
Perspectives
Tool bar
Text
editor
Resource Stacked
Navigator views
view
Editor
Status
area
TM
External Use 60
CDT – C/C++ Integrated Development Environment
• Features
− Supports GNU build tools as managed build project or standard make
build
− Source navigation, code refactoring, code generation
− Visual debugging tools, including memory, registers, and disassembly
viewers, multicore visualization
TM
External Use 61
Eclipse CDT – Remote Application Debug QorIQ
GDB Cross-
Eclipse CDT Tools • CDT prerequisites
ARM
GDB
− GDB cross-tools for
Launch
GDB/MI
GDB gdbserver remote target
GDB CLI
Linux
− SSH connection for
downloading application
(gdb) break main.c:10
(gdb) continue
Host Continuing. Target • Debug configuration
− Update GDB debugger
to point to cross-tools
gdb
− Use “C/C++ Remote
Application” and ssh
connection to download
executable on remote
Linux machine
TM
External Use 62
Eclipse CDT – Debugging ARM Target
TM
External Use 63
GCC
− Native or Cross-build
− For ARM targets, usually want the cross build tools
• For Linux development, the best way to obtain the build tools is
through Yocto QorIQ
TM
External Use 64
QorIQ
SDK Compiler Tool Chain
$ bitbake meta-toolchain
TM
External Use 65
GCC Kinetis
TM
External Use 66
Extra Tools for Windows Hosts Kinetis
• There are a bunch of tools like ‘echo’ or ‘rm’ which are used by
Eclipse.
http://sourceforge.net/projects/gnuarmeclipse/files/Miscellaneous/
− Download the Cross Build Tools.zip file.
− Place in C:\Freescale\Kepler\CrossBuildTools.
TM
External Use 67
Eclipse Compiler Support Kinetis
• Launch Eclipse, use the menu Help > Install New Software
• Use http://gnuarmeclipse.sourceforge.net/updates as update site
and install the packages.
TM
External Use 68
The Easy Way
• I.MX users
− Build tools are set up with Yocto
• QorIQ users
− Build tools are set up with Yocto
− Use CodeWarrior Development Suite
TM
External Use 70
Agenda
• Open-source resources for ARM
• Target Software Building Blocks
• Tools for Build and Debug
• Eclipse Linux Tools
−Dynamic analysis tools
• Beyond open-source with Freescale
TM
External Use 71
QorIQ
Eclipse Linux Tools i.MX
External Use 72
Eclipse Linux Tools
TM
External Use 73
GCOV, GPROF
TM
External Use 74
Gcov – code coverage
• Gcov is an open-source community code coverage analysis tool:
− Provides code coverage testing to C/C++ projects
− monitors an application under execution and identifies
python
how often each line of code executes scripts
what lines of code are actually executed
how much computing time each section of code uses
• Gcov main view displays an overview of coverage information for the whole
project
TM
External Use 75
Gcov – code coverage
Build Project
TM
External Use 76
GPROF
TM
External Use 77
GPROF
TM
External Use 78
Linux Perf
TM
External Use 79
Linux perf
• Perf is a profiler tool for Linux 2.6+ based systems that abstracts
away CPU hardware differences in Linux performance
measurements and presents a simple command line interface.
• Perf is based on the perf_events interface exported by recent
versions of the Linux kernel.
• It goes by several names:
− Linux perf
− perf_events
− Just “perf” – for simplicity this is what we will use during this
presentation
TM
External Use 80
Why perf?
• Perf can help you solve a wide range of problems: It can be used
with very simple to complex
− Performance problems.
− Debugging problems
• It can cover
− Kernel itself
− Application (User Space)
• It can show you:
− Annotated source code that can be used for hotspot analysis
− CPU event counters
− Other kernel information
− State of various Kernel probes in the system.
− Much more …
TM
External Use 81
Why perf?
TM
External Use 82
perf invocation
TM
External Use 83
perf invocation
TM
External Use 84
Using Linux Tools - perf
• Eclipse – one click launch
− Right click on the project->Profile As -> Profile with Perf
TM
External Use 85
perf – Counting events
TM
External Use 86
perf stat
• Gathers several performance statistics from a command.
• Results collected to ‘perf.data’ by default
TM
External Use 87
perf – running reports
TM
External Use 88
perf – report scenarios
The perf report command is used to read the perf data (by default
collected to perf.data) and displays a ‘profile’.
TM
External Use 89
perf stat -e
TM
External Use 90
perf list
perf list – lists all of the symbolic event types. These are the events that can be selected with the
perf –e option
TM
External Use 91
perf stat Scenarios
# Various CPU last level cache statistics for the specified command:
perf stat -e LLC-loads,LLC-load-misses,LLC-stores,LLC-prefetches command
TM
External Use 92
Valgrind
TM
External Use 93
What is Valgrind?
• Keep in mind that Valgrind uses simulation, and so the program will
execute slower
TM
External Use 94
The Valgrind Tool suite
From the list above, the most commonly used tool is memcheck. In fact
many people think that Valgrind is basically the same thing as
memcheck
TM
External Use 95
Why Valgrind?
TM
External Use 96
Valgrind Use Cases
TM
External Use 97
Using Valgrind
usage:
valgrind [--version] [--help] [--tool=memcheck] foo [foo’s args]
TM
External Use 98
Using Linux Tools - valgrind
TM
External Use 99
Compilation notes
TM
#include <stdio.h>
#include <stdlib.h>
• With no options given,
Valgrind will do a quick of
int main(int argc, char** argv){
memory leaks
int i;
int *a; • If you need more detailed
information, run Valgrind with
the option –leak-check=full.
for (i=0; i < 10; i++){
a = malloc(sizeof(int) * 100);
}
free(a);
return 0;
}
TM
• If you see leaks indicated as still reachable, this may not be a problem. It simply means
that the memory was still in use at the end of the program.
• Any leaks named as “definitely lost”, “indirectly lost” or “possibly lost” (as the ones shown
in our example) should be fixed as they represent real problems.
• Note that Valgrind points out the line in your program where the leak occurred.
TM
TM
• LTTng
− Linux Trace Toolkit – next generation: kernel and user-space tracer with
view and analysis tools.
− LTTNG has been separated out of the Linux Trace Toolkit. Now a
separate project called Trace Compass.
http://projects.eclipse.org/projects/tools.tracecompass
TM
• Trace Compass is a Eclipse tool for viewing and analyzing any type
of logs or traces.
− Provide views, graphs, metrics, etc. to help extract useful information
from traces, in a way that is more user-friendly and informative than
huge text dumps
TM
TM
• Trace synchronization
− Time correction
− Multi-core
− Dependency analysis, delay analyzer
− Dependencies among processes
TM
TM
Middleware
Application
• Windows 7/8
(TCP/IP, USB)
Specific
Stacks
MCU Hardware
TM
TM
• Linux development
− GNU debugger compatible + extensions for Linux application debug
− SMP aware kernel debugging
− Linux kernel module development and debug
− Aligned with Freescale SDK: Linaro GNU toolchain, integrated target
debug agent
• Non-intrusive debug through trace
− Core and SoC trace sources: configuration, extraction, visibility
− Post-mortem debugging: offline trace
− Debug-print over STM
− Linux aware trace
• Performance Analysis
− Platform counter configuration and display
− Predefined measurement scenarios
TM
Device Tree
Editor Pre-boot
LS Loader
Configuration
TM
Command
Low Level
access
Server
Debug
• Simultaneous connectivity with multiple clients
• Single- and Multi-core support
Flash
programmer
TM
TM
Debug
Linux Kernel
Core #0
Core #1 Core #0 … #n
Core #n
TM
Start trace
TM
Core #n Core #n
Core #n
Core #0
Statistics based on non-intrusive collected trace
- Single core and Multicore views
Core #1
- Code coverage (asm and C level)
- Optimize application using Hierarchical profiler
- Spot bottlenecks using Critical Code Core #n
- Visually identify out-of-order execution using Timeline
- Identify critical call chain using Call Tree
- Critical stack usage (simulator based)
CallTree
TM
TM
Customer Benefits
• System Optimization for • Probe-less, field based
Cores and SoC usage.
• Complexity Abstraction • Streamlined to solve
• Delivers FSL expertise to several performance
users . issues
• Ease of Use
Key Features
• Stand alone – no • User defined
CodeWarrior Needed measurement scenarios
• Performance Analysis • Compare pairs of runs
including visualization • Graphically visualize all
• Connection auto measurements
discovery • “Live” view of events Devices supported
• “Canned” measurement and metrics
scenarios • Supports “bare metal” or • P2040, P3041, • B4860 (Rev 2, 2.1)
• 100+ scenarios covering Linux applications P5020x P5040, • LS1020A, LS1021A,
Core and SoC blocks • Python scripting support P4080 (Revs 1,2) LS1022A.
• T1040,T2080
• T4240 (Rev1, 2)
TM
TM
TM
Customer Benefits
• Abstracts complexity of • Probe-less, field based
DPAA Debug resources usage.
• Delivers FSL expertise to • Streamlined to solve
users . several performance
• Ease of Use issues
• Stand alone – no
CodeWarrior Needed
Key Features
• SoC Data Plane • Packet Processing
Configuration Debug Critical Resource
• Packet Processing Monitoring
Latency Analysis • Analysis data
• Automatically identifies interpretation and
the frame processing visualization Devices and Platforms
paths (data flows) of the • User defined
system measurement scenarios Analysis over JTAG
• Provides visibility into • Graphical Visualization P2040, P3041, P4080, P5020, P5040, T1040,
T2080, T4240, B4860R2
networking tasks • Supports “bare metal” or
Analysis with software debug agent (over SSH)
offloaded to SoC Linux applications P4080, P5020, P5040, T4240, B4860R2
• Python scripting support
TM
TM
TM
TM
CodeWarrior Debug
GDB
Kinetis Design Studio
LTTNG Debug
CW Packet Tools
Valgrind CW HW Trace
CW Scenarios
Perf Optimization
CW Profiling
TM
TM
www.Freescale.com