Cadence® system design and verification solutions, integrated under our Verification Suite, provide the simulation, acceleration, emulation, and management capabilities.
Verification Suite Related Products A-Z
Cadence® digital design and signoff solutions provide a fast path to design closure and better predictability, helping you meet your power, performance, and area (PPA) targets.
Full-Flow Digital Solution Related Products A-Z
Cadence® custom, analog, and RF design solutions can help you save time by automating many routine tasks, from block-level and mixed-signal simulation to routing and library characterization.
Overview Related Products A-Z
Driving efficiency and accuracy in advanced packaging, system planning, and multi-fabric interoperability, Cadence® package implementation products deliver the automation and accuracy.
Cadence® PCB design solutions enable shorter, more predictable design cycles with greater integration of component design and system-level simulation for a constraint-driven flow.
An open IP platform for you to customize your app-driven SoC design.
Comprehensive solutions and methodologies.
Helping you meet your broader business goals.
A global customer support infrastructure with around-the-clock help.
More Support Log In
24/7 Support - Cadence Online Support
Locate the latest software updates, service request, technical documentation, solutions and more in your personalized environment.
Cadence offers various software services for download. This page describes our offerings, including the Allegro FREE Physical Viewer.
The Cadence Academic Network helps build strong relationships between academia and industry, and promotes the proliferation of leading-edge technologies and methodologies at universities renowned for their engineering and design excellence.
Participate in CDNLive
A huge knowledge exchange platform for academia to network with industry. We are looking for academic speakers to talk about their research to the industry attendees at the Academic Track at CDNLive EMEA and Silicon Valley.
Come & Meet Us @ Events
A huge knowledge exchange platform for academia. We are looking for academic speakers to talk about their research to industry attendees.
Americas University Software Program
Join the 250+ qualified Americas member universities who have already incorporated Cadence EDA software into their classrooms and academic research projects.
EMEA University Software Program
In EMEA, Cadence works with EUROPRACTICE to ensure cost-effective availability of our extensive electronic design automation (EDA) tools for non-commercial activities.
Apply Now For Jobs
If you are a recent college graduate or a student looking for internship. Visit our exclusive job search page for interns and recent college graduate jobs.
Cadence is a Great Place to do great work
Learn more about our internship program and visit our careers page to do meaningful work and make a great impact.
Get the most out of your investment in Cadence technologies through a wide range of training offerings.
Overview All Courses Asia Pacific EMEANorth America
Instructor-led training [ILT] are live classes that are offered in our state-of-the-art classrooms at our worldwide training centers, at your site, or as a Virtual classroom.
Online Training is delivered over the web to let you proceed at your own pace, anytime and anywhere.
Exchange ideas, news, technical information, and best practices.
The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information.
It's not all about the technology. Here we exchange ideas on the Cadence Academic Network and other subjects of general interest.
Cadence is a leading provider of system design tools, software, IP, and services.
Get email delivery of the Cadence blog featured here
Welcome to part 3 of the "Exploring the Virtual Platform" series. For readers just joining please refer to Part 1 and Part 2 of the series to get up to speed.
Today's topic is debugging. One of the great things about a Virtual Platform is the ease of debugging code running on the platform. In the first 2 segments we demonstrated how to compile the Linux kernel and run it on the ARM Integrator platform. As I wrote about last year, step 1 is to run, and step 2 is to debug.
A typical task for a software engineer might be to add a new device driver to the kernel for a custom hardware peripheral. To get a feel for some of the ways used to debug drivers I highly recommend the book Linux Device Drivers. The 3rd edition is available for free as a set of pdf files. Chapter 4 is all about debugging. Some of the ways to debug include:
The last one is probably the most obvious, but doesn't seem to be commonly used. Chapter 4 of Linux Device Drivers states:
"Many readers may be wondering why the kernel does not have any more advanceddebugging features built into it. The answer, quite simply, is that Linus does notbelieve in interactive debuggers. He fears that they lead to poor fixes, those whichpatch up symptoms rather than addressing the real cause of problems. Thus, nobuilt-in debuggers."
Last year, I read an article that support for a debugger in the kernel may be coming, but I haven't followed up on it, mostly because with a Virtual Platform it's not necessary. Let's go back to the ARM Integrator now and see how to start debugging.
The first step is add some arguments to QEMU to tell it to wait for a gdb connection using -s and -S. More details of gdb usage can be found in the QEMU documentation.
jasona@hamlake:[arm-test]% qemu-system-arm -s -S -kernel ~/kernel/linux-22.214.171.124/arch/arm/boot/zImage -initrd arm_root.img
Now, QEMU is waiting for a gdb connection and it says [Stopped] on the toolbar of the QEMU display.
Navigate to the place where the kernel was compiled, start the gdb from the Code Sourcery distribution on the file vmlinux (uncompressed kernel executable), and connect using the target remote command. A good place to put a break point is on start_kernel() and then hit c for continue. gdb will stop at start_kernel() and you are ready to debug the kernel.
jasona@hamlake:[linux-126.96.36.199]% arm-none-linux-gnueabi-gdb vmlinuxGNU gdb (Sourcery G++ Lite 2008q3-72) 188.8.131.5280821-cvsCopyright (C) 2008 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law. Type "show copying"and "show warranty" for details.This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi".For bug reporting instructions, please see:<https://support.codesourcery.com/GNUToolchain/>...(gdb) target remote :1234Remote debugging using :12340x00000000 in ?? ()(gdb) b start_kernelBreakpoint 1 at 0xc000862c: file init/main.c, line 458.(gdb) cContinuing.Breakpoint 1, start_kernel () at init/main.c:458458 boot_cpu_init();(gdb)
There are many interesting things that can be learned using the debugger to understand how the code works. The Integrator platform has 2 UARTs so experiment with breakpoints to see how the UART driver operates. gdb commands like
(gdb) info func uart*
will show all the UART related driver functions. You can understand how the timer works by setting a breakpoint on integrator_timer_interrupt().
Notice the Virtual Platform is stopped when the debugger hits a breakpoint, this is a key benefit of a Virtual Platform, the debugging is completely non-intrusive. There is no need to connect a JTAG box to a board and scan commands in and out of a chip to control and inspect the system.
Another key to remember, you have the source code for the kernel, use it and learn from it. It's a great tool to understand the relationships between hardware and software. For example, think about the timer on the Integrator board. From a C program when the times() function is called, where does this time come from? It must be related to the hardware timer and the kernel must use the timer to provide the the answers about elapsed time.
When I started thinking about this article on debugging I had good intentions to use eclipse to index the kernel source and use the debug perspective in eclipse to connect to QEMU and debug. Over the last couple of years I have tried eclipse a few times and despite my best intentions I just can't enjoy using it. I find there are just too many settings hidden under Properties just to configure it to start the cross debugger, use the remote protocol, specify the file to load, and it seems to go on and on. Even though I didn't try all that long, if it takes more than 3 tries of tweaking settings it's not worth it. I can easily use command-line gdb or ddd and start debugging instantly. I think eclipse is actually popular so if you are interested in eclipse I found one article specific to QEMU and another general one about configuring eclipse for the Linux kernel.
Below is a screen shot of ddd debugging the Linux kernel for the ARM Integrator Virtual Platform.
As always, thanks for reading.