Copyright © 2009 Accenture. All Rights Reserved. 1
QEMU Simulator & Symbian Foundation
Johnathan White
Accenture
Copyright © 2009 Accenture. All Rights Reserved. Accenture, its logo, and High Performance Delivered are trademarks of Accenture.
QEMU Simulator & Symbian Foundation Johnathan White SEE October 2009
Copyright © 2009 Accenture. All Rights Reserved. 3
Agenda
• Simulator Introduction & Architecture
• Running Simulator
• Building/Debugging Simulator
• Simulator Features/Demo
• GUI environment
• Questions
Copyright © 2009 Accenture. All Rights Reserved. 4
Simulator not Symbian Emulator
• Existing Symbian Emulator is x86 based – Requires entire environment built for x86 – Requires different tool chain – Often doesn’t accurately map hardware leading to
integration issues
• Simulator is ARM based – Single environment and tool chain required – Accurate mapping of hardware environment
Copyright © 2009 Accenture. All Rights Reserved. 5
What is QEMU ?
• QEMU is a machine emulator which enables guest (Symbian) to run on host environment
• Emulates full hardware platform including CPU and peripherals
• QEMU is open source (http://www.qemu.org/)
• Wide QEMU usage in the industry
Copyright © 2009 Accenture. All Rights Reserved. 6
Baseport
• Symbian baseport (Syborg) required for Symbian to function on QEMU virtual hardware platform
• Baseport comprises of ASSP/Variant code as well drivers and kernel extensions
• Code above baseport is common between Simulator and other target hardware
Copyright © 2009 Accenture. All Rights Reserved. 7
Symbian
QEMU
Host
USER SPACE
KERNEL SPACE EUSER
SYBORG BASEPORT
DEVICE DRIVERS
KERNEL EXTENSIONS
ASSP / VARIANT
KERNEL NANO KERNEL
HOST OS API’s
SYBORG BOARD MODEL PERIPHERALS
BINARY TRANSLATION
ARM
HOST
HOST ENV – Windows, Linux, MAC
Hardware
Overall Architecture
Copyright © 2009 Accenture. All Rights Reserved. 8
Simulator – EPL Kernel kit
All “ingredients” required to create and run a basic Symbian image in QEMU are released under EPL and thus available to all
Symbian
QEMU
Host
Pre-compiled Syborg baseport provided (\epoc32\release\armv5\urel &udeb)
Syborg source code provided (\sf\adaptation\qemu\baseport\syborg) Binaries Required to create Symbian TextShell Rom Image
Pre-compiled QEMU (\symbian-qemu-0.9.1\bin)
QEMU source code provided (\sf\adaptation\qemu\symbian-qemu-0.9.1-12)
QEMU environment compiled for win32 environment
SF Mercurial repo - http://developer.symbian.org/oss/FCL/sf/adaptation/qemu
Copyright © 2009 Accenture. All Rights Reserved. 9
QEMU Simulator … its alive !
• First build a textshell Symbian ROM \sf\os\kernelhwsrv\kernel\eka\rombuild> rom -v syborg -i armv5 -b udeb
• Then run ROM image in QEMU \symbian-qemu-0.9.1\bin> arm-none-symbianelf-qemu-system.exe -kernel \sf\os\kernelhwsrv\kernel\eka\rombuild\syborgarmv5d.img -M \sf\adaptation\qemu\baseport\syborg\syborg.dtb -serial COM2
Creates debug textshell ROM
image file
Launches ROM image in QEMU
simulator
Copyright © 2009 Accenture. All Rights Reserved. 10
PRACTICAL 1
Instructions for Practical 1 & 2 & 3
Copyright © 2009 Accenture. All Rights Reserved. 11
QEMU – Output … and how it works
Display
Debug Port
EShell -> Console Windows Server -> Screen Driver -> LCD Driver -> Frame Buffer -> Host
Kernel code -> Debug Handler -> Syborg UART -> Host UART -> Host UART
Board Model Configuration controlled by DTS file
Copyright © 2009 Accenture. All Rights Reserved. 12
Rebuilding Syborg
• Altering screen size Modify KConfigLcdHeight to be 100 in \sf\adaptation\qemu\baseport\syborg\fb\Syborg_fb.h
• Adding debug print Add Kern::Printf(“Hello World”) to void TPointerRv::Init3() in \sf\adaptation\baseport\syborg\pointer\syborg_pointer.cpp
• Building baseport
\sf\adaptation\qemu\baseport\syborg> sbs -b bld.inf -c armv5_udeb –j 1
• Shows the ease of modification of the environment
Copyright © 2009 Accenture. All Rights Reserved. 13
PRACTICAL 2
Copyright © 2009 Accenture. All Rights Reserved. 14
Debugging Simulator
• GDB Stop Mode Debugging
QEMU contains GDB stub which allows simulation environment to be controlled by GDB debugger
GDB only understands ELF -> need to convert from Symbian E32 image
• Command Line -> Use Eclipse GUI
Further info http://developer.symbian.org/wiki/index.php/QEMU_&_Syborg_Debugging & \sf\adaption\qemu\docs directory
Copyright © 2009 Accenture. All Rights Reserved. 15
Simulator Features
• Display driver • Keyboard /keymapping • Pointer driver • Serial Pdd • Ethernet Pdd • Sound Pdd (dummy) • Host file system (fsy + driver) • Debug Monitor
Copyright © 2009 Accenture. All Rights Reserved. 16
• Simple Console Application
• Source code - \sf\adaptation\qemu\applications\SymbianLogo_TextShell
• Build using command - sbs -b bld.inf -c armv5 –j 1
• Add application into ROM - Modiify \sf\os\kernelhwsrv\kernel\eka\rombuild\Tshell.oby to include line ‘ #include <rom\include\symbianlogo.iby> ’
• Build ROM / Start ROM in QEMU
Simulator Features Demo (1)
Copyright © 2009 Accenture. All Rights Reserved. 17
PRACTICAL 3
Copyright © 2009 Accenture. All Rights Reserved. 18
Simulator Features Demo (2)
• Type “symbianlogo” from prompt Host File System Pointer Driver Keyboard Driver Display Driver
• Where next with the demo Have a play … - Learning - Port image codec onto Symbian - Port audio assets, implement hooks to QEMU audio
hardware - Don’t use console Wserv, create own implementation
for direct input events, create own UI
Copyright © 2009 Accenture. All Rights Reserved. 19
GUI environment …
SF GUI image configuration running in QEMU … not just Text shell
SFL code plus configuration required to allow GUI to boot
All user space code is common allowing for rapid prototyping of product images
Copyright © 2009 Accenture. All Rights Reserved. 20
QT UI environment …
QT apps running on top of SF GUI image
Open source QT from http://pepper.troll.no/s60prereleases/
QT libs and example apps built from source then included in Syborg ROM
Excellent usage of prototyping future technology
Copyright © 2009 Accenture. All Rights Reserved. 21
Next Steps …
• This is just the beginning… – New/enhanced drivers & board model peripherals – Configurations & new directions – Contributions
• Questions ?
• Further information - \sf\adaptation\qemu\docs\
- developer.symbian.org –wiki,forum,articles