WideStudio for T-Engine

WideStudio for T-Engine

WideStudio for T-Engine is one of WideStudio Suite that enables you to develop a desktop application on T-Engine.
WideStudio for T-Engine offers the following features to develop T-Engine applications:
  • Generate T-Engine native binaries that runs much faster
  • Source codes can be shared among other platforms
T-Engine application of WideStudio

WideStudio for T-Engine Environment Settings

WideStudio for T-Engine uses Linux or Windows Operating Systems as its development environment for T-Engine applicatons. Applications developped on Linux or Windows are transmitted to T-Engine to run or for debugging.
Required software are show below:
  • (For Linux) Compilers such as gcc/g++
  • Your favorite editor to edit source codes
  • T-Kernel Development Kit (from Personal Media Co. )
  • T-Shell Development Kit (from Personal Media Co. ) *As required*
For Linux, gcc/g++ come with Linux OS are required.
Also, gcc compiler for T-Engine come with T-Kernel development kit is required for both Linux / Window.
The rest of description below assumes T-Kernel/T-Shell development kit installed on /usr/local/te (for Linux) and c:/cygwin/usr/local/te (for Windows)

Building WideStudio for T-Engine (Linux)

As for Linux version, libraries should be built from source codes.
(NOTE)Windows version has T-Engine libraries with its package, you don't need to build the libraries.
WideStudio source codes cat be accessed with its filename name ws-vX.XX.X-src.tar.gz on the Internet.
(NOTE)X.XX.X matches the version numbers.

Get that file to expand on Linux box which T-Engine development kit is installed like as following. Tempolary directory can be used for this.
 cd /work
gzip -cd ws-vX.XX.X-src.tar.gz | tar -xvf -
WideStudio for T-Engine building consists of two phases. One is to build WideStudio itself and another is to build T-Engine libraries.
  • WideStudio Building
  • WideStudio for T-Engine Library Building
WideStudio building can be done using gcc/g++ for Linux as follows:
cd /work/ws-vX.XX-X
After completion of WideStudio building, go on to the next; WideStudio for T-Engine library building. WideStudio for T-Engine library building requires to set path environment variable for T-Engine compiler as follows. This is used in generating T-Engine binaries.

setenv BD /usr/local/te

After set the variable, do:
cd /work/ws-vX.XX-X/src
make TARGET (specify the TARGET as following chart)

Machine name
T-Shell version for SH7751R
Framebuffer output version for SH7751R
T-Shell version for SH7727
Framebuffer output version for SH7727
T-Shell version for SH7760
Framebuffer output version for SH7760
T-Shell version for MC9328
Framebuffer output version for MC9328
T-Shell version for MB87Q1100
Framebuffer output version for MB87Q1100
T-Shell version for Vr5500
Framebuffer output version for Vr5500
T-Shell version for Vr5701
Framebuffer output version for Vr5701
T-Shell version for TX4956
Framebuffer version for TX4956

Ex. T-Shell version for SH7751R:
cd /work/ws-vX.XX-X/src
make te-sh7751r

No error result in building completion. Let's install WideStudio as follows. (default installation goes /usr/local/ws)
cd /work/ws-vX.XX-X
make install

Application Builder Configuration

T-Engine compiler path should be specified in Application Builder before compling a T-Engine application.
Select [Project Setting] from [Project] menu and click on [Environment Settings] Tab to set T-Engine compiler path


Creating Hello Application by WideStudio for T-Engine

Using a simple application - hello as an example, let's see how T-Engine application can be developed by WideStudio for T-Engine

T-Engine application
Hello application on T-Engine

First of all, start wsbuilder and create a new project from [New Project] in [Project] menu. Use "hello" as its project name and select [Generic Application]. Project file name is hello.prj
Then, select [Project Setting] from [Project] menu and configure T-Engine in TARGET item below in [Basic Setting] tab.


Creating a Window

After that, create a window which will be a base for hello application. Select [New Window] from [File] menu in the builder. Here we select [Generic Window] type with a name "newwin000" and configure the property as follows:
Project name: newwin000
X coord: 0
Y coord: 0
Width: 240
Height: 300
Title Attrib: No title
On the Window you just created, put a button object and configure its property as follows
Object name: newvbtn_000
X coord: 10
Y coord: 10
Width: 100
Height: 30
Text: TEST

hello window
hello window

Creating an Event Procedure

Next is the most fun time; creating an event procedure. Let's have it say, "Hello!". Using C++ for event procedures, any given program such as an access to an object or data processing can be written here by specifying an event connecting to an object.
For example, if you set mouse-click event on a button, an event procedure aligned with that event runs when you click on the button with mouse.
Chosen a push button; newvbtn_000 that displays "hello!" would have an envent procedure developed as follows. Select "newvbtn_000" and configure it in [New Procedure Create] from [Procedure Edit] in [Edit] menu:

//Function for the event procedure
void btnop1(WSCbase* object){
static long cnt = 0;
  if (cnt != 0){
static WSCfunctionRegister op("btnop1",(void*)btnop1);

Building Hello Project

After saving the hello project by [Save Project] from [Project] menu in Application Builder, build by [Build All] in [Build] menu. If you successfully complete the build with no error, hello is ready to work.

Building Hello Project
Building hello

You will see hello.bz under the project directory after the building. Serial transmit this hello.bz using gterm from T-Engine development kit and configure.
Also, you can use fget for Ethernet Transmit to send the file. Please see more details for manuals come with T-Engine development kit offered by Personal Media Co.

In T-Shell version:
[/SYS] recv -d /.../hello/hello.bz <- Specify full path for hello.bz
[/SYS] expf -v hello.bz <- Extract hello.bz
[/SYS] vup -t hello /SYS <- Register hello in a box.
[/SYS] rm hello hello.bz <- Remove hello that is not used anymore.
In T-Shell version, hello has been registered in a box with a name "Sample Program" You can start this application by double-clicking from a box. The name can be changed by editing hello.f that is created in a box directory.

In framebuffer output version:
[/SYS] recv -d /.../hello/hello    <- Specify full path for hello
[/SYS] hello <- Execute hello directly

In dynamic link library application, the dynamic link library must be transmitted to /SYS/lib/ of the target.
You can see which librarys are needed by the application as following command:

% /usr/local/te/tool/Linux-i686/bin/(CPU type)-unknown-tkernel-readelf -d (project-name).out  

% /usr/local/te/tool/Cygwin-i686/bin/(CPU type)-unknown-tkernel-readelf -d (project-name).out  

 Dynamic segment at offset 0x119b44 contains 25 entries:
   Tag        Type                         Name/Value
  0x00000001 (NEEDED)                     Shared library: [libwsbtron.so.3.90]
  0x00000001 (NEEDED)                     Shared library: [libwsr.so.3.90]
  0x00000001 (NEEDED)                     Shared library: [libwsb.so.3.90]
  0x00000001 (NEEDED)                     Shared library: [libwsc.so.3.90]
  0x00000001 (NEEDED)                     Shared library: [libws.so.3.90]
  0x00000001 (NEEDED)                     Shared library: [libapp.so.2]
  0x00000001 (NEEDED)                     Shared library: [libg.so.2]
  0x00000001 (NEEDED)                     Shared library: [libbt.so.2]
  0x00000001 (NEEDED)                     Shared library: [libimg.so.2]

Please transmit the dynamic link libraries from ws/lib/lib-te-(machine name)/ or /usr/local/te/lib/(CPUtype).dl/ to /SYS/lib/ of the target machine.

Running hello application
Hello application on T-Engine

Please feel free to contact us for any questions/bugs after checking the mailing list