Life of φ
Tuesday, August 9, 2011
Thursday, August 4, 2011
Set Breakpoints in arm-elf-gdb
Breakpoints allow you to run your program up to a desired point.
Set Breakpoint
Run Until Breakpoint is Reached
Set Breakpoint
In arm-elf-gdb, to set a breakpoint use the break command, which can be abbreviated to just b, followed by a label, address, or line number in the .s file.
Examples
Check Breakpointsbreak _startb mainb 0x8004b 17 (set breakpoint at line 17 of the original assembly file)
To find all breakpoints, type info breakpoint. Again, abbreviations can be used to execute the equivalent i b
Run Until Breakpoint is Reached
The command continue will run the program until the next breakpoint. c will perform the same function.
Further Debugging in arm-elf-gdb
Here are a few quick words on using GDB, with particular reference to ARM files.
Inspect Registers
Change Register Values
Formatting Output
Inspect Registers
To have a look at a particular register, use the command print $[register_name]
For example,
print $r0print can be abbreviated to p
print $r1
print $pc
p $r0
p $r1
p $pc
Change Register Values
Use the command print $[register_name] = [value]
For example,
print $r0 = 10Again, the abbreviation p can be used in place of print
print $r1 = 0x20
print $pc = _start
Formatting Output
Format can be specified by using /[symbol] after the print command. Possible symbols are:
a for addressFor example
x for hexadecimal
d for signed decimal
u for unsigned decimal
o for octal
t for binary ('two')
c for character
f for floating point
print/a $pcprint/x $r0p/c $r1p/t $cpsr(Use the last command to check the NZCV and interrupt flags)
Wednesday, August 3, 2011
Online Assembler and Checker for UNSW ELEC2142
Update: Sept 21, 2011
I think all students are finished with this, so I am taking it down. If it's a problem, email me!
I think all students are finished with this, so I am taking it down. If it's a problem, email me!
Tuesday, August 2, 2011
Debugging ARM files with DDD (Simulation)
DDD is a graphical front-end to a variety of debuggers, including arm-elf-gdb.
Installation
Installation
In Ubuntu, install by running sudo apt-get install ddd
For OS X, you can try your luck over here.Usage
With the GNU ARM tools installed, in the terminal run ddd --debugger arm-elf-gdb &
Click File -> Open Program. Select your ELF file (that was assembled with --gdwarf2).
In the GDB console (the bottom pane), type
(gdb) target sim
(gdb) load
(gdb) start
You can view the registers by clicking Source -> Registers.
You can now step through the program, set breakpoints, and perform most other functions that GDB is capable of.
Debugging ARM files with arm-elf-insight (Simulation)
Insight is a graphical user interface for gdb, available for use in Cygwin on Windows. Installation is fairly straight-forward.
Usage
Open Cygwin.
Usage
Open Cygwin.
- Assemble and link a .s file, ensuring the '--gdwarf2' option is used.
- Run arm-elf-insight.exe
- Click File -> Open, and select the ELF file.
- Click Run -> Run, or click the running man icon.
- Select 'Simulator' as the Target, and click OK.
- Click 'Yes'.
- For embedded systems debugging, it is good to open both the registers and memory windows under the View menu.
- Step through the program, observing changes in the registers and memory contents. If using flash-v1.s, pay attention to the memory changes at 0x10000000.
Monday, August 1, 2011
Installing GNU ARM Toolchain (Windows)
To install the GNU ARM toolchain in Windows, you will need Cygwin, a tool that lets you use a lot of Unix stuff.
Installing Cygwin
That's all, folks!
Installing Cygwin
To install, download and run setup.exe. You won't need to select any packages yet, unless you are a UNSW ELEC2142 student. In this case, install the following packages:Installing the GNU ARM Toolchain
make (under 'Devel')(If you have already installed Cygwin without these packages, just run setup.exe again.)
expect (under 'Interpreters')
Download the latest Windows toolchain from http://gnuarm.com/. At time of writing, that means grabbing this file.
Run this file, and accept all defaults.
If you launch Cygwin, and type arm-elf- and then hit 'Tab' twice, you should see a list of 24 executable files.
That's all, folks!
Subscribe to:
Posts (Atom)