Your SlideShare is downloading. ×
Jtag Tools For Linux
Jtag Tools For Linux
Jtag Tools For Linux
Jtag Tools For Linux
Jtag Tools For Linux
Jtag Tools For Linux
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Jtag Tools For Linux

1,339

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,339
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  1. Accelerating the Development of EmbeddedLinux Devices with JTAG On-Chip Debugging The two most common scenarios where the JTAG connection Table of Contents can be used are when an Ethernet connection is not available for agent-based debugging and when the developer needs Introduction......................................................................... 1 to resolve issues that occur in the Linux kernel or user space, Overview of the Linux Operating System........................... 1 and system-mode debugging is required. With the next- Complexities of Debugging Embedded generation JTAG tools from Wind River, developers can Linux Devices...................................................................... 2 . debug the hardware, bootloader, Linux kernel, and user The Bootloader................................................................... 2 . space, spotting system crash events and other problems that occur between the kernel, user space, and target. Moreover, Bootloader Debug Issues................................................ 2 for developers using the Wind River Linux operating system Simplifying Bootloader Debug........................................ 3 (OS), developers can move seamlessly between agent and Linux Kernel and Kernel Modules....................................... 3 . JTAG debugging. These innovations in on-chip debugging Using JTAG to Debug..................................................... 3 provide powerful alternatives for projects where agent-based Linux Application Debug..................................................... 4 debugging is either unavailable or is too expensive. Wind River Solutions for JTAG-Based Overview of the Linux Operating System Linux Debug........................................................................ 5 The first step in troubleshooting Linux is to understand the Advanced Wind River Solutions for Linux OS and the areas in which a debugger needs to analyze Linux Debug........................................................................ 5 interactions. Linux is typically comprised of multiple Wind River On-Chip Debugging for the interacting components and employs complex memory Entire Linux Development Process................................. 6 mapping and management schemes. Debugging a Linux- Conclusion........................................................................... 6 based embedded system requires powerful tools that expose Notes ................................................................................. 6 the operation of the OS and its interactions with the hardware. The main components of the Linux OS are the Linux kernel, kernel modules, and application software. The Linux kernel isIntroduction the core of the OS and has ultimate authority. Linux kernelDebugging embedded Linux products has traditionally modules are elements of the OS that are dynamically loadedrequired a mixture of hardware and software tools—JTAG and unloaded and are often used for device drivers. Once atools for hardware bring-up and agent-based solutions forsoftware development. These JTAG- and agent-based toolsoften solved point problems but were not designed forintegrated Linux development. User Mode ApplicationsWind River has changed the way developers can debug Linuxby merging traditional JTAG hardware debugging with Linuxkernel configuration; patch management; and user-space Kernel Modulesapplication development, debug, and analysis in an Eclipse- Kernel Modebased integrated development environment (IDE) known asWind River Workbench. This capability enables developers to Linux Kerneluse the JTAG connection when traditional agent-basedsolutions are not technically or economically feasible. Figure 1: Components of the Linux OS
  2. Virtual Physical kernel modules, care must be taken to account for the static Memory Memory and dynamic address translation capabilities of the Linux (RAM) kernel as well as its ability to dynamically allocate processes in memory. 0x10000788 Complexities of Debugging Embedded Linux Devices 0x1EA78788 Linux is continuing to rapidly grow in embedded devices. Mapped According to technology market research firm Venture Development Corporation (VDC), 23 percent of new projectsFigure 2: Linux Memory Management will use Linux1. Debugging Linux embedded projects can be extremely complex as development spans bootloader, LinuxLinux kernel module is loaded, it has the same level of kernel, kernel module, and applications. Issues that Linuxauthority as the Linux kernel. The Linux kernel partitions all developers must contend with include establishing a targetsoftware to run in either user mode or Linux kernel mode. configuration file for the bootloader, traversing Linux virtualApplications that run in user mode on a Linux system have addressing from user mode to kernel mode and back,reduced privileges. For example, they cannot access the mapping kernel symbol information, and troubleshootingLinux kernel’s memory or hardware directly. This is designed difficult defects that span across user and kernel space. Noneto prevent damage to the underlying system by an of these issues is easily solved with agent-based debuggingapplication. Therefore, the Linux kernel is responsible for solutions such as the kernel GNU debugger (KGDB) or theproviding all system-level access. It allows the application GNU debugger (GDB).software controlled access to the system, includingperipherals and memory. Debug Challenges in LinuxIn a Linux system, applications typically run in user mode • Hardware initializationwhile device drivers run in kernel mode. This scheme aids in • Debugging the bootloaderprotecting the core (Linux kernel) from potential systemcrashes or reduced system availability but has the trade-off • Access to instruction and data cacheof reduced performance, as Linux kernel modules typically • Access to initialization code in the Linux kernelhave better performance than user-space applications. • Debugging interactions between applications and Linux kernelUnlike simpler “flat” or “statically” allocated 8-, 16-, and32-bit operating systems utilized in many embedded devices,Linux implements an advanced technique of virtualaddressing. Virtual addressing allows Linux kernel modules The Bootloaderand applications loaded and running in the system to appear Linux relies on a bootloader to start the OS. The bootloaderto be in a continuous memory address space, while the actual is code that resides in flash or other nonvolatile memory andlocation of the software in physical memory may be executes after the system is powered on or reset. Low-levelfragmented across multiple memory regions. The Linux initialization of the CPU, memory, and critical I/O andkernel handles memory mapping and memory allocation for peripherals is performed by the bootloader. Once bootloaderLinux kernel modules and applications. Statically mapped execution starts, it copies itself to RAM and then it starts thememory management, used for the Linux kernel and Linux Linux OS.kernel modules, involves mapping from virtual to physical Bootloader Debug Issuesaddressing with a defined constant (e.g., offset). Dynamicmapping from virtual to physical memory, used for user- Debugging the bootloader can be quite complex because itmode applications, may use complex methods to map data in is hardware-centric and developers must contend with thephysical memory. bootloader relocating from flash to RAM after startup. With modern system-on-chip (SoC) processors there can beThe Linux kernel also has the ability to allocate processes hundreds of configuration registers that need to beinto memory to run; processes may include Linux kernel initialized. This requires perusal of thousands of pages ofmodules or user-mode applications. These processes can be documentation on specific settings. Setting the wrong valueallocated into memory to complete a specific task and then on registers could cause issues downstream when startingbe removed once they are no longer needed, providing the Linux kernel or debugging applications. Manual editingbetter system memory management. Therefore, when to set registers is a very cumbersome process.traversing memory from application to the Linux kernel and2 | Accelerating the Development of Embedded Linux Devices with JTAG On-Chip Debugging
  3. Another common challenge with bootloader development is kernel module debug will also require transparency ofdebugging issues that occur as the bootloader loads Linux initialization code while dealing with dynamically allocatedinto RAM and launches the OS. As the bootloader loads the memory in RAM.Linux kernel into physical memory, the kernel creates its own KGDB requires a stable Linux kernel and custom hardwarevirtual memory map, which often makes it difficult to interfaces such as device drivers to be ready for the agent todetermine which addresses the kernel is using. Therefore, it work. Agent-based debugging does not have the visibilitycan be quite complex to determine how to relocate the into the hardware and does not provide the full diagnosticsymbol table for the Linux OS once the kernel begins capabilities required to understand the interaction betweenexecuting out of RAM. Unfortunately, agent-based the hardware and the Linux kernel. Agents requiredebugging solutions do not support bootloader debug instrumentation of the Linux kernel and this may cause sidebecause the OS is not functional during this process. effects in embedded devices.Therefore, developers rely on JTAG tools for debugging thiscritical process. Other considerations when using agents to debug the Linux kernel and kernel modules involve stopping or freezing the system when a breakpoint is hit. For example, KGDB will not Spending a significant amount of time developing and stop the CPU (especially in a multicore or multiprocessing debugging the bootloader may prevent developers from environment) to permit the developer to examine the current focusing on stabilizing and debugging device software state of the system. KGDB will not help debug a crashed and applications. system because it requires an operational system for the agent to work. Additionally, KGDB requires a communicationSimplifying Bootloader Debug port such as Ethernet to communicate from a host system toAgent-based debug solutions such as KGDB and GDB will not the target. Therefore, using an agent for Linux kernel-modework for bootloader debug. However, JTAG debug solutions debug requires that a communication channel be establishedprovide powerful capabilities to help developers quickly and with a working IP stack, a stable Linux kernel, and workingefficiently troubleshoot and test the bootloader. With JTAG device drivers. This may be a challenge during OSdebug solutions, developers are easily able to set register stabilization where such communication facilities may not bevalues and peruse register contents easily. The ability to set available or may themselves be required to be debugged.hardware breakpoints enables code stepping in flash Using JTAG to Debugmemory to quickly identify the source of errors. IDEs thatsupport disassembly and mixed modes for viewing of source Comprehensive debugging solutions that operate with thecode along with assembly code simplify the debug process. Linux kernel and kernel modules are needed to validate andPowerful symbol management capabilities can help with debug stabilize the Linux kernel for a target system. JTAG-basedby accounting for the relocation of code from flash to RAM. debugging solutions offer significant value in this workflow. Features of these JTAG-based debugging tools include theAn added benefit of some JTAG debug solutions is the ability ability to view local/global symbols and registers as well asto load the Linux kernel without a bootloader. This capability view data and instruction cache contents. Some commercial-is accomplished with the use of boot line parameters and is based JTAG solutions provide seamless address mappingparticularly useful for those project managers intending to from virtual to physical memory, allowing the developer tostart development of their systems even before thebootloader is ready and available. JTAG-based solutions that Softwareprovide a boot line capability enable parallel bootloaderdevelopment and OS stabilization and help shortendevelopment schedules. App1 App2Linux Kernel and Kernel Modules ApplicationsLinux kernel and kernel modules are the core components ofthe Linux OS. The Linux kernel is the first to start after thesystem has been initialized by the bootloader. Linux kernel Linux Kernelmodules are then loaded as needed. Kernel Modules (Device Drivers)During the period of OS bring-up, developers focus on theoptimization or customization of the Linux OS and thedevelopment of kernel modules. Interaction between the I/O Interruptshardware and software is monitored very closely during thisphase. For Linux kernel debugging, developers require Hardwarevisibility to registers, caches, and other low-level data. Linux Figure 3: Software and Hardware Interaction in Linux3 | Accelerating the Development of Embedded Linux Devices with JTAG On-Chip Debugging
  4. view the correct memory address and content. These Keeping track of memory addresses when stepping into andsolutions permit debug of the initialization of Linux kernel out of the two modes is challenging because of the virtualmodules and the ability to load and unload these multiple memory management structure of Linux. Relying on the sametimes without having to disconnect and reconnect to the physical address will not work. Correctly keeping track oftarget system. memory mapping and memory allocation during this process is critical. As a result, agent solutions require the use of bothThe ability to completely halt the system and examine the GDB and KGDB to trace system calls into the Linux kernel andstate of the OS and applications is a powerful feature of JTAG kernel modules. The use of multiple agent-based debugdebug solutions. Known as system mode debug, this tools may complicate the debug process.capability is extremely useful for Linux kernel and Linuxkernel module debug. With system mode debug, the Linux application developers may also encounter embeddeddeveloper has the ability to stop the entire system, including systems that do not have an Ethernet or serial communicationthe processor, OS, and all threads, and interrupt processing. port on the device. In these cases, agent-based debuggingBy stopping the system in this manner, it is possible to obtain cannot be used. Even if the device has a communication port,detailed views of the hardware and software. It is also possible agents require that the interface be ready. If theto restart the system and to step through code after restart. communication port is not ready or requires debug, or the memory is not available for the IP stack or agent software, A JTAG solution will work when KGDB cannot, especially agent-based debugging will not work. in Linux kernel panic and target crash conditions. These JTAG-based debugging provides deep visibility into capabilities are particularly useful for stabilizing device applications that are operating in Linux user mode. For drivers and the OS. applications that make system calls, the dual-mode JTAG debugging solution permits visibility into both the Linux kernel and user mode. All of this occurs without any LinuxLinux Application Debug kernel instrumentation. The dual-mode solution enablesLinux applications are user programs that run under the viewing of all application threads, their contexts, and whichcontrol of the Linux kernel. Linux applications gain access to threads entered the Linux kernel, as well as the parameterssystem resources by making system calls. The Linux kernel used and the thread variables. For devices that lack ahandles the system calls and it decides how to provide access communication port (e.g., mobile devices, medical devices,to hardware and memory. automotive systems, etc.), JTAG-based solutions provide anFor user-mode application debugging, developers require excellent alternative to agent-based debug.direct access to application threads with the ability to startand stop a thread and viewvariables and the stack. Sincean application may consist ofmany processes or threads, itmay be necessary to stop allthreads related to theapplication thread beingdebugged, including threadsthat may influence theapplication. It may also benecessary to watch peripheralregisters across differentprocesses and CPUs. GDBonly operates at the threadlevel and is only able to stop asingle thread. GDB is not ableto stop an entire system ormultiple threadssimultaneously.Developers debugging inuser mode will requirestepping into system callsfrom user mode to Linuxkernel mode and back. Figure 4: An Eclipse-Based IDE for Linux Application Debug4 | Accelerating the Development of Embedded Linux Devices with JTAG On-Chip Debugging
  5. Debugging multithreaded applications is simplified with theuse of system-mode debug, which is the ability to halt theprocessor and examine the state of the OS and all threads. As Wind River On-Chip Debuggingmentioned previously, many problems occur due to theinteraction of multiple threads. Since agent-based debuggingcan’t stop all threads simultaneously, it can be harder topinpoint problems, which means it can take significantlylonger to debug a project. System-mode debug permits adetailed view of the current state of the system (e.g., each Ethernetthread’s state, variables, etc.) and is a better alternativecompared to agent-based debug because it allows full view of Linux Target Systemthe system at a given point in time.The JTAG-based debug solution is a nonintrusive connection JTAGto the target hardware. It can connect to systems already Connectionrunning that have hit errors. It can connect without changingthe state of processor registers and synchronize contexts forthe Linux kernel and applications to debug. An example is aLinux-based system stuck in a deadlock condition. With a Figure 5: Wind River JTAG-Based On-Chip Debugging SolutionJTAG solution, the developer may connect to the targetsystem without altering its state. The developer then is able to Advanced Wind River Solutions for Linux Debugview Linux kernel objects, application contexts to determine Running on the industry-standard Eclipse-based platform,the threads, system calls, and parameters used for system Wind River Workbench, On-Chip Debugging Edition offerscalls that caused the fault condition. It is a single end-to-end advanced JTAG-based debugging features for embeddedsolution especially useful where an agent-based development Linux systems. Workbench On-Chip Debugging supportssolution cannot be used. JTAG debugging reduces Wind River Linux. For roll-your-own Linux or semiconductordebugging time through development tool simplicity. Linux distributions, Wind River has extended the on-chip debugging capabilities to enable JTAG-based kernel andWind River Solutions for JTAG-Based Linux Debug user-mode debugging of kernel.org Linux. Wind RiverJTAG-based on-chip debugging solutions from Wind River debugging solutions support a variety of target hardware,complement rather than replace popular agent-based including the most advanced multicore processors.solutions. Solutions that aren’t JTAG-based such as theagent-based KGDB and GDB may not be suitable for early-stage development, such as bootloader debug, OSstabilization, and device driver debug. This can impact thedevelopment of products that rely only on agent-baseddebugging.Typically, most devices include JTAG ports to enabledebugging and testing. However, many consumer products—particularly those that are highly price-sensitive, spaceconstrained, or memory constrained—do not include acommunication port that is necessary to perform agent-baseddebugging. In other cases, agent-based debugging is notavailable because of stringent physical and memory spacerequirements, security concerns, or the lack of an IP stack.JTAG-based solutions are ideal for these environments. Figure 6: Wind River Workbench, On-Chip Debugging Edition and WindJTAG also provides an important view into the overall system River ICE for JTAG-Based Debugthat is not available when using an agent for debug. Given thedual-user and Linux kernel-mode structure of Linux, agent-based debugging using GDB and KGDB may cause difficultyfor developers who need to obtain information regarding theapplication, the OS, and the underlying hardware all at thesame time. JTAG solutions can give important visibility intothese areas simultaneously, making debugging easier andfaster.5 | Accelerating the Development of Embedded Linux Devices with JTAG On-Chip Debugging
  6. processors, or processes. Wind River On-Chip Debugging Workbench On-Chip Debugging supports multiple debug connection types, including JTAG • Bootloader development to debug issues when bringing tools and agents, providing maximum flexibility in debugging up Linux on new hardware Linux systems from bootloader bring-up, Linux kernel and Linux kernel module stabilization, and application • Kernel-mode debugging to troubleshoot OS and device development. driver problems • User-mode debugging without kernel instrumentation, Conclusion communications channel, or IP stack As embedded systems become increasingly more complex, • Advanced features in user-mode debugging to allow debugging has become ever more challenging for developers to see the system and application context, developers. Traditional agent-based Linux debugging including how the Linux kernel was entered and by which solutions for user-mode and Linux kernel-mode debugging thread (or threads), the parameters used, and the thread are less effective and efficient in today’s complex variables environments. JTAG debugging can perform a valuable role • Comprehensive system-mode debugging: breakpoints that in Linux development and improves the edit-compile-debug halt the entire processor and all threads process when integrated with a standards-based development environment such as Eclipse that is properly designed for the Linux environment.Wind River On-Chip Debugging for the Entire LinuxDevelopment Process Solutions such as those offered by Wind River now offer innovative tools that expand on-chip debugging uses andWith Wind River Workbench, Linux developers have the offer powerful alternatives when agent-based debuggingflexibility to use the JTAG connection for hardware bring-up; isn’t available or cost effective. These unique capabilities indebugging the Linux kernel, middleware, and user-mode on-chip debugging integrate effectively with agent-basedapplications; and seamlessly moving to agent-based debugging to improve the debugging performance in evendebugging for Wind River Linux when appropriate, all within the most complex environments. With time-to-marketthe same IDE. These capabilities increase collaboration increasingly important, companies are able to shortenbetween multiple development teams and reduce time development time and reduce cost with on-chip debuggingneeded to resolve problems. solutions from Wind River.Wind River’s solution is designed to handle the needs ofincreasingly complex systems. Remote access to the target Notessystem is possible, enabling improved productivity for 1. VDC, “Linux in the Embedded Systems Market,” Theglobally dispersed development teams. Connection and Embedded Software Market Intelligence Program,configuration management streamlines connections to November 2007.multiple targets, supporting the debug of an entire system,from a single user interface. These connections can be cores, JTAG Agent Solutions Solutions Hardware Bring-Up Bootloader Development On-Chip Debugging Wind River KGDB Kernel Stabilization Kernel Module Development Linux User-Mode GDB Application DevelopmentFigure 7: Wind River On-Chip Debugging Provides Broadest Linux DevelopmentCoverage Wind River is the global leader in Device Software Optimization (DSO). We enable companies to develop, run, and manage device software faster, better, at lower cost, and more reliably. www.windriver.com © 2008 Wind River Systems, Inc. The Wind River logo is a trademark of Wind River Systems, Inc., and Wind River and VxWorks are registered trademarks of Wind River Systems, Inc. Other marks used herein are the property of their respective owners. For more information, see www.windriver.com/company/terms/trademark.html. Rev. 01/2008

×