Creating Content Library applications


From SamyGO
Revision as of 09:59, 10 November 2011 by Geo650 (talk | contribs) (Preparing compiling toolchain environment)
Jump to: navigation, search

Introduction

In this section you will learn how to create simple hello-world application which can be run on your TV-set.

To simplify this description, we assume that we're creating an application for LE40B650T2W model. (Other model's owner can update this how-to later)


*** THIS WIKI PAGE IS UNDER CONSTRUCTION ***

What is Content Library application?

This is a piece of software that may be run using Content Library feature. To run such application you can call Content Library using CONTENT button, then select Game category, and finally, execute selected application. An example of such application is "WiseStar" game provided by Samsung in their B650 TV-set.


Requirements

  • TV-set with Content Library feature and accessible Game category (LE40B650 for example)
  • PC with Ubuntu Linux on ~15GB HDD partition (advanced users can use other systems or other compiling toolchain environment)
  • Text editor with UTF-8 encoding (gedit for example, which is built-in many linux distributions, also in Ubuntu/Gnome)
  • Basic skills of programming in C/C++ language and using GCC compiler

How an application looks like

Every application (or Game) consist of at least one binary file (dynamically loaded library file with .so extension, helloworld.so for example), one XML description file (clmeta.dat) and an icon (usually png graphics with relatively low resolution).

If you want to load your application without Content Library (using injectso method for example), you will need .so file(s) only.

Good practice is to place each application inside a directory called with application's name. For example, our HelloWorld application's files could be:

HelloWorld         <DIR>
   clmeta.dat      <file>
   helloworld.png  <file>
   helloworld.so   <file>

where clmeta.dat file content is:

<?xml version="1.0" encoding="utf-8"?>
<contentlibrary>
  <contentpack id="HelloWorld">
    <category>Game</category>
    <title language_id="English">HelloWorld</title>
    <startpoint language_id="English">./helloworld.so</startpoint>
    <thumbnailpath>./helloworld.png</thumbnailpath>
    <totalsize>1</totalsize>
  </contentpack>
</contentlibrary>

English language is set here. You can prepare different binary modules for different languages. In this example above English version will be used always, regardless on the menu language setting.

All editable text strings have been marked bold. Other entries should remain unchanged. Totalsize value seems to be not used by TV-set.

Note that main binary file (helloworld.so), pointed in clmeta.dat file and loaded by Content Library is not a simple executable file. It is a dynamic library with Game_Main() function which is called first.

Preparing compiling toolchain environment

To be able to create binary file, you must have so-called compiling toolchain. In a simple words, it is a compiler for your source code. Its task is to convert source code text files of your application to the machine code binary files which could be run on TV's CPU. We will prepare so-called cross-compiling toolchain here, which will be able to create ARM executable code on other platform (x86). Although internet connection is required during installation process, you will be able to compile your applications completely offline.


You can study how to build cross-compiling toolchain by reading this forum thread, but you can do it much easier by using our special scripts for Linux Ubuntu. Here are details how to install cross-compiling toolchain that way:


  • 1. Download and install Linux Ubuntu (the scripts are designed for Ubuntu 10.04 LTS)
  • 2. Setup root account password using this command:
sudo passwd root
  • 3. Update your system by calling this command:
sudo apt-get upgrade

NOTE: Internet connection is required for this step!

  • 4. Download these scripts to any directory (for example for user's home directory).
  • 5. Place 32B650.zip file (the archive released previously by Samsung) with the scripts.

This archive should contain the following files:

libgphoto2-2.3.1.tar.zip
libusb-0.1.12.tar.gz
linux.chelsea.tgz
SDL-1.2.11.zip
SELP.3.2.x-Chelsea.src.tgz

NOTE: 09_LE32B650.tar.gz file from Samsung Open Source Release Center (browse TV & Video, TV, LCD section) is not compatible with these scripts.

  • 6. Download thsese 7 files:
freetype-SamyGO-v0.01.tgz
png-SamyGO-v0.01.tgz
SDL-1.2.14-SamyGO-v0.03.tgz
sdl-image-SamyGO-v0.01.tgz
sdl-mixer-SamyGO-v0.01.tgz
sdl-ttf-SamyGO-v0.01.tgz
zlib-SamyGO-v0.02.tgz

and copy them to devel subdirectory

  • 7. Open linux terminal window (console) and call ubuntu_install_first.sh script using root account:
sudo ubuntu_install_first.sh

Then wait for script do end its execution (it could last for several minutes). It should write "DONE." on exit.

NOTE: Internet connection is still required here. The script will download some missing packages.

  • 8. Call ubuntu_install_addons_arm.sh script:
sudo ubuntu_install_addons_arm.sh

This step will install some SDK libraries required for compiling SDL applications etc.

  • 9. Call ubuntu_install_addons_x86.sh script (optional step):
sudo ubuntu_install_addons_x86.sh

NOTE: This step will allow you to compile your SDL applications for x86 platform for testing purposes. Internet connection is still required here. The script will download some missing packages.

  • 10. You're almost done. Now you can create a subdirectory in your user's home directory (I mean, not root's but raw user's). I prefer SamyGO directory name:
mkdir SamyGO
cd SamyGO

This subdirectory will be the home for all your projects.

To start a new project (create a new application), go into SamyGO directory created here, then create a new subdirectory inside.


Creating a simple application

TO BE CONTINUED...

(PLEASE CORRECT MY ERRORS)