Success! Subscription added.
Success! Subscription removed.
Sorry, you must verify to complete this action. Please click the verification link in your email. You may re-send via your profile.
KGDB is the Linux Kernel Debugger.
To use KGDB to debug your Nios2 Linux Kernel, you'll need to checkout the most recent unstable-nios2mmu branch and enable the following kernel configuration options:
Kernel hacking --->
[*] Kernel debugging
[*] KGDB: kernel debugger --->
<*> KGDB: use kgdb over the serial console
We will be using the Altera UART for communication to KGDB, thus the console must be on the JTAG UART. Make sure you configure the serial drivers as follows:
Device Drivers --->
Character devices --->
Serial drivers --->
<*> Altera JTAG UART support
[*] Altera JTAG UART console support
<*> Altera UART support
[ ] Altera UART console support
Then add the following bootargs string to your dts:
bootargs = "debug kgdboc=ttyAL0,115200 kgdbwait console=ttyJ0,115200";
Then rebuild your kernel.
After downloading the kernel to your target you should see the boot messages pass by until the kernel pauses with the following log messages:
ttyAL0 at MMIO 0x6000000 (irq = 2) is a Altera UART
kgdb: Registered I/O driver kgdboc.
kgdb: Waiting for connection from remote gdb...
Now start gdb on your development host using:
nios2-linux-gnu-gdb -b 115200
Inside gdb, connect to the target KGDB using (replace /dev/ttyS0 by whatever device you're using, e.g. /dev/ttyUSB0)
target remote /dev/ttyS0
Then load the symbols from your kernel image (assuming you started gdb from inside your uClinux-dist):
symbol-file linux-2.6.x/vmlinux
You can now set breakpoints, e.g. to break on program load:
b load_elf_binary
continue
Happy Debugging!
Community support is provided during standard business hours (Monday to Friday 7AM - 5PM PST). Other contact methods are available here.
Intel does not verify all solutions, including but not limited to any file transfers that may appear in this community. Accordingly, Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.
For more complete information about compiler optimizations, see our Optimization Notice.