WideStudio for BTRON

WideStudio for BTRON


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

WideStudio for BTRON Environment Settings


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

Building WideStudio for BTRON (Linux)


As for Linux version, libraries should be built from source codes.
(NOTE)Windows version has BTRON 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 BTRON building consists of two phases. One is to build WideStudio itself and another is to build BTRON libraries.
  • WideStudio Building
  • WideStudio for BTRON Library Building
WideStudio building can be done using gcc/g++ for Linux as follows:
cd /work/ws-vX.XX-X
./configure
make
After completion of WideStudio building, go on to the next; WideStudio for BTRON library building. WideStudio for BTRON library building requires to set path environment variable for BTRON compiler as follows. This is used in generating BTRON binaries.
Csh:
setenv BD /usr/local/brightv

After set the variable, do:
cd /work/ws-vX.XX-X/src
make btron
No error result in building completion. Let's install WideStudio as follows. (default installation goes /usr/local/ws)
su
cd /work/ws-vX.XX-X
make install

Application Builder Configuration


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

Project settings


Creating Hello Application by WideStudio for BTRON


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

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 BTRON in TARGET item below in [Basic Setting] tab.

Project settings


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
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:

#include 
#include 
#include 
//-----------------------------------------------
//Function for the event procedure
//-----------------------------------------------
void btnop1(WSCbase* object){
static long cnt = 0;
  if (cnt != 0){
    exit(0);
  }
  object->setProperty(WSNlabelString,"Hello!");
  cnt++;
}
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 BTRON development kit and configure.
Also, you can use fget for Ethernet Transmit to send the file. Please see more details for manuals come with BTRON development kit offered by Personal Media Co.
[/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.
Now 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

Document Release 3.80 for WideStudio ver 3.80, Jan 2005

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