Getting Started with Teamacaron

Version 1.A0.00
Personal Media Corporation
c 2010 by Personal Media Corporation
Copyright °CONTENTS

2

Contents
History of Changes

3

Introduction

4

1 Installing Target
1.1 System Installation . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Font Installation . . . . . . . . . . . . . . . . . . . . . . . . . . .

44
11

2 Installing Development Environment
13
2.1 Installing Cygwin . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2 Installing Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3 Installing T-Kernel Development Environment . . . . . . . . . . 17
3 Development
22
3.1 Starting Target and Development Environment . . . . . . . . . . 22
3.2 Console Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3 Process-Based and T-Kernel-Based Programs . . . . . . . . . . . 24
3.4 ”Hello, world” as a Process-Based Program . . . . . . . . . . . . 26
3.5 ”Hello, world” as a T-Kernel-Based Program . . . . . . . . . . . 29
4 Running the Learning Sample Programs
33
4.1 Juggling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2 Tiny Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.3 LED and Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Index

Getting Started with Teamacaron42

c 2010 Personal Media Corporation°

HISTORY

3

History of Changes
Version 1.A0.00• First edition for Teamacaron Development Kit.

Getting Started with Teamacaronc 2010 Personal Media Corporation°

INTRODUCTION

4Introduction
This document provides a tutorial on starting out with Teamacaron Development Kit, for those using this product for the ﬁrst time.

1

Installing Target

In general on developing embedded systems, the development environment isapart from the execution target. This style is called “cross-development”, shownin Figure 1.1. In case of Teamacaron Development Kit, we also use this stylefor software development on Teamacaron.
Host PC (development)

Teamacaron (target)

Compiler
Eclipse-Debuggergterm
Figure 1.1

Applications¾-

serialDrivers, middleware
T-Kernel (OS)Cross-development

In this section we’ll install the target-side environment (OS, drivers andmiddleware) on a microSD for Teamacaron, while the section 2 describes theinstallation For details please also refer to “Teamacaron Development Kit Manual” at “2. Installation”.

1.1

System Installation(1) Prepare microSD
Prepare a microSD card, and format it by Windows PC in FAT format.
† SHDC card is not supported. Instead please prepare a microSD card. And
please format in FAT ﬁle system (not FAT32 ﬁle system).

And copy the following 3 ﬁles from the “en\soft” folder of the Teamacaron Development Kit CD-ROM to the root of the microSD.
File namesdboot.bintmonitor.bin
romdisk.bin

Content
boot loader
T-Monitor
ROM disk image for installation(2) Serial Connection
Connect your host PC and Teamacaron (UART0 connector) by serial connection (RS-232C). Please use the serial conversion cable included in the
Teamacaron Development Kit(Figure 1.2). Please use USB-serial adapter,
if your host PC has no serial (COM) port.

Getting Started with Teamacaronc 2010 Personal Media Corporation°

1

INSTALLING TARGETUART0Teamacaron

UART0
Teamacaron

5

serial conversion cable¾-

RS-232C cross
cable
¾
-

serial conversion cable¾-

USB-serial
adapter¾-

Figure 1.2

COM port
host PC

USB port
host PC

Serial cable connection

In both cases the conversion cable must be connected to the UART0 connector (CN5) of Teamacaron(Figure 1.3).

Figure 1.3

UART0 and microSD connectors° Start Terminal Software
For this installation a terminal software is required, such as “HyperTerminal” and “Tera Term Pro”.
† In cases of Windows 7 and Windows Vista, where HyperTerminal is not included, please download “Tera Term Pro (version 2.3)” from the following
website:http://hp.vector.co.jp/authors/VA002416/teraterm.html† If you install Eclipse Environment, you can use a terminal software “gterm”
on Eclipse. But for the ﬁrst setup, we recommend to use a simple terminal
software (such as Hyper Terminal) for easy trouble shooting.

• In case of Tera Term Pro :Start Tera Term Pro.
• In case of HyperTerminal :Start “HyperTerminal” (by clicking on “Start button” → “All Programs” → “Accessories” → “Communications” → “HyperTerminal”).
† You may be asked about “Default Telnet Program”, but it is not
signiﬁcant. Phone number is also not signiﬁcant, because no telephone
call is used actually.

Enter any name and select any icon, and click on OK . (Figure 1.4).

Getting Started with Teamacaronc 2010 Personal Media Corporation°

1

INSTALLING TARGET

6

Figure 1.4

Start HyperTerminal° Communication Setting
Select serial port of the host PC (COM1 etc.), and set the communication
parameters as follows:
Speed
Data bits
ParityStop bits
Flow control

115200 bps
8 bitsnone
1 bit
XON/XOFF† Hardware ﬂow control (RTS/CTS) is not supported. Please use XON/XOFF
control instead.

• In case of Tera Term Pro :Select “File” → “New connection”. On the new connection dialog,
check “Serial”, and select the serial port (ex. COM1), and click OK .
Then select “Setup” → “Serial port”, and set parameters as above.
• In case of HyperTerminal :Select the serial port (ex. COM1) and click OK . Then set thecommunication parameters (Figure 1.4).

Getting Started with Teamacaronc 2010 Personal Media Corporation°

1

INSTALLING TARGET

7

Figure 1.5

Communication Setting(3) Boot Teamacaron
Insert the microSD to Teamacaron (Figure 1.3). And supply power toTeamacaron by AC adapter.
° Conﬁrming Prompt
Try pressing ←- (Enter) Key a number of times on the terminal software.
The CLI prompt ([/SYS]%) will appear on the terminal software (Figure
1.6).

Figure 1.6

CLI prompt on a terminal software(4) Making Two Partitions
Run hdpart command from the terminal software, where the device nameis “pcb”, which means the whole disk. Create two partitions, where the
1st partition must be more than 32 MB. And set 2nd partition as the bootpartition.
[/SYS]% hdpart pcb←-— Run hdpart commandpcb[C:955 H:64 S:63 B:3862528 (1886 MB)]
No System
Boot StartCHSEndCHS
SecNo SecCnt
Size
1 06 DOS00
0: 2:10 956: 63:63
135 3858489 1884 MB
2 00 ------ 00
0: 0: 00: 0: 00
0
0 KB
Getting Started with Teamacaronc 2010 Personal Media Corporation°

1

INSTALLING TARGET

3
400 -----00 ------

00
00

0:
0:

8

0: 0
0: 0

0:
0:

0: 0
0: 0

0
0

StartCHS
0: 0: 00: 0: 00: 0: 00: 0: 0EndCHS0: 0: 00: 0: 00: 0: 00: 0: 0

SecNo
0
0
0
0

StartCHS
0: 1: 10: 0: 00: 0: 00: 0: 0EndCHS
16: 63:63
0: 0: 00: 0: 00: 0: 0

SecNo
63
0
0
0

StartCHS
0: 1: 1
17: 0: 1
0: 0: 00: 0: 0EndCHS
16: 63:63
957: 61:61
0: 0: 00: 0: 0

Size
0 KB
0 KB
0 KB
0 KB

SecCnt
68481
0
0
0

Size
33 MB
0 KB
0 KB
0 KB

— Create partition— 2nd partition— All the rest** Create/Delete/Boot/Edit/Quit ? c←Create PartNo (1-4) ? 2←Size [GB/MB/KB,All] (<1853MB) ? a←No SystemBoot
1 13 BTRON
00
2 13 BTRON00
3 00 ------ 00
4 00 ------ 00

SecCnt0000— Create partition— 1st partition— Partition size** Create/Delete/Boot/Edit/Quit ? c←Create PartNo (1-4) ? 1←Size [GB/MB/KB,All] (<1886MB) ? 32MB←No SystemBoot
1 13 BTRON00
2 00 ------ 00
3 00 ------ 00
4 00 ------ 00

0 KB
0 KB

— Delete partition— 1st partition** Create/Delete/Boot/Edit/Quit ? d←Delete PartNo (1-4) ? 1←No SystemBoot
1 00 ------ 00
2 00 ------ 00
3 00 ------ 00
4 00 ------ 00

0
0

SecNo SecCnt
Size
63
68481
33 MB
68544 3793984 1852 MB
0
0
0 KB
0
0
0 KB

** Create/Delete/Boot/Edit/Update/Quit ? b←- — Boot partition
Boot PartNo (1-4,Clear) ? 2←— 2nd partition
No System
Boot
1 13 BTRON
00
2 13 BTRON
80
3 00 ------ 00
4 00 ------ 00

StartCHS
0: 1: 1
17: 0: 1
0: 0: 00: 0: 0EndCHS
16: 63:63
957: 61:61
0: 0: 00: 0: 0

SecNo SecCnt
Size
63
68481
33 MB
68544 3793984 1852 MB
0
0
0 KB
0
0
0 KB

** Create/Delete/Boot/Edit/Update/Quit ? u←** pcb: Updated Master Boot Block[/SYS]%— Update(5) Format the 2nd partition
Format the 2nd partition by format command from the terminal software.
Device name is “pcb1”. And “-b” option (write boot record) is required.
Also “-x” option is required if the partition size is 2GB or more.
[/SYS]% format -b pcb1 SYSTEM←Format pcb1 [STD] SYSTEM
Logical Formatting...
Writing BootCode...
Disk Format Success.
[/SYS]%— format 2nd partition(6) Copy the ROM disk ﬁlesCopy the all ROM disk ﬁles to the 2nd partition.
[/SYS]% att pcb1 A←hda0 -> A[/SYS]% rcp -r /SYS /A/=←-

Getting Started with Teamacaron— Attach 2nd partition— Copy basic systemc 2010 Personal Media Corporation°

1

INSTALLING TARGET

9[/SYS]% det pcb1←[/SYS]%— Detach 2nd partition(7) Shut down Teamacaron
Use exit twice to shutdown the target.
[/SYS]% exit←<< EXIT cli >>[IMS]% exit
1[IMS]% exit←<< SYSTEM SHUTDOWN >>(8) Format the 1st partition in FAT format
Eject microSD from Teamacaron, insert it to Windows PC, and format
the 1st partition in FAT format.
† Please format in FAT ﬁle system (not FAT32 ﬁle system). Please also
conﬁrm that the partition capacity is nearly equal to the size of the 1st
partition, which is created in (4) before.

(9) Copy ﬁlesCopy the following 5 ﬁles from the “en\soft” folder of the Teamacaron
Development Kit CD-ROM to the root of the 1st (FAT) partition of the
microSD.
File nameContent
sdboot.binboot loader
tmonitor.bin
T-Monitor
install.bz
Basic system install package
install tshell.bz T-Shell install package
english.bz
T-Shell english patch† Do not copy romdisk.bin in this time.
(10) Boot Teamacaron
Insert the microSD card again to Teamacaron. And supply power toTeamacaron by AC adapter.
° Conﬁrming Prompt
Try pressing ←- (Enter) Key a number of times on the terminal software.
The CLI prompt ([/SYS]%) will appear on the terminal software.
(11) Installing the Basic System[/SYS]% att -m pcb0 M←— attach 1st partition
pcb0 -> M[/SYS]% expf -U /M/install.bz←— expand install package[/SYS]% install /SYS←— install
Install completed, please reboot the system.
[/SYS]% rm -r install←— remove installer

Getting Started with Teamacaronc 2010 Personal Media Corporation°

1

INSTALLING TARGET

10(12) Installing T-Shell[/SYS]% expf -U /M/install tshell.bz←- — expand install package[/SYS]% install tshell /SYS←— install
Install completed, please reboot the system.
[/SYS]% rm -r install tshell←— remove installer[/SYS]%° Installing T-Shell English Patch
This English patch translates T-Shell GUI applications to English.
[/SYS]% expf -U /M/english.bz←[/SYS]% english /SYS←.. Installing English Patch on /SYS.. Install completed[/SYS]% rm -r english←[/SYS]%— expand patch— install— remove patch° Detach 1st partition[/SYS]% det -u pcb0←[/SYS]%— detach 1st partition(13) Reboot Teamacaron
Use “exit” and “exit -1” commands to reboot Teamacaron.
[/SYS]% exit←<< EXIT cli >>[IMS]% exit
1[IMS]% exit -1←<< SYSTEM RESTART >>..
.
[/SYS]%
If you connect a display connected to the CRT connector of Teamacaron it
shows an initial window of PMC T-Shell (Figure 1.7). And if you connect
an USB mouse, your can move pointer or show right-click menu.

Figure 1.7

Initial Window of PMC T-Shell

Getting Started with Teamacaronc 2010 Personal Media Corporation°

1

INSTALLING TARGET

11

On the other hand, the terminal software of the host PC shows booting
messages of Teamacaron, and the CLI prompt ([/SYS]%).
° Screen Size
Screen size can be changed as follows. The changed setting becomes valid
after reboot.
[/SYS]% devconf VIDEOMODE 8←[/SYS]% exit←<< EXIT cli >>[IMS]% exit
1[IMS]% exit -1←<< SYSTEM RESTART >>..
.

VIDEOMODE
58size
640 × 480
800 × 600[/SYS]%

1.2

Font Installation

The “common\font” folder of the Teamacaron Development Kit CD-ROM contains many additional fonts, including several English fonts, as well as large setsof Chinese/Japanese/Korean ideographs.
The following install ﬁles are for English fonts:
File NameSSAVALONSSCOURIE
SSEUROMDSSHELVETSSHELVTNSSTIMES

Font Name
SSAvalon
SSCourier
SSEuromode
SSHelvetica
SSHelveticaN
SSTimes

At least SSHelvetica is recommended to be installed, since T-Shell GUI
applications assume it.
(1) Shut down Teamacaron
Use exit twice to shutdown the target.
[/SYS]% exit←<< EXIT cli >>[IMS]% exit
1[IMS]% exit←<< SYSTEM SHUTDOWN >>(2) Copy font ﬁleEject microSD from Teamacaron, and insert it to Windows PC. And copy
the following 2 ﬁles from the “common\font” folder of the Teamacaron
Development Kit CD-ROM to the root of the 1st (FAT) partition of the
microSD.
File name Content
instfont font installer
SSHELVET SSHelvetica fontGetting Started with Teamacaronc 2010 Personal Media Corporation°

1

INSTALLING TARGET

12(3) Boot Teamacaron
Insert the microSD card again to Teamacaron. And supply power toTeamacaron by AC adapter.
(4) Installing font[/SYS]% att -m pcb0 M←pcb0 -> M[/SYS]% /M/instfont /M/SSHELVET←Font File Name
: regist
0: **-****: use
1: ****-SSHelvetica** : use[/SYS]% det -u pcb0←[/SYS]%— attach 1st partition— install font— detach 1st partition(5) Reboot Teamacaron
Use “exit” and “exit -1” commands to reboot Teamacaron.
[/SYS]% exit←<< EXIT cli >>[IMS]% exit
1[IMS]% exit -1←<< SYSTEM RESTART >>..
.
[/SYS]%

Getting Started with Teamacaronc 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

2

13

Installing Development Environment† The development environment for Teamacaron Development Kit works on Windows XP, Windows Vista and Windows 7.

2.1

Installing Cygwin

Cygwin is required for the Teamacaron Development Environment on PC. For
more details please also refer to the “Cygwin Install Manual” in the Teamacaron
Development Kit CD-ROM.
† Windows Login account must be administrator to install Cygwin. And the account name must be in alphanumeric characters without spaces to avoid trouble
on Cygwin.

† Even if you have already installed Cygwin, please check its version and installed
modules. Refer to “Cygwin Install Manual” again and reinstall Cygwin if necessary.

(1) Expand Cygwin Package
Copy (save) the following ﬁle to the root of your install drive (such asC:\) from the common software directory (common\soft) of Teamacaron
Development Kit CD-ROM.
Cygwin System Packagecommon\soft\cygwin\_d.1.7.5-1.zip

Expand this zip archive by Windows Explorer.
† Version numbers may be diﬀerent.
(2) Start the Installer
The installer setup.exe is in the expanded folder. Double-click on setup.exe
to launch the installer program. (Figure 2.1)

Figure 2.1

Start Cygwin Installer

Click on Next > .
(3) Select Install Type
Select “Install from Local Directory” and click on Next > .
Getting Started with Teamacaronc 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

14(4) Select Install DirectorySpecify where the root directory in Cygwin is to be located in Windows.
By default this is C:\cygwin. It can be left as is. (Figure 2.2)

Figure 2.2

Select Install Directory

Select All Users at “Install For” (default choice). And click on Next > .
(5) Select Local Package DirectorySpecify the folder, where you expanded the Cygwin system package.
Click on Next > to continue.
(6) Select Install Packages
After checking ﬁles, a “Setup Alert” dialog may appear. If there is no
problem, click on OK . Next appears a screen for selecting packages toinstall. The initial selected state is “All ° Default”. Click on “Default”
to change to “Install”. (Figure 2.3)

Figure 2.3

Getting Started with Teamacaron

Select Install Package

c 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

15(7) Install
Then click on Next > to proceed with the installation.
(8) Create Icon
Finally a dialog appears asking whether to add icons to the Start menu
and desktop. Choose as appropriate, and click on Finish .
(9) Distinguish Uppercase and Lowercase Filenames
Cygwin does not distinguish uppercase and lowercase ﬁlenames.
To distinguish them, open the startup batch ﬁle C:\cygwin\cygwin.bat
by a text editor, and before the line
bash --login -i n
add
set CYGWIN=nowinsymlinks check_case:strict.
(10) Initialize Home Directory
After modifying the batch ﬁle, double-click on the Cygwin icon on thedesktop to launch Cygwin. The ﬁrst time it is started, the user’s home
directory is initialized.
(11) Create a symbolic link for gmake
On Cygwin, create a symbolic link from gmake to make.
$ cd /usr/bin←$ ln -s make gmake←(12) Create a symbolic link for Perl
On Cygwin, create a symbolic link from /usr/local/bin/perl to /usr/bin/perl.
$ cd /usr/local/bin←$ ln -s /usr/bin/perl←Use exit command to exit Cygwin.
$ exit←-2.2

Installing Eclipse

Install Eclipse, an integrated development environment (IDE).
For more details please also refer to the “Eclipse Install Manual” in the
Teamacaron Development Kit CD-ROM.
(1) Installing Java Runtime
Java Runtime is necessary for running Eclipse.
If you does not installed the Java Runtime, or your Java Runtime is old,please visit the following website to download Java Runtime.
Getting Started with Teamacaronc 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

16

http://www.java.com/en/(2) Expand Eclipse System Package
Copy (save) the following ﬁles to a temporary directory of your install drive(such as C:\temp) from the common software directory (common\soft) of
the Teamacaron Development Kit CD-ROM.
Eclipse
CDT plug-incommon\soft\eclipse-platform-3.2.2-win32.zip
common\soft\org.eclipse.cdt-3.1.2-win32.x86.zip† Version numbers may be diﬀerent.
Expand the archive ﬁles above to the root directory of your install drive(such as C:\).
† If you expand the packages to C:\, the new folder C:\eclipse is created,
and the packages are expanded under this folder.

(3) Making a shortcut
Make a shortcut on the desktop to the C:\eclipse\eclipse.exe.
(4) Conﬁrming for running Eclipse
Double-click on the shortcut of Eclipse to launch Eclipse (Figure 2.4). On
the “Select a workspace” dialog, click on Cancel to quit Eclipse.

Figure 2.4

Starting Eclipse[Trouble Shooting] If appears an error message about Java Runtime Environment, please conﬁrm again about Java Runtime.

Getting Started with Teamacaronc 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

2.3

17

Installing T-Kernel Development Environment

Add plug-ins for T-Kernel Development Environment to Eclipse.
For more details please also refer to the “Eclipse-based T-Kernel Development Environment Install Manual” and the “GNU Development Environment(on Eclipse) Manual” in the Teamacaron Development Kit CD-ROM.
(1) Expand Eclipse plug-ins
Copy (save) the following ﬁles to a temporary directory of your installdrive (such as C:\temp) from the English software directory (en\soft) of
the Teamacaron Development Kit CD-ROM.
Common part for Eclipse platform
Machine-dependent partcom.t engine4u.te.1.0.9.zip
com.t engine4u.tl.em1d512.1.0.0.zip

And expand these archives to the Eclipse directory (such as C:\eclipse)
by Windows Explorer.
† Please use Windows Explorer to expand these ZIP ﬁles. Other software
may not correctly expand these archives.

† Version numbers may be diﬀerent.
(2) Expand T-Shell Additional Package
Copy (save) the following ﬁle to a temporary directory of your install drive(such as C:\temp) from the English software directory (en\soft) of the
Teamacaron Development Kit CD-ROM.
T-Shell additional package

com.t engine4u.tsh.em1d512.1.0.0.zip

And expand this archive to
C:\eclipse\plugins\com.t engine4u.tl.em1d512.1.0.0 1.0.0\teby Windows Explorer.
† Version numbers may be diﬀerent.
(3) Start Eclipse
Double-click on the shortcut of Eclipse to launch Eclipse.
(4) Select (or create) a workspace
Appears a dialog of “Select a workspace”. Select (or newly create) theworkspace C:\te\bappl for process-based programs, and click on OK .
† Here a workspace means a directory to save projects. The default workspaces
are as follows.
C:\te\bappl
C:\te\kappl
C:\te\driver

Process-based programs
T-Kernel-based programs
Device drivers(5) Go to the Workbench
Then appears the “Welcome” view. Click on the icon of “Go to the workbench”. (Figure 2.5)

Getting Started with Teamacaronc 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

Figure 2.5

18“Welcome” view of Eclipse(6) Open the “T-Engine Development” Perspective
Select Menubar → “Window” → “Open Perspective” → “T-Engine Development”. (Figure 2.6)

Figure 2.6

Select T-Engine development perspective(7) Setting of T-Engine Development
Select Menubar → “Window” → “Preferences...” to open the Preferences
Dialog. Select the page of “T-Engine Development”. (Figure 2.7)

Getting Started with Teamacaronc 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

Figure 2.7

19

T-Engine Development Settings

As the parameter of te vcom, specify “-B -X -l /dev/ttyS0” in case ofserial port COM1.
† “-B” means 115200 bps, and “-X” means suppressing hardware ﬂow control(RTS/CTS). And -l is minus ell, stands for line device. Specify “-B -X-l /dev/ttyS1” for COM2, and so on.

(8) Setting of Workspace
Select the page of “General” → “Workspace”. (Figure 2.8)
• Click on “Build automatically” to be OFF.
• Select “New text ﬁle line delimiter” to be Other → Unix.

Getting Started with Teamacaronc 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

Figure 2.8

20

Setting of Workspace

This conﬁguration must be done for each workspace (C:\te\bappl, C:\te\kappl,
C:\te\driver etc.).
(9) Opening console
Click on the “External Tools” button of Toolbar, and select “External
Tools...” in the pull-down menu. (Figure 2.9)

Figure 2.9

External Tools

And double-click on the “Program”. Then appear te vcom and gterm
under “Program”.
Select te vcom and click on the Run button. (Figure 2.10)

Getting Started with Teamacaronc 2010 Personal Media Corporation°

2

INSTALLING DEVELOPMENT ENVIRONMENT

Figure 2.10

21

Running te vcom

Open the ”External Tools” Dialog again, select gterm, and click on the
Run button.
On the console window of gterm, hit ←- (Enter) key several times. Thenappears a prompt (such as [/SYS]%) from the target side (Teamacaron).
This is a prompt of CLI (Command Line Interpreter), which runs on
Teamacaron. (Figure 2.11)

Figure 2.11

CLI prompt on gterm

Next time, the shortcuts to these external tools (te vcom and gterm) willappear on the pull-down menu of External Tools.

Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

223Development

3.1

Starting Target and Development Environment

Start Teamacaron and Eclipse as follows.
(1) Boot the target side (Teamacaron)
Supply power to Teamacaron by AC adapeter.
The display connected to the Teamacaron shows an initial window on
PMC T-Shell.
(2) Start Eclipse
Double-click on the shortcut of Eclipse to launch Eclipse.
Select a workspace, such as C:\te\bappl for process-based programs.
(3) Run te vcom and gterm
Select the external tools, and run te vcom and gterm.
† These external tools do not run just after starting Eclipse. Every time you
started Eclipse (or switched workspace), you also have to run te vcom andgterm.

On the console window of gterm, hit ←- (Enter) key several times, andconﬁrm a CLI prompt (such as [/SYS]%) from the target side (Teamacaron).
† Do not use other terminal software including HyperTerminal while using
te vcom and gterm. And do not start te vcom or gterm twice.
[Trouble Shooting] If CLI prompt does not appear (including T-Monitor
prompt TM>), please reset the target by the reset switch of Teamacaron(Figure 3.1).

Figure 3.1

3.2

Reset switch

Console Tools

Teamacaron comes with a variety of console tools useful for development, as wellas Eclipse dialogs. By Eclipse dialogs one can transfer and execute programs
without console operation. But for other miscellany operations, you can use
these console tools on gterm.
CLI (Command Line Interpreter)
A process-based command line interpreter, providing powerful features
essential for development, especially ﬁle operation features. The standard
prompt is [/SYS]%. See the “Development Tool Manual” at “3. Command
Line Interpreter (CLI)” for details.
Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

23† The CLI prompt shows the working (current) directory name, which is set
by cd command.

Utilities on CLI
Various utilities, such as “hdpart” (partitioning disks) and “format” (format disks) are stored in the system disk, and available as external commands on CLI. See the “Development Tool Manual” at “4. Utilities”, “5.
UNIX (File) Emulator Command Tools” and “6. Network Utilities” fordetails.
IMS (Initial Monitor System)
IMS is a T-Kernel based monitor. Its prompt is [IMS]% by default. See
the “Development Tool Manual ” at “2. IMS” for details.
T-Monitor
The most basic monitor program. Its forte is hardware-level operations
and the like. The prompt is TM>.
T-Monitor commands are listed in the “T-Monitor Speciﬁcation” at 3.3,
“List of Commands.” Teamacaron adds additional commands to T-Monitor
for Flash ROM writing and other functions. These additional commands
are given in the “Implementation Speciﬁcation” at 2, “T-Monitor Implementation Speciﬁcation.”
A simple practice is given below to illustrate use of the CLI and T-Monitor.
(1) Conﬁrm CLI Prompt
On the console window of gterm, hit ←- (Enter) key several times, andconﬁrm a CLI prompt (such as [/SYS]%).
[/SYS]%(2) List of CLI Commands
Enter the CLI command “?” to display a list of CLI commands.
[/SYS]% ?←att

det

eject

CLI command list
cd
ls
fs · · · omitted · · ·(3) CLI Command Help
Use the CLI command “?” to display a description of the “ls” command.
[/SYS]% ? ls←ls [-f][-F][-l|-t] [<path name>..]list files under the path name· · · omitted · · ·(4) List of Files
Use the CLI command “ls” to display a list of ﬁles.
[/SYS]% ls←SBOOTKERNEL.SYS

Getting Started with Teamacaron

SYSCONF· · · omitted · · ·c 2010 Personal Media Corporation°

3

DEVELOPMENT

24(5) Switch to T-Monitor
Use the CLI command “#” to switch to T-Monitor.
[/SYS]% #←TM>(6) List of T-Monitor Commands
Use the T-Monitor command “?” to display a list of T-Monitor commands.
TM> ?←--- Command List :"? command" for details --DumpByte/Half/Word(D/DB/DH/DW) · · · omitted · · ·(7) T-Monitor Command Help
Use the T-Monitor command “?” to display details of the “ow” command.
TM> ? ow←OutputWord(OW) port,data : Output Word to I/O port
(8) I/O write
Use the T-Monitor command “ow” to write 32 bit values to address 0xc005008c
to control LED2 (red) and LED3 (orange) (Figure 3.2).
TM> ow c005008c,c0000000←Port C005008C:W <-- C0000000
TM> ow c005008c,c0004000←Port C005008C:W <-- C0004000
TM> ow c005008c,c0008000←Port C005008C:W <-- C0008000
TM> ow c005008c,c000c000←Port C005008C:W <-- C000C000

Figure 3.2

value
0xc0000000
0xc0004000
0xc0008000
0xc000c000

LED2
ON
OFF
ON
OFF

LED3
ON
ON
OFF
OFF

LED2 and LED3

(9) Return from T-Monitor
Use the T-Monitor command “g” (Go) to return to the CLI.
TM> g←[/SYS]%

3.3

Process-Based and T-Kernel-Based Programs

Programs that run on Teamacaron are generally classiﬁed as either processbased programs or T-Kernel-based programs.

Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

25

Process-based programs :These are programs that run on T-Kernel Extension.
Ordinary application programs are generally of this type.
And process runs in memory protection mode for system safety such thatprocess failure will not cause system down.
As memory space, an independent local space is assigned to each process.
A process has one or more tasks, which shares the local space of theprocess.
A process is run by invoking the main() function, and when the main()function terminates, the process terminates as well.
APIs available in process-based programs are described in the following
documents in the Teamacaron Development Kit CD-ROM.
• “T-Kernel Extension Manual ”
Process, tasks, ﬁles, events and so on.
• “PMC T-Shell Manual ”
Screen drawing, fonts, GUI and network (TCP/IP) functions.
† Basically PMC T-Shell is available only on process.
• “Library Manual ”
Standard C library and other libraries, including fopen() and other<stdio.h> functions.
• “Device Driver Manual ”
Process-based programs can call device drivers.
T-Kernel-based programs :These are programs that make direct use of T-Kernel features.
This type of programming is geared to creating device drivers and the like,since hardware control and interrupts can be handled. As memory space,multiple T-Kernel-based programs are loaded into the same system space
and are made resident.
A T-Kernel-based program is loaded into system space by the lodspg
command. At this time the main() function is called, and the ﬁrst argument ac indicates the number of arguments passed. Ordinarily, task andhandler creation and other initialization takes place in this processing.
The unlspg command can be used to unload a program. Here, the main()function is called again; but this time a minus value is passed in ac. Postprocessing such as deleting the initial task and handlers normally takes
place in this processing.
APIs available in T-Kernel-based programs are described in the following
documents in the Teamacaron Development Kit CD-ROM.
• “T-Kernel Speciﬁcation”
T-Kernel/OS provides the kernel functions of real time OS, such astasks, semaphores, interrupt handlers. And T-Kernel/SM provides
device driver management and so on.
Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

26• “Library Manual ”
Standard C library and other libraries.
† Some library are process-based only, or T-Kernel-based only, but otherlibrary can be commonly used.

• “Device Driver Manual ”
T-Kernel-based programs can call device drivers, as well as making
device drivers.

3.4“Hello, world” as a Process-Based ProgramFirst of all, we’ll try the well-known program “Hello, world” as a processbased program. For more details refer to “GNU Development Environment(on Eclipse) Manual ”.
(1) Select a Workspace
Launch Eclipse, and on the “Select a workspace” dialog, select (or newly
create) the workspace “C:\te\bappl” for process-based programs, andclick on OK .
If you have already launched Eclipse and works on other workspace, switch
workspace to “C:\te\bappl”, by Menubar → “File” → “Switch Workspace...”.
† If you switched workspace, also terminate external tools te vcom andgterm. Then you have to run te vcom and gterm again. On the console window of gterm, hit ←- (Enter) key several times, and conﬁrm a CLI
prompt (such as [/SYS]%).

(2) Create a Project
On the “C/C++ Project” View, click on the mouse right button to showa menu, and select “New” → “T-Engine C/C++ Project”. (Or selectMenubar → “New” → “T-Engine C/C++ Project”.)
Specify the following items. (Figure 3.3)

Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

27

Figure 3.3

New Project Dialog• Project name :Specify your project name, for example, hello.
• Target :Specify your target machine (em1d512).
• Program Type:Specify “Process Base”, or “Decide by workspace”, if your workspace
is C:\te\bappl.
• Template:
Check it and select the template “gdbsample: a sample program for
gdb operation”.
• Output Directory:
Check it.
And click on the Finish button to create a new project.
(3) Create a source program
The sources of the template are copied under the src directory of the
project hello in the “C/C++ Project” View. Double-click on hello toview the source ﬁles.
Here modify these source ﬁles as follows to make “Hello, world”.
• hello/src/main.c :Modify the main function as follows:

Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

28/* Hello, world (process-based) */#include <basic.h>/* basic common header */#include <stdio.h>/* printf() etc. */W main( W ac, TC *av[] ){printf( "Hello, world\n" );return 0;}
Save the modiﬁed ﬁle by Menubar → “File” → “Save”.
† Here the types W and TC are deﬁned by T-Kernel Speciﬁcation. And
return 0 returns the exit code of process.

• hello/src/Makefile :Change the make target to “TARGET = hello”.
Change the list of source ﬁles to “SRC = main.c”. (Delete sub.c.)
Save the modiﬁed ﬁle by Menubar → “File” → “Save”.
• hello/src/sub.c, hello/src/sub.h :Delete these ﬁles by right-click menu.
(4) Make (compile and link)
Select the target Makeﬁle, hello/em1d512/Makefile, in the “C/C++
Project” View.
And then, select Menubar → “Project” → “Make T-Engine Target all” tomake (compile and link) your program.
If the make is succeeded, the executable ﬁle hello/em1d512/hello is
generated.
† Process executable ﬁle is shown with a runner or bug icon. The “bug icon”
means that some of linked libraries include debug information, but it is allright.
[Trouble Shooting] If appears a message “Error launching builder”, conﬁrm
that you have selected the make target hello/em1d512/Makefile.
[Trouble Shooting] If appears a message “makedeps: Command not found”,
conﬁrm installation of Perl on /usr/local/bin/perl after Cygwin installation.

(5) Transfer and Execute the Executable File
Select the executable ﬁle hello/em1d512/hello, click on the mouse rightbutton to show a menu, and select “Run As” → “Run...”. Then appears
the Run Dialog.
On the Run Dialog, select “T-Engine Application”, click on the mouseright button to show a menu, and select “New”. Then appears the default
settings to transfer and execute the program. (Figure 3.4)

Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

29

Figure 3.4

Run Dialog

Click on the Run button at the bottom of the Run Dialog to transfer andexecute the program. Then the process is executed, and appears “Hello,
world” on the gterm console. (Figure 3.5)

Figure 3.5“Hello, world” appears on console[Trouble Shooting] The serial communication is required to transfer ﬁles tothe target.
Conﬁrm that you have run te vcom and gterm again, and on the console
window of gterm, hit ←- (Enter) key several times, and conﬁrm a CLI
prompt (such as [/SYS]%).
[Trouble Shooting] If appears a message “Can’t Create (-1966080)”, it means
read only error. Please check that Teamacaron is booted from writable
disk.

3.5

“Hello, world” as a T-Kernel-Based Program

Next we’ll try the “Hello, world” as a T-Kernel-based program. It puts “Hello,
world” at loading, and “See you again” at unloading.
(1) Select a Workspace

Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT30

Launch Eclipse, and on the “Select a workspace” dialog, select (or newly
create) the workspace “C:\te\kappl” for T-Kernel-based programs, andclick on OK .
If you have already launched Eclipse and works on other workspace, switch
workspace to “C:\te\kappl”, by Menubar → “File” → “Switch Workspace...”.
† If you switched workspace, also terminate external tools te vcom andgterm. Then you have to run te vcom and gterm again. On the console window of gterm, hit ←- (Enter) key several times, and conﬁrm a CLI
prompt (such as [/SYS]%).

(2) Create a Project
On the “C/C++ Project” View, click on the mouse right button to showa menu, and select “New” → “T-Engine C/C++ Project”. (Or selectMenubar → “New” → “T-Engine C/C++ Project”.)
Specify the following items.
• Project name :Specify your project name, for example, hello2.
• Target :Specify your target machine (em1d512).
• Program Type:Specify “T-Kernel Base”, or “Decide by workspace”, if your workspace
is C:\te\kappl.
• Template:
Check it and select the template “sample: print strings sample program”.
• Output Directory:
Check it.
And click on the Finish button to create a new project.
(3) Create a source program
The sources of the template are copied under the src directory of the
project hello2 in the “C/C++ Project” View. Double-click on hello2
to view the source ﬁles.
Here modify these source ﬁles as follows to make “Hello, world”.
• hello2/src/main.c :Modify the main function as follows:/* Hello, world (T-Kernel-based) */#include <basic.h>/* basic common header */#include <tk/tkernel.h> /* T-Kernel header */#include <stdio.h>/* printf() etc. */ER main( INT ac, UB *av[] ){Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

31

if (ac >= 0) {printf("Hello, world\n");} else {printf("See you again\n");}return E_OK;}
Save the modiﬁed ﬁle by Menubar → “File” → “Save”.
• hello2/src/Makefile :Change the make target to “TARGET = hello2”.
Save the modiﬁed ﬁle by Menubar → “File” → “Save”.
(4) Make (compile and link)
Select the target Makeﬁle, hello2/em1d512/Makefile, in the “C/C++
Project” View.
And then, select Menubar → “Project” → “Make T-Engine Target all” tomake (compile and link) your program.
If the make is succeeded, the relocatable executable ﬁle hello2/em1d512/hello2
is generated. And hello2.abs is a absolute address executable ﬁle, andhello2.trg is its stripped ﬁle.
† Eclipse shows T-Kernel-based relocatable executable ﬁles by a “binary ﬁleicon” (not runner or bug icon).

(5) Transfer and Execute the Executable File
Select the executable ﬁle hello2/em1d512/hello2, click on the mouseright button to show a menu, and select “Run As” → “Run...”. Thenappears the Run Dialog.
On the Run Dialog, select “T-Engine Application”, click on the mouseright button to show a menu, and select “New”. Then appears the default
settings to transfer and execute the program.
Click on the Run button at the bottom of the Run Dialog to transfer andexecute the program. Then the program is loaded on the system common
space, and appears “Hello, world” on the gterm console.
(6) Show the System Common SpaceOn the gterm console , use “ref spg” command to conﬁrm that hello2
is loaded.
[/SYS]% ref spg←[ 1] - 0xd0186000 · · · omitted · · ·[13] - 0xd0760000 [/SYS]%

6

screen5

hello2† System program ID and load address may be diﬀerent.

Getting Started with Teamacaronc 2010 Personal Media Corporation°

3

DEVELOPMENT

32(7) Unload the program
Now unload hello2 by executing the “unlspg” command, specifying the
program by its system program ID as displayed in the previous step (13 in
the above example). Then appears “Hello, world” on the gterm console.
[/SYS]% unlspg 13←See you again[/SYS]%

Getting Started with Teamacaronc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

433

Running the Learning Sample Programs

The Tutorial page on the Teamacaron Development Kit CD-ROM contains acollection of learning sample programs.
• Juggling
This program shows juggling animation.
• Tiny Web ServerThis program transfers ﬁles from Teamacaron to Web browsers on otherPCs by TCP/IP network.
• LED and Interrupt
This T-Kernel-based program blinks LED and detects switch by interrupt.

4.1

Juggling

This process-based program shows juggling animation, using PMC T-Shell drawing functions.
This sample is also useful to learn debug operations: set break points, change
variables and so on.
(1) Select a Workspace
Launch Eclipse, and on the “Select a workspace” dialog, select the workspace“C:\te\bappl” for process-based programs, and click on OK .
If you have already launched Eclipse and works on other workspace, switch
workspace to “C:\te\bappl”, by Menubar → “File” → “Switch Workspace...”.
† If you switched workspace, also terminate external tools te vcom andgterm. Then you have to run te vcom and gterm again. On the console window of gterm, hit ←- (Enter) key several times, and conﬁrm a CLI
prompt (such as [/SYS]%).

(2) Create a Project
On the “C/C++ Project” View, click on the mouse right button to showa menu, and select “New” → “T-Engine C/C++ Project”. (Or selectMenubar → “New” → “T-Engine C/C++ Project”.)
Specify the following items.
• Project name :Enter the project name, juggling.
• Target :Specify your target machine (em1d512).
• Program Type:Specify “Process Base”, or “Decide by workspace”, if your workspace
is C:\te\bappl.
• Template:
Do not check it, because the source program will be expanded later.
Getting Started with Teamacaronc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

34• Output Directory:
Check it.
And click on the Finish button to create a new project.
(3) Expand Source Program
The source program is archived in “juggling.zip” on the “en\tutorial”
folder in the Teamacaron Development Kit CD-ROM. Expand this archive“juggling.zip” to “C:\te\bappl” by Windows Explorer.
In the “C/C++ Project” View, select right-click menu → “Update”.
Now the source ﬁles appear under the “src” directory of the project“juggling” in the “C/C++ Project” View. Double-click on “juggling”
to view the source ﬁles.
(4) Make (compile and link)
Select the target Makeﬁle, “juggling/em1d512/Makefile”, in the “C/C++
Project” View.
And then, select Menubar → “Project” → “Make T-Engine Target all” tomake (compile and link) your program.
If the make is succeeded, the executable ﬁle “juggling/em1d512/juggling”
is generated (with a runner or bug icon).
(5) Transfer and Execute the Executable File
Select the executable ﬁle “juggling/em1d512/juggling”, click on themouse right button to show a menu, and select “Run As” → “Run...”.
Then appears the Run Dialog.
On the Run Dialog, select “T-Engine Application”, click on the mouseright button to show a menu, and select “New”. Then appears the default
settings to transfer and execute the program.
Click on the Run button at the bottom of the Run Dialog to transfer andexecute the program. Juggling animation is showed on the screen (Figure
4.1)

Figure 4.1

Getting Started with Teamacaron

Run Jugglingc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

35(6) Make for Debugging
To debug your program, the executable ﬁle must include debug information. To make that ﬁle, make your program on the folder with a debug
option, such as “em1d512.debug”.
Select the target Makeﬁle, “juggling/em1d512.debug/Makefile”, in the“C/C++ Project” View. And then, select Menubar → “Project” →“Make T-Engine Target all” to make (compile and link) your program.
If the make is succeeded, the executable ﬁle “juggling/em1d512.debug/juggling”
is generated with debug information (showed by a insect icon).
(7) Start Debugging
Select the executable ﬁle “juggling/em1d512.debug/juggling”, click on
the mouse right button to show a menu, and select “Debug As” → “Debug...”. Then appears the Debug Dialog.
On the Debug Dialog, select “T-Engine Application”, click on the mouseright button to show a menu, and select “New”. Then appears the default
settings to transfer and debug the program.
† There remains a previous setting created in (5) for execution. But create
a new one for debugging.

Click on the Debug button at the bottom of the Debug Dialog to transfer
and debug the program. If appears a “Conﬁrm Perspective Switch” dialog,
click on Yes to switch perspective. Then appears the Debug perspective.
(8) Set a Breakpoint
The program is stopped at the beginning of the main() function.
Now set a breakpoint in the line “if (i > 0) sleep( i );” near theend of the main() function. At the leftmost side of this line, click on themouse right button to show a menu. Select “Toggle Breakpoint” to set a
breakpoint. (Figure 4.2)

Figure 4.2

Set a Breakpoint(9) Continue Execution
Click on the “Resume” (green right triangle) button in the debug view tocontinue execution. The program runs until a breakpoint. (Figure 4.3)

Getting Started with Teamacaronc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

Figure 4.3

36Continue Execution

By repeating this continuation, the balls move step by step on the target
screen.
(10) Change Variables
When the program is stopped at a breakpoint, change the value of thevariable N (number of balls) in the variables view from 3 to 6. (Figure 4.4)

Figure 4.4

Change a Variable

By continuing execution, the number of balls becomes 6 on the target
screen.
In the same manner one can change the value of the variable R (radius ofballs on the screen).
(11) Terminate Debugging
Click on the “Terminate” (red square) button in the debug view to terminate debugging. And click on the “Remove All Terminated Launches”(double cross) button in the same view.
Select “À” at the right-top of the Eclipse window to back to the “T-Engine
Development” Perspective.

4.2

Tiny Web ServerThis process-based tiny web server is provided as an example of a network
application using TCP/IP functions of PMC T-Shell. Files on Teamacaron aretransfered to web browsers on other PCs.

Getting Started with Teamacaronc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

37(1) Select a Workspace
Launch Eclipse, and on the “Select a workspace” dialog, select the workspace“C:\te\bappl” for process-based programs, and click on OK .
If you have already launched Eclipse and works on other workspace, switch
workspace to “C:\te\bappl”, by Menubar → “File” → “Switch Workspace...”.
† If you switched workspace, also terminate external tools te vcom andgterm. Then you have to run te vcom and gterm again. On the console window of gterm, hit ←- (Enter) key several times, and conﬁrm a CLI
prompt (such as [/SYS]%).

(2) Network Conﬁguration
On the console window of gterm, hit ←- (Enter) key several times, andconﬁrm a CLI prompt (such as [/SYS]%). Then use netconf commandfor network conﬁguration.
If the network environment is one that assigns IP addresses automaticallyby DHCP, the default setting of 0.0.0.0 can be left as is. If not, ﬁrst use
the “netconf c” command to assign an IP address to Teamacaron.
[/SYS]% netconf c ←hostname= ? teaboard←host ip= 0.0.0.0 ? 192.168.0.70←dns1name= ? ←dns1 ip= 0.0.0.0 ? ←dns2name= ? ←dns2 ip= 0.0.0.0 ? ←domain= ? ←gateway ip = 0.0.0.0 ? ←subnetmask = 255.255.255.0 ? ←wlan= none (n/a/i)? ←[/SYS]%— local host name— local IP address— DNS server #1— DNS server #2— domain name— gateway— subnet mask
— no wireless LAN† Instead of netconf command, Network Setup Utility (right-click → “Utility” → “Network Setup”) is also available.

(3) Conﬁrm Network Connection
On the console window of gterm, use the “ping” command to conﬁrm the
network connection.
[/SYS]% ping localhost ←— ping self
localhost is alive <192.168.0.70> : 0 ms[/SYS]% ping 192.168.0.1 ←— pint another machine
192.168.0.1 is alive <192.168.0.1> : 0 ms
† In this example, the Teamacaron IP address is 192.168.0.70 and that ofanother machine is 192.168.0.1. Change these as appropriate for the particular network environment.

(4) Transfer Image Files
Transfer Image Files to the target side (Teamacaron), for the contents ofthe tiny web server.
Getting Started with Teamacaronc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

38

On the console window of gterm, use the “recv” command to transfer
image ﬁles from the host PC to the target side (Teamacaron).
For example, if you want to transfer C:\tmp\abc.jpg,[/SYS]% recv -c -d /cygdrive/c/tmp/abc.jpg←Transfer several image ﬁles in the same manner (those extension must be.jpg or .png).
(5) Create a Project
On the “C/C++ Project” View, click on the mouse right button to showa menu, and select “New” → “T-Engine C/C++ Project”. (Or selectMenubar → “New” → “T-Engine C/C++ Project”.)
Specify the following items.
• Project name :Enter the project name, webserv.
• Target :Specify your target machine (em1d512).
• Program Type:Specify “Process Base”, or “Decide by workspace”, if your workspace
is C:\te\bappl.
• Template:
Do not check it, because the source program will be expanded later.
• Output Directory:
Check it.
And click on the Finish button to create a new project.
(6) Expand Source Program
The source program is archived in “webserv.zip” on the “en\tutorial”
folder in the Teamacaron Development Kit CD-ROM. Expand this archive“webserv.zip” to “C:\te\bappl” by Windows Explorer.
In the “C/C++ Project” View, select right-click menu → “Update”. Now
the source ﬁles appear under the “src” directory of the project “webserv”
in the “C/C++ Project” View. Double-click on “webserv” to view thesource ﬁles.
(7) Make (compile and link)
Select the target Makeﬁle, webserv/em1d512/Makefile, in the “C/C++
Project” View.
And then, select Menubar → “Project” → “Make T-Engine Target all” tomake (compile and link) your program.
If the make is succeeded, the executable ﬁle “webserv/em1d512/webserv”
is generated (with a runner or bug icon).

Getting Started with Teamacaronc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

39(8) Transfer and Execute the Executable File
Select the executable ﬁle “webserv/em1d512/webserv”, click on the mouseright button to show a menu, and select “Run As” → “Run...”. Then appears the Run Dialog.
On the Run Dialog, select “T-Engine Application”, click on the mouseright button to show a menu, and select “New”. Then appears the default
settings to transfer and execute the program.
Click on the Run button at the bottom of the Run Dialog to transfer
and execute the program.
(9) View from Web Browser
From another PC on the network, enter the Teamacaron IP address in a
Web browser, and conﬁrm that the images loaded earlier are listed in thebrowser. If, for example, the Teamacaron IP address is 192.168.0.70, enterthe URL as follows:
http://192.168.0.70/index.html† index.html is the image list page, which is generated automatically by thetiny web server.

(10) Terminate Process
On the console, send ^C (Ctrl-C) to terminate the web server process.
Use the TE logo button upside the console view of Eclipse. (Figure 4.5)

Figure 4.5

4.3

Send ˆC on Eclipse

LED and Interrupt

This is a T-Kernel-based sample program to blink LED and detect switch byinterrupt.
(1) Select a Workspace
Launch Eclipse, and on the “Select a workspace” dialog, select the workspace“C:\te\kappl” for T-Kernel-based programs, and click on OK .
If you have already launched Eclipse and works on other workspace, switch
workspace to “C:\te\bappl”, by Menubar → “File” → “Switch Workspace...”.
† If you switched workspace, also terminate external tools te vcom andgterm. Then you have to run te vcom and gterm again. On the console window of gterm, hit ←- (Enter) key several times, and conﬁrm a CLI
prompt (such as [/SYS]%).

Getting Started with Teamacaronc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

40(2) Create a Project
On the “C/C++ Project” View, click on the mouse right button to showa menu, and select “New” → “T-Engine C/C++ Project”. (Or selectMenubar → “New” → “T-Engine C/C++ Project”.)
Specify the following items.
• Project name :Enter the project name, ledint.
• Target :Specify your target machine (em1d512).
• Program Type:Specify “T-Kernel Base”, or “Decide by workspace”, if your workspace
is C:\te\kappl.
• Template:
Do not check it, because the source program will be expanded later.
• Output Directory:
Check it.
And click on the Finish button to create a new project.
(3) Expand Source Program
The source program is archived in “ledint.zip” on the “en\tutorial”
folder in the Teamacaron Development Kit CD-ROM. Expand this archive“ledint.zip” to “C:\te\kappl” by Windows Explorer.
In the “C/C++ Project” View, select right-click menu → “Update”. Now
the source ﬁles appear under the “src” directory of the project “ledint”
in the “C/C++ Project” View. Double-click on “ledint” to view thesource ﬁles.
(4) Make (compile and link)
Select the target Makeﬁle, ledint/em1d512/Makefile, in the “C/C++
Project” View.
And then, select Menubar → “Project” → “Make T-Engine Target all” tomake (compile and link) your program.
If the make is succeeded, the relocatable executable ﬁle ledint/em1d512/ledint
is generated.
(5) Transfer and Execute the Executable File
Select the executable ﬁle ledint/em1d512/ledint, click on the mouseright button to show a menu, and select “Run As” → “Run...”. Thenappears the Run Dialog.
On the Run Dialog, select “T-Engine Application”, click on the mouseright button to show a menu, and select “New”. Then appears the default
settings to transfer and execute the program.
Click on the Run button at the bottom of the Run Dialog to transfer andexecute the program. Then the program is loaded on the system common
space.
Getting Started with Teamacaronc 2010 Personal Media Corporation°

4

RUNNING THE LEARNING SAMPLE PROGRAMS

41

By this program LED2 (red) or LED3 (orange) start blinking. By pushing SW4 (push switch near the LAN connector) changes blinking pattern(Figure 4.6).

Figure 4.6

Getting Started with Teamacaron

LED2, LED3 and SW4

c 2010 Personal Media Corporation°

IndexB

breakpoint . . . . . . . . . . . . . . . . . . . . . . . 35

process-based . . . . . . . . . . . . . . . . . . . . 25
project . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

CR

CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
console . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
continue . . . . . . . . . . . . . . . . . . . . . . . . . 35
cross-development . . . . . . . . . . . . . . . . . 4
Cygwin . . . . . . . . . . . . . . . . . . . . . . . . . . 13

recv command . . . . . . . . . . . . . . . . . . . 38
reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
S

screen size . . . . . . . . . . . . . . . . . . . . . . . 11
serial conversion cable . . . . . . . . . . . . . 4

DT

debug information . . . . . . . . . . . . . . . . 35
E

Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
F

TCP/IP . . . . . . . . . . . . . . . . . . . . . . . . . 36
Tera Term Pro . . . . . . . . . . . . . . . . . . . . 5
te vcom . . . . . . . . . . . . . . . . . . . . . . . . . . 22
T-Kernel-based . . . . . . . . . . . . . . . . . . 25
T-Monitor . . . . . . . . . . . . . . . . . . . . . . . 23

FAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
format command . . . . . . . . . . . . . . . . . 8

Uunlspg command . . . . . . . . . . . . . . . . 25
Ggterm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
H

hdpart command . . . . . . . . . . . . . . . . . 7
HyperTerminal . . . . . . . . . . . . . . . . . . . . 5
IW

web server . . . . . . . . . . . . . . . . . . . . . . . 36
Windows 7 . . . . . . . . . . . . . . . . . . . . . . . 13
Windows Vista . . . . . . . . . . . . . . . . . . . 13
Windows XP . . . . . . . . . . . . . . . . . . . . . 13
workspace . . . . . . . . . . . . . . . . . . . . . . . . 17

IMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
JJava Runtime . . . . . . . . . . . . . . . . . . . . 16
juggling . . . . . . . . . . . . . . . . . . . . . . . . . . 33
L

LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
lodspg command . . . . . . . . . . . . . . . . 25
ls command . . . . . . . . . . . . . . . . . . . . . 23
Mmemory protection . . . . . . . . . . . . . . . 25
microSD . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Nnetconf command . . . . . . . . . . . . . . . . 37
P

Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
ping command . . . . . . . . . . . . . . . . . . . 37
42

Getting Started with Teamacaron
Version 1.A0.00
Web: http://www.t-engine4u.com/
E-Mail: te-sales@personal-media.co.jp
c 2010 by Personal Media Corporation
Copyright °