The Artima Developer Community
Sponsored Link

Weblogs Forum
Setting Up for Emulation

1 reply on 1 page. Most recent reply: Feb 3, 2008 2:06 AM by bug not

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Nancy Nicolaisen

Posts: 24
Nickname: nancyn
Registered: Oct, 2007

Setting Up for Emulation (View in Weblogs)
Posted: Jan 8, 2008 9:05 AM
Reply to this message Reply
You can learn a lot from observing little kids: Avoid the people your dog dislikes; chasing the cat is more fun than catching it; and ALWAYS look between the bread before you bite the sandwich. This last, in a nutshell, is why Symbian C++ developers need emulators.
Tooling Up for Emulated Debugging

Device emulation is an important tool because it can save you so much time. Using the S60 emulators, you can move through early phases of the design/code/test cycle for smartphone software almost as quickly as for desktop applications. It is, of course, ultimately necessary to do on-device debugging and testing, but emulation lets you weed out a good many problems before you get there. To a large extent, emulators are faithful representations of devices they proxy. They remove physical limitations and the potential for blocking introduced by debugging over the wire, executing emulated apps up to several orders of magnitude faster. It only makes sense to get as close as possible to the final product before you begin on-device debugging.

In this outing, we get our emulation mojo working, so to speak: We’ll use the command prompt window to ensure we have the correct Symbian SDKs installed. Next we’ll generate a basic Carbide C++ HelloWorld application so that we’ll have something to run on the emulator. We launch the app directly to emulation from the IDE and check configuration properties in a single step. In addition, we’ll try a standalone launch of the emulator from the command line.

Checking For the Correct SDK Versions

First, we verify that we have the correct Symbian S60 SDKs installed and configured. ( Check the previous post for a walk through if you haven’t already got them in place. )

• Open the command prompt

• Type: devices

This command displays installed Symbian SDKs. For my system it reports: - default

Notice two things here. First, the is the default SDK. To change the default SDK using the command prompt window, use the -setdefault option of the devices command as shown below.

C:\ devices -setdefault

And second, notice that I have one more SDK than described in the setup steps in the last blog. For both of these two SDKs, there are stable Carbide.C++ emulators. Either of them will serve you for testing and exploring upcoming code examples. It is absolutely essential however, that the emulator and the compiled code match each other’s SDK version. To verify this, you can check project properties, run configurations or debug configurations, all of which are accessed by right clicking on the top folder in the project pane of the IDE.

Creating a Hello World Project to Test The Emulator

We need a simple application we can use to test the emulator installation and function. Wake up Carbide.c++ and follow these steps to generate a HelloWorld test app:

• From the main menu bar, select File.New

• Choose Project

• From the list of project types, choose Symbian OS C++ Project

• From that list, select S60 3rd Edition GUI Application. Note the checkbox labeled “Filter Templates based on available SDKs”. Keep this checked.

• Select the build target that corresponds to the emulator you have installed and designated as default.

Launching HelloWorld in the Emulator

From the Carbide Project Window, verify the emulator target by right clicking the project file and choosing Run As, and then choosing Run from the floating menu this summons.

This displays the Create, Manage and Run Configurations dialog. If everything is on track, here you’ll see the project name and two paths – one for the executable and one for the emulator. These paths should be identical up to the terminal elements. On my system, they look like this:

Project: HelloWorld

Executable: C:\Symbian\9.2\S60_3rd_FP1_2\Epoc32\release\WINSCW\UDEB\HelloWorld_0xE8414F81.exe

Emulator: C:\Symbian\9.2\S60_3rd_FP1_2\Epoc32\release\WINSCW\UDEB\epoc.exe

If the path strings differ at all before the final backslash, you have a mismatch between the emulator and the application. You can fix that by changing the emulation default or recompiling to target the current default emulator.

If you click the Run button at the bottom of the dialog, you launch the app in the emulator. This will give you time for around a dozen deep breaths, a quarter of a cup of coffee or a quick check of your email.

At this point, I typically receive an emulator status message which reads ”Application closed: ncnlist KERN-EXEC 3”. On the left side of the button bar you’ll see a control labeled “OK”. Click on the button below to clear the message and display the emulator home screen.

In the column on the left side of the emulator skin, click the third option button (below the camera button and above the scroll keys). This displays the menu screen. Navigate to the “Installed” icon, select it and you’ll see HelloWorld, along with any other apps that have been compiled to the emulator target. Select and run HelloWorld.

At the risk of being tedious, I’ll mention one thing which still snags me occasionally. You must navigate the emulator using its control keys. Once in a while I find myself furiously mousing over something on the emulator skin, clicking ferociously away, and seriously frustrated that nothing is happening. So. Pretend it’s a real phone. Use the directional keys and selection button.

Launching From the Command Line

I have noticed that multiple app launches from the Carbide IDE sometimes cause the emulator to feel exactly like I do after shoveling way too much snow for three days running: “Device Won’t Start”. There is an easy work-around for this problem (the emulator balking, not my unwillingness to keep digging ) because the emulator is a standalone tool. You can launch it from a command prompt before or after you start Carbide. For cleanest operation, I do it before I open the IDE.

Change to the SDK directory which contains the emulator and support files, and type the command “epoc” with no arguments. On my system it looks this way:

C: cd \Symbian\9.2\S60_3rd_FP1\Epoc32\winscw

C: epoc

Looking Ahead:

Next time, we’ll toss a couple of breakpoints into HelloWorld and see the emulator in action as a debugging tool.

bug not

Posts: 41
Nickname: bugmenot
Registered: Jul, 2004

Re: Setting Up for Emulation Posted: Feb 3, 2008 2:06 AM
Reply to this message Reply
Thanks for the intro into Symbian programming. I think adding some screenshots will help newbies follow along and get started. Could they be added pls?

Flat View: This topic has 1 reply on 1 page
Topic: Setting Up for Emulation Previous Topic   Next Topic Topic: Fun-Based Consulting

Sponsored Links


Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use