Changes between Initial Version and Version 1 of Getting-Started/Symbian-1x


Ignore:
Timestamp:
Apr 29, 2013 9:22:43 AM (11 years ago)
Author:
nanang
Comment:

Copy Getting Started Symbian page to Symbian-1x

Legend:

Unmodified
Added
Removed
Modified
  • Getting-Started/Symbian-1x

    v1 v1  
     1= Getting Started: Building and Debugging PJSIP on Symbian S60 3rd Edition Device using Carbide C++ = 
     2[[TracNav(Getting-Started/TOC)]] 
     3 
     4Deploying PJSIP on Symbian S60 is recommended only on real devices as the emulator has audio and networking problems. 
     5 
     6This document covers the following topics: 
     7 
     8[[PageOutline(2-3,,inline)]] 
     9 
     10 
     11---- 
     12 
     13== Requirements == 
     14 
     15For this tutorial, we will need: 
     16 - [http://www.forum.nokia.com/info/sw.nokia.com/id/4a7149a5-95a5-4726-913a-3c6f21eb65a5/S60-SDK-0616-3.0-mr.html Symbian S60 3rd Edition Maintenance Release (MR)]. We also have tried this on FP1. Other SDK versions may work, but I did not test it. 
     17 - [http://www.forum.nokia.com/info/sw.nokia.com/id/dbb8841d-832c-43a6-be13-f78119a2b4cb.html Carbide C++ version 2.0]. You will need choose Developer Edition during install to do on-device debugging. 
     18 - [http://europe.nokia.com/A4144903 Nokia PC Suite] for the connectivity between the device and your PC (I use version 6.85) 
     19 - [wiki:Getting-Started/Download-Source pjsip source code] 
     20 - [wiki:S60-Phones-Supported Nokia S60 3rd Edition device] (I use Nokia E70, but any S60 3rd Edition device should do, I think). The date and time of this device need to be the same as development PC otherwise you may get certificate errors. 
     21 - Nokia data cable for on-device debugging (you can also use Bluetooth connection, but this tutorial will not cover it) 
     22 
     23---- 
     24 
     25== Installations == 
     26 
     27=== SDK === 
     28 
     29Follow the installation instructions in the SDK documentation (make sure that the SDK requisites, such as [http://downloads.activestate.com/ActivePerl/Windows/5.6/ Perl version], are satisfied). Please install Symbian SDK on the same drive as PJSIP. 
     30 
     31=== Carbide === 
     32 
     33Follow the installation instructions in the Carbide C++ documentation. The installation should be straightforward, but don't forget to '''select the Developer's Edition''' to get the On-Device debugging/TRK Debugging feature. 
     34 
     35=== Nokia PC Suite === 
     36 
     37Install PC Suite, connect your device with the USB cable, and make sure your PC can access your device.  
     38 
     39==== Connect Data Cable ==== 
     40 
     41Connect the USB cable to the phone, and on the phone, select '''PC Suite''': 
     42 
     43[[Image(DevelopingSymbianAppWithCarbide:phone_usb.JPG)]] 
     44 
     45If this is the first time you connect your phone to the PC, then it may take some time for Windows to install the USB drivers for the phone. Wait for it to complete and the Nokia PC Suite and PC Sync icons on the task bar tray become green: 
     46 
     47[[Image(DevelopingSymbianAppWithCarbide:pc_suite.JPG)]] 
     48 
     49Leave PC Suite running with the device connected using the USB cable throughout this tutorial session. 
     50 
     51=== PJSIP === 
     52 
     53Retrieve and configure PJSIP: 
     54 1. For this tutorial, I assume pjsip will be checked out to '''{{{C:\project\pjproject}}}''' directory. 
     55 1. Checkout PJSIP from the usual location (see [http://www.pjsip.org/download.htm PJSIP Download page] for details).  
     56 1. Fill in your '''{{{config_site.h}}}''' with: 
     57{{{ 
     58#include <pj/config_site_sample.h> 
     59}}} 
     60 
     61---- 
     62 
     63== Importing PJSIP Projects == 
     64 
     65 
     66Run Carbide C++. When it asks the workspace location, enter a directory where you would want to put Carbide specific settings for PJSIP (or just accept the default value): 
     67 
     68[[Image(DevelopingSymbianAppWithCarbide:carbide-workspace.JPG)]] 
     69 
     70You will now be presented with Carbide Welcome page. 
     71 
     72 
     73Now we need to import PJSIP's project files (the MMP files) into Carbide's workspace.  
     74 
     75Select '''File''' --> '''Import''' from the menu: 
     76 
     77[[Image(DevelopingSymbianAppWithCarbide:file_import.JPG)]] 
     78 
     79This dialog below will pop up. Select '''Symbian OS''' --> '''Symbian OS Bld.inf file''' from the list, then press '''Next''' button: 
     80 
     81[[Image(DevelopingSymbianAppWithCarbide:import.JPG)]] 
     82 
     83On the next dialog, click '''Browse..''' button to select '''bld.inf''' file from PJSIP's {{{build.symbian}}} directory, then press '''Next''' button: 
     84 
     85[[Image(DevelopingSymbianAppWithCarbide:import_bld.JPG)]] 
     86 
     87Then on the SDK selection dialog, select the build configurations that you want to support. For this tutorial, select WINSCW and GCCE from S60 3rd Edition MR SDK, and press '''Next''' button ('''do not select ARMV5 unless you have the commercial ARMV5 compiler'''): 
     88 
     89[[Image(DevelopingSymbianAppWithCarbide:import_sdk.JPG)]] 
     90 
     91You will then presented with MMP selection dialog. Leave the default selection (normally it should select all MMPs) and press '''Next''': 
     92 
     93[[Image(DevelopingSymbianAppWithCarbide:import_mmp.JPG)]] 
     94 
     95The project now is ready to be imported, press the '''Finish''' button: 
     96 
     97[[Image(DevelopingSymbianAppWithCarbide:import_finished.JPG)]] 
     98 
     99Carbide is now exporting the MMP files into the workspace and this progress window will be displayed: 
     100 
     101[[Image(DevelopingSymbianAppWithCarbide:import_creating.JPG)]] 
     102 
     103Wait for the process to complete. 
     104 
     105Once it completes, you will see the PJSIP project tree on the bottom left part of the Carbide main window: 
     106 
     107[[Image(DevelopingSymbianAppWithCarbide:carbide_main.JPG)]] 
     108 
     109On the '''Problems''' pane (bottom center of the main window) you may see one ''Warning'' about duplicate path, but we can ignore this for now. 
     110 
     111The projects should now be ready to be build. 
     112 
     113---- 
     114 
     115== Building the Projects == 
     116 
     117Let's try to build the project first to make sure that the source is okay. 
     118 
     119=== Select the Build Configuration === 
     120 
     121First select the build target by selecting '''Project''' --> '''Build Configuration''' --> '''Set Active''' from main menu (or right clicking the ''Bld.inf'' or ''pjproject'' item from ''Symbian Project Navigator'' pane from the bottom left part of the main window).  
     122 
     123Select '''Phone Debug (GCCE) [S60_3rd_MR]''' from the menu: 
     124 
     125[[Image(SetActiveBuildConfiguration.png)]] 
     126 
     127=== Build the Project === 
     128 
     129Then right click ''Bld.inf'' or ''pjproject'' item from ''Symbian Project Navigator'' pane from the bottom left part of the main window, and select '''Build Project''': 
     130 
     131[[Image(build-project.png)]] 
     132 
     133Wait for the build process to complete. You may take a peek on what Carbide is doing by clicking on ''Console'' pane/tab in the bottom part of main window. 
     134 
     135Once it completes, watch out for any errors in the ''Problems'' pane (at the bottom center). There shouldn't be any errors, although there may be few warnings which I think can be ignored, for now: 
     136 
     137[[Image(DevelopingSymbianAppWithCarbide:build_problems.JPG)]] 
     138 
     139We are now ready to build the .sis/.sisx file to be deployed to the phone. 
     140 
     141 
     142---- 
     143 
     144 
     145== Preparing the .sis/.sisx File == 
     146 
     147The .sis file is the packaging for the executable to be deployed in the device. The .sisx file is a signed .sis. Both the .sis and .sisx file can be created very easily with Carbide C++. 
     148 
     149 
     150=== Set the .pkg File to be Used === 
     151 
     152First we'll need to configure the .pkg file to be used to generate the .sisx file. PJSIP provides some sample .pkg files which can be used, however there may be few editing needed before you can use them (this is because the .pkg file contains absolute directory path for your Symbian SDK, which may be different on your installation). 
     153 
     154Assign the .pkg file to be used by the project by selecting Project Properties: 
     155 
     156[[Image(DevelopingSymbianAppWithCarbide:project_properties_menu.JPG)]] 
     157 
     158Then Project Properties dialog will appear. On this dialog: 
     159 
     160 1. Select ''Carbide Build Configuration'' from the tree (left part of the dialog). 
     161 1. Make sure that the Active Configuration is set to '''Phone Debug (GCCE) [S60_3rd_MR]''' (the SDK name will be different, if you use different SDK version) 
     162 1. Set the ''PKG File'' by clicking ''Add'' button, and choose {{{symbian_ua.pkg}}} from PJSIP's {{{build.symbian}}} directory. 
     163 
     164[[Image(add-sis-builder.png)]] 
     165[[Image(select-pkg.png)]] 
     166 
     167We can leave the "SIS creation and Signing" settings empty to use the default settings. 
     168 
     169Press ''OK'' button to save the project configuration. 
     170 
     171[[Image(add-pkg-file.png)]] 
     172 
     173Now right click '''bld.inf''' (or '''pjproject''') and click '''Refresh''': 
     174 
     175[[Image(DevelopingSymbianAppWithCarbide:project_refresh.JPG)]] 
     176 
     177Wait for few seconds (30 seconds on my computer) for Carbide to do its job, once it's done, you will see the .pkg file in the ''Project Navigator'' pane: 
     178 
     179[[Image(pkg-in-explorer.png)]] 
     180 
     181 
     182=== Build the SISX File === 
     183 
     184Once PKG has been setup on the project, a SISX file will be created everytime we build the project. So lets build the project now. 
     185 
     186Right click ''Bld.inf'' or ''pjproject'' item from ''Symbian Project Navigator'' pane from the bottom left part of the main window, and select '''Build Project''': 
     187 
     188[[Image(build-project.png)]] 
     189 
     190The build process will start. You can take a peek on the '''Console''' tab to see what's being done. Once the build process completes, you should see something like this on the '''Console''' tab: 
     191 
     192{{{ 
     193Signing 
     194 
     195***SIS Creation Complete 
     196 
     197Total Time: 12 sec 
     198}}} 
     199 
     200 
     201Check the '''Problems''' tab again to see if we have any errors (there shouldn't be any). 
     202 
     203=== Deploy the sisx file to phone === 
     204 
     205Using Nokia Application Installer (included with PC Suite), try installing the {{{symbian_ua.sisx}}} file, located in the {{{build.symbian}}} directory. It should install successfully. If not, double check: 
     206  * Application Manager has been set to allow all 
     207  * Date and time of phone matches development PC 
     208 
     209---- 
     210 
     211 
     212== Configuring On-Device Debugging == 
     213 
     214Make sure the phone is connected to the PC using the data cable. 
     215 
     216=== Configuring Device Security === 
     217 
     218By default, your phone does not allow self-signed certificate to be installed on the phone, I think. To change this setting: 
     219 1. Go to '''Menu''' --> '''Tools''' --> '''App. Mgr''' 
     220 1. On ''App. manager'', select menu '''Options''' --> '''Settings''' 
     221 1. Set '''Software installation''' to '''All''' 
     222 
     223=== Installing TRK 3.x Application on the Phone === 
     224 
     225Install TRK 3.x support on the phone. You can do this via the On Device Connections menu on Carbide: 
     226 
     227 
     228[[Image(setup-connection.png)]] 
     229 
     230You will be presented with a choice of connections. Choose '''USB''', not {{{TRK 2.x USB}}}. 
     231 
     232[[Image(connection-type.png)]] 
     233 
     234In the next screen, choose the tab '''Install Remote Agent''': 
     235 
     236[[Image(install-remote-agent.png)]] 
     237 
     238You will need to choose the appropriate installer for your phone: 
     239 
     240||'''Phone'''||'''Installer'''|| 
     241||S60 3rd Plain/MR||3.0.0|| 
     242||S60 3rd FP1||3.1.0|| 
     243||S60 3rd FP2||3.2.0|| 
     244||S60 5th||5.0.0|| 
     245 
     246 
     247Now click '''Install'''. 
     248 
     249 
     250When asked if we want to install, click '''Yes''': 
     251 
     252[[Image(DevelopingSymbianAppWithCarbide:trk_install.JPG)]] 
     253 
     254On the PC, this window should be displayed.  
     255 
     256[[Image(DevelopingSymbianAppWithCarbide:trk_wait.JPG)]] 
     257 
     258Leave it this way, the installation will start on the phone now. Your phone should display something like this: 
     259 
     260[[Image(DevelopingSymbianAppWithCarbide:trk_p_install.JPG)]] 
     261 
     262Click Yes. 
     263 
     264Now the phone will display '''Details''' information: 
     265 
     266[[Image(DevelopingSymbianAppWithCarbide:trk_p_details.JPG)]] 
     267 
     268Click Continue. 
     269 
     270Your phone may now display the target memory location: 
     271 
     272[[Image(DevelopingSymbianAppWithCarbide:trk_p_mem.JPG)]] 
     273 
     274Select the memory and press '''Select''' menu. 
     275 
     276Now the phone will display license agreement: 
     277 
     278[[Image(DevelopingSymbianAppWithCarbide:trk_p_lic.JPG)]] 
     279 
     280Click '''OK''' (if you agree, of course). The phone should display installation progress window for couple of seconds now: 
     281 
     282[[Image(DevelopingSymbianAppWithCarbide:trk_p_progress.JPG)]] 
     283 
     284Once it's done, '''Installation Complete''' window will appear briefly: 
     285 
     286[[Image(DevelopingSymbianAppWithCarbide:trk_p_complete.JPG)]] 
     287 
     288TRK is now installed on the phone. Next step is to run it. 
     289 
     290 
     291=== Running TRK Application on the Phone === 
     292 
     293 1. Run it from '''Menu''' --> '''Installations''' --> TRK (it may be different on your phone). 
     294 1. When it asks to switch on Blueetooth, click '''No'''. We use USB cable for this session. 
     295 1. The TRK window will appear. We can ignore the error message for now: 
     296 
     297[[Image(DevelopingSymbianAppWithCarbide:trk_r_welcome.JPG)]] 
     298 
     299 1. Select '''Options''' --> '''Settings''' menu. 
     300 1. Change the '''Connection''' to USB, and leave all settings unchanged. (Note: You may not get the baud rate settings input): 
     301 
     302[[Image(DevelopingSymbianAppWithCarbide:trk_p_usb.JPG)]] 
     303 
     304 1. Click '''Back''' to get back to TRK main window. 
     305 1. Now select '''Options''' --> '''Connect''' from the menu. 
     306 1. TRK main window should display '''Status: Connected''' now. There might less info on newer version of TRK, but as long as it says Connected, you're good to go: 
     307 
     308[[Image(DevelopingSymbianAppWithCarbide:trk_p_connected.JPG)]] 
     309 
     310Leave TRK running on the phone for the duration of this tutorial, and move on back to Carbide to set the connection up. 
     311 
     312=== Setting and Testing Connection Settings === 
     313 
     314Click on the '''Set Connection Settings''' tab, and choose the serial port that have your device name next to it. You might need to scroll a long way down, mine was COM17: 
     315 
     316[[Image(choose-serial-port.png)]] 
     317 
     318Now you can test the connection. Click on '''Test Service Testing''': 
     319 
     320[[Image(initiate-trk-testing.png)]] 
     321 
     322If everything is successful, you will get the following on the area in the big status textbox: 
     323 
     324[[Image(test-trk-success.png)]] 
     325 
     326Click '''Finish''', and you should be rewarded by a new connection appearing in the '''Remote Connections''' area in Carbide C++: 
     327 
     328[[Image(trk-connection-list.png)]] 
     329 
     330 
     331=== Start Debugging === 
     332 
     333Because we haven't setup a debug configuration, if you start debugging, Carbide C++ will offer you to setup one. 
     334 
     335On the ''Symbian Project Navigator'' select bld.inf, and press debug on the toolbar (the picture of the bug...): 
     336 
     337[[Image(new-launch-configuration.png)]] 
     338 
     339You will get the Launch Configuration Wizard. Click '''Next'''. You'll get : 
     340 
     341[[Image(executable-selection.png)]] 
     342 
     343Executable should already be set to {{{symbian_ua.exe}}}, so just click '''Next'''. You'll get: 
     344 
     345[[Image(trk-conn-settings.png)]] 
     346 
     347This should be defaulted to {{{connection 1}}} which we have setup earlier. Click '''Next'''. You'll get: 
     348 
     349[[Image(trk-sis-selection.png)]] 
     350 
     351Verify that the sisx is {{{symbian_ua.sisx}}} which we already tested beforehand. Click '''Next''' then '''Finish'''. You should immediately begin debugging. 
     352 
     353Carbide now may rebuild the project (you may take a peek on what it's doing by looking at '''Console''' tab). Once it's done, Carbide will switch to ''Debug Perspective'' and the SIS file will be downloaded to the phone and this window will appear briefly: 
     354 
     355[[Image(DevelopingSymbianAppWithCarbide:debug_download.JPG)]] 
     356 
     357When this window dissappear, you should see the application runs on the phone: 
     358 
     359[[Image(DevelopingSymbianAppWithCarbide:symbian_ua.JPG)]] 
     360 
     361You may make calls, receive calls, do presence stuffs, etc. Full debugging should also be possible; you may set breakpoints, step into functions, etc. 
     362 
     363 
     364You can now move on to bigger and better things: [wiki:APS APS & VAS] 
     365 
     366---- 
     367 
     368== Common Problems == 
     369 
     370=== Problem with Build/Clean === 
     371 
     372Sometimes Carbide does not build the project properly after we make some changes to the source. This will cause the old code to be built instead of the new changes. 
     373 
     374My standard work flow is to always clean the library/application project containing the modified source before building the whole project, to make sure that the modified libraries/application gets rebuilt properly. 
     375 
     376 
     377=== I/O Error: File in Use (I/O Fault) === 
     378 
     379Sometimes .SIS creation fails with I/O error message in the ''Problems'' pane similar to this message: 
     380 
     381{{{ 
     382file I/O fault 
     383makesis.exe returned with exit value == 1 
     384The process cannot access the file because it is being used by another process. 
     385}}} 
     386 
     387This sounds like a generic error from the build system, and it may be caused by several problems. You can try these and see which one solves it: 
     388 1. First check that the build process has completed without errors (a build error will cause the executable not to get built, and this will cause .sis creation to fail).  
     389 1. Rather than selecting "Build Target Only", try with "Build Project" from the menu. Sometimes build directories are not created when "Build Target Only" is used. 
     390 1. Try cleaning and re-building the project. 
     391 1. Sometimes restarting Carbide C++ also fixes it. 
     392 
     393 
     394=== TRKProtocolPlugin: Failed to download the specified file to target === 
     395 
     396I had experienced this few times. The file seems to be downloaded to the phone fine (the download progress bar shows progress), but once debugging starts Carbide displays "Carbide Alert": "Load Failed", "TRKProtocolPlugin: Failed to download the specified file to target" (as shown in the picture below). 
     397 
     398[[Image(DevelopingSymbianAppWithCarbide:trk_fail.JPG)]] 
     399 
     400I'm not sure what's causing this, but closing TRK on the phone, then reconnecting the USB cable and restarting TRK seems to have fixed this. 
     401 
     402=== TRKProtocolPlugin: Failed to continue thread === 
     403 
     404[[Image(DevelopingSymbianAppWithCarbide:trk_fail2.JPG)]] 
     405 
     406The solution is similar to above. 
     407 
     408=== TRK Not Running Error === 
     409 
     410Sometimes I get Carbide complaining about TRK not running: 
     411 
     412{{{ 
     413Launching 
     414 
     415Target request failed: TRKProtocolPlugin: Can't connect to TRK 
     416(TRK may not be running on the phone or mismatch between selected and 
     417connected com port.). 
     418}}} 
     419 
     420Like this dialog: 
     421 
     422[[Image(DevelopingSymbianAppWithCarbide:trk_not_running.JPG)]] 
     423 
     424If you see TRK is running on the phone, it means that your phone is hung now. Restart the phone by disconnecting the USB cable, taking of the battery, put it back on, start the phone, connect the USB cable, and re-run TRK again. 
     425 
     426 
     427=== Load Failed: TRKProtocolPlugin: Failed to launch the application === 
     428 
     429If you get this error while trying to debug the application: 
     430{{{ 
     431Load Failed: 
     432TRKProtocolPlugin: Failed to launch the application  
     433(Installing the application may have failed or dependent libraries may be missing) 
     434}}} 
     435 
     436Solution: 
     437 - the application may genuinely be missing some dependent libraries 
     438    - try to install the app manually from Windows Explorer, then run it in the phone (not from Carbide). If it won't run (it may or may not display any error messages, in the later case, the application just won't start when you click it on the phone), then it may be missing the dependent libraries. 
     439    - think about the libraries that the application needs (for example: APSServer, SSL and PIPS if for the TLS, and so on), and install them to the phone. 
     440 - make sure the .sisx specified in Debug - Installation matches the .sisx specified in the Project Build properties: 
     441    - check the .sisx in Debug - Installation:  
     442         - open Debug Configurations dialog (from Run menu),  
     443         - select the debug configuration item from the left tree panel (e.g. select "pjproject phone Debug ((GCCE) [S60_3rd_FP1])") 
     444         - go to "Installation" tab 
     445         - check the .sisx name 
     446    - check the .sisx in Project Build properties: 
     447         - right click the project from "Symbian Project Navigator" panel, select "Properties" 
     448         - in the "Properties" dialog, from the left tree panel, select "Carbide C++" then "Build Configurations" 
     449         - in the "SIS Builder" tab, make sure build for symbian_ua.sisx is checked, and "Partial Upgrade" is also checked 
     450         - if you don't see the symbian_ua.sisx entry in the list: 
     451             - press "Add" 
     452             - set "PKG File:" to symbian_ua.pkg 
     453             - leave "Signing Options" to "Self sign sis file" 
     454             - press "OK" 
     455 - If everything above has been set correctly and you still get the error, this is what I did that fixed it: 
     456     - install the .sisx manually from Windows Explorer (right click symbian_ua.sisx and select Install with Nokia Application Installer) 
     457     - the installation was successful 
     458     - uninstall the app from the phone 
     459     - delete both the .sis and .sisx in the Windows computer 
     460     - build the project again in Carbide 
     461     - and launch debug 
     462 
     463 
     464=== Load Failed: TRKProtocolPlugin: Unable to install the application === 
     465 
     466If you get this error when trying to launch debug: 
     467{{{ 
     468Load Failed: 
     469TRKProtocolPlugin: Unable to install the application. If self signing,  
     470certificate could be invalid if your PC clock is ahead of your phone clock.  
     471If not, your developer certificate may be invalid or UID of your application  
     472may be invalid or already in use. 
     473}}} 
     474 
     475The solution is hinted in the message. Common causes are: 
     476 - your PC clock is ahead of the phone clock 
     477 - there may be other application installed in the phone which uses the same UID. 
     478   - we may inadvertenly use the same UID for other PJSIP applications such as pjlib-test. In this case uninstall all of these other apps. 
     479 
     480 
     481=== High Audio Latency === 
     482 
     483We're working on this issue. 
     484 
     485=== Random Crash/Stack Size Problem === 
     486 
     487When you have random crash (sometimes in ICE/pjnath or in DNS SRV resolver) or KERN-EXEC 3 when running without debugger, check if increasing stack size in the MMP fixes the problem. The default stack size (8KB) '''is not sufficient''', hence in {{{symbian_ua.mmp}}} the EPOCSTACKSIZE setting is set to 12KB. 
     488 
     489---- 
     490 
     491== Other Resources == 
     492 
     493Checkout: 
     494 - [http://newlc.com/Carbide-c-Setting-up-On-Target.html Carbide.c++: Setting up On Target Debugging | NewLC] - this article describes how to set up on-device debugging using Bluetooth connection. 
     495