Creating Content Library applications


From SamyGO
Revision as of 02:10, 6 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)

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 the 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.

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. Download these scripts to any directory
  • 4. 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

TO BE CONTINUED...

(PLEASE CORRECT MY ERRORS)