QEMU & Syborg Debugging/Vanilla Eclipse
From Symbian Developer Community
| Content Requested This document has been reviewed and the contents are technically correct. However the reviewer(s) consider that the document is incomplete and that it requires further content.
See Document Creation Workflow. |
The Symbian Virtual Platform (SVP) allows stop-mode debugging of Symbian ROM images running on a PC in the QEMU emulator.
Contents |
Preconditions
You require a Symbian image which boots on the Symbian Virtual Platform as described here
Dowload Eclipse
Download and install eclipse from http://www.eclipse.org/downloads
| Note These instructions are based on Eclipse IDE for C++ Developers for Win32 [i.e. this download] |
If you're using some other version of Eclipse which doesn't already have C/C++ support then you'll also need to:
Install the Elipse C/C++ Development Toolkit (CDT)
- In the Eclipse UI select 'Help -> Install New Software
- In the Install menu Work with pull-down-menu choose Galileo - http://download.eclipse.org/releases/galileo
- Expand the Programming Languages menu. Tick Eclipse C/C++ Development Tools and click Next.
- Click Finish
Install the GDB hardware debugger plug-in
- In the Eclipse UI select 'Help -> Install New Software
- In the Install menu Work with box clik the Add button and type in a name and the Location: "http://download.eclipse.org/tools/cdt/releases/galileo".
- Choose the location you just added.
- Click "OK". Now now you should see CDT Main Features and CDT Optional Features in the install menu. Expand the CDT Optional Features menu. Tick Eclipse C/C++ GDB Hardware Debugging and click Next.
- Click "Finish"
Download and install ARM-ELF tools
- Download and run the GNUARM GCC-4.3 toolchain from here: http://www.gnuarm.org/bu-2.19_gcc-4.3.2-c-c++_nl-1.16.0_gi-6.8.exe
Install elf4rom
ELF4ROM creates symbol and debug information for your ROM image. Copy elf4rom.zip from your Symbian syborg environment \sf\os\QEMU\docs\wiki\ELF4ROM.doc (Yes, the zip file is indeed embedded in a Word document!). Extract the content to a local directory. The Word document (ELF4ROM.doc) contains comprehensive documentation.
Debug Setup
Create an ELF file from your Symbian ROM image
Example:
cd \sf\os\kernelhwsrv\kernel\eka\rombuild elf4rom.exe -i SYBORGARMV5D.IMG -l SYBORGARMV5D.log -o SYBORGARMV5D.elf -p 0x0 -d _SYBORG_EKERN.EXE _SYBORG_KASYBORG.DLL _SYBORG_ESERIAL.PDD _SYBORG_EKEYB.DLL
- This example assumes that the location of elf4rom.exe as been added to path environment variable.
- The resulting ELF file in the is SYBORGARMV5D.elf.
Read more about elf4rom usage in \sf\os\QEMU\docs\wiki\ELF4ROM.doc.
Create an Eclipse project
- Create a new directory under your eclipse workspace directory and copy your elf file to the directory.
- Start eclipse.
- Create a new C++ makefile project. File -> New -> C++ Project
- In the resulting C++ Project window expand the Makefile Project and select Empty Project. In the toolchains box select MinGW GCC. Type the directory in which your elf file is located to the Project name field.
- Click Finish
- Right-click the project you just created in Project Explorer view and select Properties.
- Expand C/C++ Build and click Settings. In the Binary parser window un-tick PE Windows Parser and tick GNU Elf Parser.
- Select the GNU Elf Parser option to make the commands addr2line and c++filt visible. Change addr2line to arm-elf-addr2line and c++filt to arm-elf-c++filt. (NOTE: If you dont have the directory of your arm-elf tools defined in your path you must give the full path for these executables.)
- Click OK
You should now be able to to explore the contents of your ELF file in the Project Explorer view of your eclipse environment. To test the environment navigate to syborg_keyboard.cpp and add a break point to DKeyboardPs2Soc::Isr() method.
Create a debug configuration
- In the eclipse UI click Run -> Debug Configurations. Having installed gdbjtag as described above you should see a GDB Hardware Debugging option in Debug Configurations window.
- Right-click GDB Hardware Debugging and click New.
- In the resulting menu choose Main tab. Give a good name to your configuration. Select the project you created in the Project box and type your ELF file name in the C/C++ Application box.
- Select the Debugger tab. Type arm-elf-gdb in the GDB Command box. Un-tick Use remote target.
- Select the Startup tab. Type tar rem localhost:1234 in the Run Commands box .
- Click Close
Start your debug session
- Start simulation
- Start a command prompt and dir your way to you eclipse project directory you just created - the one your elf file is located at.
- Start your QEMU syborg Symbian simulation.Example: <your path to QEMU build environment>qemu-symbian-svp\arm-softmmu\qemu-system-arm.exe -M <your path to Symbian PDK syborg environment>\sf\os\QEMU\baseport\syborg\syborg.dtb -kernel SYBORGARMV5D.elf -S -s
- In this phase the QEMU Symbian simulation window should appear (with QEMU [Stopped] label on it)
- Connect debugger to simulation
- In your eclipse UI click "Run" -> ""Debug Configurations" -> "Debug". If your eclipse perspective is not switched automatically to Debug click "Window" -> "Open Perspective" -> "Debug".
- Now you should have your Debug configuration visible in "Debug" window.
- Select the arm-elf-gdb.
- You don't need to worry about possible error "No symbol "new" in current context." visible in the Console window.
- In the "Console" window enter "c".
- Now you should have your Symbian simulation booted up.
- Enter a keypress to your Symbian window and you should hit to a previously added breakpoint in DKeyboardPs2Soc::Isr method.
Debug Notes
- Be carefull with your path environment variable setup. For example it seemed to cause problems if eclipse was able to found previous gdb installation (like http://downloads.sourceforge.net/mingw/gdb-6.6.tar.bz2).
- Read more about debugging from your Symbian syborg environment \sf\os\QEMU\docs\wiki\Stop-mode Debugging.doc
Mapping a directory on the host OS to the QEMU S: drive
A very useful feature of QEMU is the ability to map a directory on the host OS to the S: drive.
To do this create a directory called svphostfs in the root of the drive from which QEMU is run. For example, if QEMU is run from the C: drive create C:\svphostfs.
Files can be copied to the S: drive in the emulated Symbian OS environment and they will appear here. This makes retrieval of logs very straightforward.
Additionally you can copy files to the mapped directory (i.e. 'svphostfs') and then copy them to the appropriate location in the Symbian OS instance. You can even create a directory 'svphostfs\sys\bin' and copy binaries there to make them usable in the Symbian OS. This feature reduces much of the need for building ROM images.
Comments
Sign in to comment…



