SlideShare a Scribd company logo
Porting C/C++ to Symbian OS Mark Wilcox
What I’m Talking About   What is Porting? Why Port to Symbian OS? Porting Aids: P.I.P.S. OpenGL ES Open C/C++ & RGA Coming Soon… How to do it – The Porting Process Common Problems (& Solutions) Examples: Easy: SoundTouch More Complex: GuiTune
What is Porting? “ Porting is the process of adapting software so that an executable program can be created for a computing environment that is different from the one for which it was originally designed.” (Wikipedia) i.e. Making software work on different hardware or operating systems.
Why Port to Symbian OS?   The Marketing Reason… The Hacker’s Reason… The Geek’s Reason…
Porting Aids P.I.P.S. Is POSIX on Symbian OS OpenGL ES Open C/C++ for S60 RGA – Real-time Graphics & Audio
P.I.P.S. Is POSIX on Symbian OS POSIX – Portable Operating System Interface P.I.P.S. Libraries: 100 60 42 47 Function Coverage (%) Dynamic loading and symbol lookup  libdl Thread creation and synchronization   libpthread Mathematical and arithmetic APIs  libm Standard C and POSIX APIs  libc Functionality Library
OpenGL ES 2D & 3D graphics for embedded systems Subset of desktop OpenGL May need to switch floating-point to fixed 3D Demos:
Open C Superset of P.I.P.S. Adds support for 5 more libraries: 77 GNOME General purpose utility library libglib 86 OpenSSL OpenSSL secure sockets layer libssl 77 OpenSSL Cryptographic services for SSL, TLS, S/MIME, SSH, OpenPGP… libcrypto 100 OpenSSL Cryptography functions libcrypt 100 zlib In-memory compression and decompression functions libz Function Coverage (%) Source Functionality Library
Open C++ More useful libraries: Standard C++ programming extension for Open C Boost Smart pointers, extra containers and math-template functions Boost STLport C++ Standard Template Library STL STLport Standard C++ input/output streams IOStreams Source Functionality Library
Real-time Graphics & Audio Distributed with Open C/C++ APIs developed for porting N-Gage games Not a standard available anywhere else Can create rich UI without Symbian idioms Much more than just graphics & audio: 2D Graphics  Sound Effects and Music  Video Playback  Timers  Input Devices  Cameras Lights   Device Status and Capabilities   Calendar Alerts/Todo   Messaging
Open C/C++ & RGA Architecture
Coming Soon… Qt – cross-platform application framework OpenKODE – cross-platform native APIs Better standard C++ support on Symbian Full support for a dynamically linked STL Support for streams and locales Throwing operator new Better, though still limited, support for mixing standard C++ and Symbian C++ patterns Support for global destructors
How to do it – The Porting Process Convert build files Create a bld.inf file and MMP file(s) for the project Try to compile it Fix problems (loop until compiles) Try to run Debug and fix (loop until runs) Test Debug and fix (loop until works)
Common Problems (& Solutions) Symbian has E32Main(), while standard C/C++ uses main() Pre-Symbian OS v9.3 – add libcrt0.lib ‘glue code’ to your MMP file Symbian OS v9.3 onwards – use new target type STDEXE in the MMP file and ‘glue code’ is added automatically No functions exported from a library by default on Symbian OS Pre-Symbian OS v9.3 – add IMPORT_C to function declarations and EXPORT_C to the definitions for all exported functions Symbian OS v9.3 onwards – use new target types STDDLL or STDLIB and all functions with external linkage (non-static) are exported by default
Common Problems (& Solutions) Out of memory and/or Kern-Exec 3 panics at run-time Increase heap size via EPOCHEAPSIZE directive in the MMP file (although be aware that device memory is limited and code may need re-design and/or allocation failure checks) – default is only 1MB Increase stack size via EPOCSTACKSIZE directive in the MMP file – default is only 8KB, recommended value for Open C/C++ is 64KB
Common Problems (& Solutions) Standard library clashes for existing ports: There is an older partial implementation, developed to get a Java VM running on Symbian OS, in estlib.lib with headers in: \Epoc32\include\libc This is incompatible with P.I.P.S. & Open C/C++, the two cannot be used together. The estlib implementation will be deprecated when P.I.P.S. is considered sufficiently mature.  In practice P.I.P.S. is already much better.
Examples – SoundTouch DLL SoundTouch - open source Audio Processing Library For changing: Tempo (time-stretch) – faster or slower without affecting pitch Pitch (key) – alter sound pitch or key without affecting tempo Playback rate – alters tempo and pitch simultaneously Implemented in C++, using features of libc, libm and STL Supports 16bit integer or 32bit floating-point PCM Platform-independent – runs on Windows, Mac & Linux Can perform real-time processing on 133MHz Pentium
Examples – SoundTouch DLL Very simple bld.inf file: PRJ_PLATFORMS DEFAULT PRJ_EXPORTS ..\inc\SoundTouch.h ..\inc\ FIFOSamplePipe.h ..\inc\STTypes.h PRJ_MMPFILES SoundTouch.mmp
Examples – SoundTouch DLL Fairly simple MMP file (copy most contents from Makefile) TARGET  SoundTouch.dll TARGETTYPE  dll UID  0x1000008D 0x0839739D CAPABILITY  ReadUserData USERINCLUDE  ..\inc SYSTEMINCLUDE  \epoc32\include \epoc32\include\stdapis SYSTEMINCLUDE  \epoc32\include\stdapis\sys SYSTEMINCLUDE  \epoc32\include\stdapis\stlport  SOURCEPATH  ..\src SOURCE  SoundTouch.cpp SoundTouchDllMain.cpp AAFilter.cpp SOURCE  FIFOSampleBuffer.cpp FIRFilter.cpp SOURCE  RateTransposer.cpp TDStretch.cpp LIBRARY  euser.lib LIBRARY  libc.lib libm.lib libstdcpp.lib
Examples – SoundTouch DLL Additional work: Make sure all the source and header files are copied into the workspace Configure for 16bit integer samples in STTypes.h Add IMPORT_C & EXPORT_C to the exported function declarations and definitions Compiling gave several errors, all with the same cause throw std::runtime_error(&quot;Illegal number of channels&quot;);  Code like this: Should compile by simply including <stdexcept> but <string> is needed as well.  The string header should be included internally by <stdexcept> but it seems there is a bug in the Symbian version of STLport… With <string> included in the relevant files it compiles for all build targets.
Examples – GuiTune A more complex port of an open source guitar tuner for Linux. Converted a device driver polling architecture to use Symbian multimedia APIs
Examples – GuiTune Ported UI components from gtkmm to native Symbian controls
Examples – GuiTune Still relatively simple changes to the original code. Full details and code available from the Symbian Developer Network at: developer.symbian.com/main/documentation/porting/
Where to Find Out More P.I.P.S. wiki page: developer.symbian.com/wiki/display/pub/P.I.P.S. Forum Nokia Open C/C++ resources: www.forum.nokia.com/main/resources/technologies/openc_cpp/ Symbian Developer Network porting page: developer.symbian.com/main/documentation/porting/
Questions?

More Related Content

PDF
Emscripten - compile your C/C++ to JavaScript
PDF
XREST Protocol
PPTX
Transpilers(Source-to-Source Compilers)
PPTX
Introduction to C Language
PDF
PyPy
ZIP
An Introduction to PyPy
PDF
Turbo C Compiler Reports
PPT
a quick Introduction to PyPy
Emscripten - compile your C/C++ to JavaScript
XREST Protocol
Transpilers(Source-to-Source Compilers)
Introduction to C Language
PyPy
An Introduction to PyPy
Turbo C Compiler Reports
a quick Introduction to PyPy

What's hot (20)

PPT
PDF
GNU Compiler Collection - August 2005
PPT
GEM - GNU C Compiler Extensions Framework
PPT
Os Worthington
PDF
Assembly Langauge Chap 1
PDF
Pascal script maxbox_ekon_14_2
ODP
Open Source .NET
PPTX
introduction to c language
PPTX
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
PDF
Embedded C programming based on 8051 microcontroller
PDF
IBM XL Compilers Performance Tuning 2016-11-18
PDF
Ekon 25 Python4Delphi_MX475
PDF
Pythonic doesn't mean slow!
PDF
Two-level Just-in-Time Compilation with One Interpreter and One Engine
PPTX
Introduction to C Language (By: Shujaat Abbas)
PPT
Introduction to llvm
PDF
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
ODP
IDE as a Front-end and Fast time-to-market language support in Eclipse IDE re...
PDF
Introduction to the LLVM Compiler System
GNU Compiler Collection - August 2005
GEM - GNU C Compiler Extensions Framework
Os Worthington
Assembly Langauge Chap 1
Pascal script maxbox_ekon_14_2
Open Source .NET
introduction to c language
Talk Python To Me: Stream Processing in your favourite Language with Beam on ...
Embedded C programming based on 8051 microcontroller
IBM XL Compilers Performance Tuning 2016-11-18
Ekon 25 Python4Delphi_MX475
Pythonic doesn't mean slow!
Two-level Just-in-Time Compilation with One Interpreter and One Engine
Introduction to C Language (By: Shujaat Abbas)
Introduction to llvm
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
IDE as a Front-end and Fast time-to-market language support in Eclipse IDE re...
Introduction to the LLVM Compiler System
Ad

Similar to Porting To Symbian (20)

PPT
Porting and Maintaining your C++ Game on Android without losing your mind
PPT
Open Kode, Airplay And The New Reality Of Write Once Run Anywhere
PPTX
Symbian OS - Quick Start
PPT
CDI debugger for embedded C/C+
DOC
PDF
Qe Reference
PDF
Symbian Os C For Mobile Phones Volume 1 Richard Harrison
PDF
There is more to C
PPT
MSMDC_CLI363
PPTX
Symbian OS - Types And Declarations
PDF
How to Port a 9 Million Code Line Project to 64 bits?
PDF
AAME ARM Techcon2013 003v02 Software Development
PDF
100 bugs in Open Source C/C++ projects
PDF
100 bugs in Open Source C/C++ projects
PPTX
C++ in Action Webinar: Move your C++ projects to C++Builder 10 Seattle
PPTX
Symbian OS
PPTX
Porting tometro
PDF
C,c++ interview q&a
PPT
Stroustrup c++0x overview
Porting and Maintaining your C++ Game on Android without losing your mind
Open Kode, Airplay And The New Reality Of Write Once Run Anywhere
Symbian OS - Quick Start
CDI debugger for embedded C/C+
Qe Reference
Symbian Os C For Mobile Phones Volume 1 Richard Harrison
There is more to C
MSMDC_CLI363
Symbian OS - Types And Declarations
How to Port a 9 Million Code Line Project to 64 bits?
AAME ARM Techcon2013 003v02 Software Development
100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects
C++ in Action Webinar: Move your C++ projects to C++Builder 10 Seattle
Symbian OS
Porting tometro
C,c++ interview q&a
Stroustrup c++0x overview
Ad

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Cloud computing and distributed systems.
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Understanding_Digital_Forensics_Presentation.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Reach Out and Touch Someone: Haptics and Empathic Computing
“AI and Expert System Decision Support & Business Intelligence Systems”
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
sap open course for s4hana steps from ECC to s4
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Review of recent advances in non-invasive hemoglobin estimation
Empathic Computing: Creating Shared Understanding
Cloud computing and distributed systems.
Programs and apps: productivity, graphics, security and other tools
Per capita expenditure prediction using model stacking based on satellite ima...

Porting To Symbian

  • 1. Porting C/C++ to Symbian OS Mark Wilcox
  • 2. What I’m Talking About What is Porting? Why Port to Symbian OS? Porting Aids: P.I.P.S. OpenGL ES Open C/C++ & RGA Coming Soon… How to do it – The Porting Process Common Problems (& Solutions) Examples: Easy: SoundTouch More Complex: GuiTune
  • 3. What is Porting? “ Porting is the process of adapting software so that an executable program can be created for a computing environment that is different from the one for which it was originally designed.” (Wikipedia) i.e. Making software work on different hardware or operating systems.
  • 4. Why Port to Symbian OS? The Marketing Reason… The Hacker’s Reason… The Geek’s Reason…
  • 5. Porting Aids P.I.P.S. Is POSIX on Symbian OS OpenGL ES Open C/C++ for S60 RGA – Real-time Graphics & Audio
  • 6. P.I.P.S. Is POSIX on Symbian OS POSIX – Portable Operating System Interface P.I.P.S. Libraries: 100 60 42 47 Function Coverage (%) Dynamic loading and symbol lookup libdl Thread creation and synchronization libpthread Mathematical and arithmetic APIs libm Standard C and POSIX APIs libc Functionality Library
  • 7. OpenGL ES 2D & 3D graphics for embedded systems Subset of desktop OpenGL May need to switch floating-point to fixed 3D Demos:
  • 8. Open C Superset of P.I.P.S. Adds support for 5 more libraries: 77 GNOME General purpose utility library libglib 86 OpenSSL OpenSSL secure sockets layer libssl 77 OpenSSL Cryptographic services for SSL, TLS, S/MIME, SSH, OpenPGP… libcrypto 100 OpenSSL Cryptography functions libcrypt 100 zlib In-memory compression and decompression functions libz Function Coverage (%) Source Functionality Library
  • 9. Open C++ More useful libraries: Standard C++ programming extension for Open C Boost Smart pointers, extra containers and math-template functions Boost STLport C++ Standard Template Library STL STLport Standard C++ input/output streams IOStreams Source Functionality Library
  • 10. Real-time Graphics & Audio Distributed with Open C/C++ APIs developed for porting N-Gage games Not a standard available anywhere else Can create rich UI without Symbian idioms Much more than just graphics & audio: 2D Graphics Sound Effects and Music Video Playback Timers Input Devices Cameras Lights Device Status and Capabilities Calendar Alerts/Todo Messaging
  • 11. Open C/C++ & RGA Architecture
  • 12. Coming Soon… Qt – cross-platform application framework OpenKODE – cross-platform native APIs Better standard C++ support on Symbian Full support for a dynamically linked STL Support for streams and locales Throwing operator new Better, though still limited, support for mixing standard C++ and Symbian C++ patterns Support for global destructors
  • 13. How to do it – The Porting Process Convert build files Create a bld.inf file and MMP file(s) for the project Try to compile it Fix problems (loop until compiles) Try to run Debug and fix (loop until runs) Test Debug and fix (loop until works)
  • 14. Common Problems (& Solutions) Symbian has E32Main(), while standard C/C++ uses main() Pre-Symbian OS v9.3 – add libcrt0.lib ‘glue code’ to your MMP file Symbian OS v9.3 onwards – use new target type STDEXE in the MMP file and ‘glue code’ is added automatically No functions exported from a library by default on Symbian OS Pre-Symbian OS v9.3 – add IMPORT_C to function declarations and EXPORT_C to the definitions for all exported functions Symbian OS v9.3 onwards – use new target types STDDLL or STDLIB and all functions with external linkage (non-static) are exported by default
  • 15. Common Problems (& Solutions) Out of memory and/or Kern-Exec 3 panics at run-time Increase heap size via EPOCHEAPSIZE directive in the MMP file (although be aware that device memory is limited and code may need re-design and/or allocation failure checks) – default is only 1MB Increase stack size via EPOCSTACKSIZE directive in the MMP file – default is only 8KB, recommended value for Open C/C++ is 64KB
  • 16. Common Problems (& Solutions) Standard library clashes for existing ports: There is an older partial implementation, developed to get a Java VM running on Symbian OS, in estlib.lib with headers in: \Epoc32\include\libc This is incompatible with P.I.P.S. & Open C/C++, the two cannot be used together. The estlib implementation will be deprecated when P.I.P.S. is considered sufficiently mature. In practice P.I.P.S. is already much better.
  • 17. Examples – SoundTouch DLL SoundTouch - open source Audio Processing Library For changing: Tempo (time-stretch) – faster or slower without affecting pitch Pitch (key) – alter sound pitch or key without affecting tempo Playback rate – alters tempo and pitch simultaneously Implemented in C++, using features of libc, libm and STL Supports 16bit integer or 32bit floating-point PCM Platform-independent – runs on Windows, Mac & Linux Can perform real-time processing on 133MHz Pentium
  • 18. Examples – SoundTouch DLL Very simple bld.inf file: PRJ_PLATFORMS DEFAULT PRJ_EXPORTS ..\inc\SoundTouch.h ..\inc\ FIFOSamplePipe.h ..\inc\STTypes.h PRJ_MMPFILES SoundTouch.mmp
  • 19. Examples – SoundTouch DLL Fairly simple MMP file (copy most contents from Makefile) TARGET SoundTouch.dll TARGETTYPE dll UID 0x1000008D 0x0839739D CAPABILITY ReadUserData USERINCLUDE ..\inc SYSTEMINCLUDE \epoc32\include \epoc32\include\stdapis SYSTEMINCLUDE \epoc32\include\stdapis\sys SYSTEMINCLUDE \epoc32\include\stdapis\stlport SOURCEPATH ..\src SOURCE SoundTouch.cpp SoundTouchDllMain.cpp AAFilter.cpp SOURCE FIFOSampleBuffer.cpp FIRFilter.cpp SOURCE RateTransposer.cpp TDStretch.cpp LIBRARY euser.lib LIBRARY libc.lib libm.lib libstdcpp.lib
  • 20. Examples – SoundTouch DLL Additional work: Make sure all the source and header files are copied into the workspace Configure for 16bit integer samples in STTypes.h Add IMPORT_C & EXPORT_C to the exported function declarations and definitions Compiling gave several errors, all with the same cause throw std::runtime_error(&quot;Illegal number of channels&quot;); Code like this: Should compile by simply including <stdexcept> but <string> is needed as well. The string header should be included internally by <stdexcept> but it seems there is a bug in the Symbian version of STLport… With <string> included in the relevant files it compiles for all build targets.
  • 21. Examples – GuiTune A more complex port of an open source guitar tuner for Linux. Converted a device driver polling architecture to use Symbian multimedia APIs
  • 22. Examples – GuiTune Ported UI components from gtkmm to native Symbian controls
  • 23. Examples – GuiTune Still relatively simple changes to the original code. Full details and code available from the Symbian Developer Network at: developer.symbian.com/main/documentation/porting/
  • 24. Where to Find Out More P.I.P.S. wiki page: developer.symbian.com/wiki/display/pub/P.I.P.S. Forum Nokia Open C/C++ resources: www.forum.nokia.com/main/resources/technologies/openc_cpp/ Symbian Developer Network porting page: developer.symbian.com/main/documentation/porting/