Aug 142009

Developers working on Symbian code have always had problems when it came to testing their apps.  The process is quite a bit cumbersome:

  1. Build your code – Cross compile it for ARMV5 / ARM-GCCE Release
  2. Make your sis installer (unsigned)
  3. Upload the SIS to symbiansigned.com using the Symbian Online Signed program
  4. Click on the confirmation link in your email
  5. Wait for your app to be signed by symbian and recieve the email
  6. Download the app
  7. Install and test (mostly only to realise that you have made the mistake of not installing theCActiveScheduler::Add(this) in your ConstructL. ;-)

The process works… nevertheless, its very very very cumbersome and timeconsuming.  And the debug that you are left with is plain text-statements that you write to a log file and dump it onto the filesystem.  While this method may be good enough for some small apps using the in-built emulator, testing GSM activity and live testing of the application is not quite possible or comfortable there.

There is however, another really good way to debug your app and step thru code and read symbian variable values right from the comfort zone of your PC. Say hello to ODD or On-Device-Debug.

On-Device Debugging has been a prominent feature of Symbian IDE’s right since the Metrowerks CodeWarrior days! Yes, its been there… but back then, prior to Symbian OS 9.0 / S60 3.0, it was used more for JTAG based debugging.



Now, with Carbide, virtually any app can be set to debug mode and tested with ODD. And in this post, I will show you how:

Requirements: ;-)

  1. Carbide 2.0 – The eclipse based IDE is at v2.0. Its free and is absolutely amazing to use. Next best thing since notepad for writing symbian code!!!
  2. S60v3/S60v5 device – For the purpose of this article and impending demo, I am using a Nokia 6210 navigator but any S60v3/S60v5 device should work. (Ideally this is the case but I do not have non-Nokia S60V3/S60v5 devices to test and confirm it…
  3. USB cable / Bluetooth – The code you want to test runs on the device… and you need something to transfer data between the PC and the device… So BT / USB data cable it will be.

SETUP:

And the Steps for getting your ODD setup in place:

First, install Nokia PC suite on your PC.  This dude is important as PC suite contains the basic connectivity drivers for your device.  Without that, your phone wouldnt be able to connect to the PC.

Next up, Fire up carbide. The On-Device debug mode is needed to be setup from the help menu. So… head over to Help -> On-Device Connections.On-Device Connections...You will be presented with a menu like so:New ConnectionSelect between Bluetooth and USB for connecting to your device. The other 2 connectivity methods Serial and TRK2.x are, well, not covered in this tutorial. But just a heads up, Serial connection is when you have a serial cable connecting your device to a physical COM port (so 1990’s) and the TRK2.x is for the TRK debugger which uses the elusive and exhorbitantly costly impossible-to-buy-for-a-indi-dev JTAG cable. So, there… We use either Bluetooth or USB 2.0 cable options to connect with our device. In my case here, its USB.

TRK:

Click on next and head over directly to the install remote agents tab.  This will let us install the TRK client onto the devices. This is a sis file that is tailored for every single S60 version since 3.0.  Lets talk a little bit about the TRK client here.  This app is basically what helps you pause your code and step through when the code is executing on the device.Install Remote AgentsSelect the Application TRK 3.x.x Installer. and click on the install button and fire up the PC Suite installer, proceed to install it.  I would prefer you install the TRK app on the phone memory rather than the mass memory or memory card.

We do not need the Carbide Profiler 2.0 installers. But, Just for FYI sakes, they are apps used to profile processor performance and load.  I seriously do not know what purpose it exactly serves. If you do know, do help me by dropping in a comment :)

Connection:

Once you are done with the installation, fire up the TRK application on the device. Select Options -> Settings and select USB / Bluetooth as your connection method is.  In my case here, its USB.

dodd-1 dodd-2

Once you are connected, the TRK app will show the Status as connected like so…

dodd-3

Here, connected means that the cable is connected to the device.  It DOES NOT mean that you are connected to carbide in any way.  Why it is so… I have no idea!

Now, on carbide, switch to the Set Connection Settings tab in the connection properties window.  In the Connection Settings dialog box, click on the drop-down and you should currently see your device assigned to one of the com ports.COM Connection SettingsSelect the com port your device is detected in, the TRK version installed on your device and click on initiate testing.Connection Successful A connection successful message would mean that your TRK on the device is detected and you are good to go.  If it fails, its mostly the COM port being selected wrong.  I really have no idea how to fix this, but yeah, a trial and error run with some com ports should work always! :-)

Hit Finish, And we’re good to go do some code-debugging on carbide!!! :-D

To take a look at the remote connections, Hit Window –> Show View –> Other. Expand the Carbide.C++ list, select Remote Connections and click on OK. You will be presented with a list of remote connections you currently have.Remote ConnectionsRemote ConnectionsDebugging:

To start with debugging, open your Symbian C++ project and in build options, select Phone debug (GCCE). Hit the build.Phone Debug (GCCE)Once the build is fine, hit debug. Since we do not have a debug configuration for GCCE Phone debug, carbide will ask us to create a new configuration like so:New Debug ConfigurationSelect the Application TRK Launch Configuration, and click on next. The remote connection we created earlier is listed and selected automatically. Proceed to the next step where it asks for the SIS file to be installed. Carbide has already filled up the necessary information. We just need to add a few things.

Now, click on the Modify Sis builder settings for build configuration link just below the Sis File dialog box.  This will open a new dialog box where the only things we need to modify are as below:

  • Enable the partial Upgrade checkbox. This will help quickstart the debug as the whole sis file is not re-created and signed. Only the delta is sent across to be debugged again…
  • Select the configuration and click on Edit. You will notice that the Self Sign sis file option is selected already.

Good, now wind up and head out… Once you hit finish, carbide starts up the debugger and switches to the debug perspective. The application will be packaged, signed, transferred to the device, installed on the C/ E drive that you choose, and started up.  Provided you have already set a breakpoint, the code will execute till that point and you have control to step through then on.Debug ModeSo, there you go… On Device Debugging for S60 apps on Carbide.  Have fun coding…

Chao!

Posted by Cruisemaniac Tagged with: , , , , , , , , , , , ,
Get Adobe Flash playerPlugin by wpburn.com wordpress themes