Using the KreaTV Toolchain

The following assumes that you are using make to handle the compilation of your code.

General setup

Variables

DK_DIR should be changed to point to the dir in which the development kit is installed.

The VIP variable is used to control whether to build for a VIP1900 (VIP=st40) or VIP2000 (VIP=bcm74xx). Use it this way:

VIP=st40 HW=25 make

# Architecture handling

ifeq ($(VIP),st40)
VIP_ARCH       = sh4-motorola-linux-gnu
endif
ifeq ($(VIP),bcm74xx)
VIP_ARCH       = mipsel-motorola-linux-uclibc
endif

VIP_NAME       = $(VIP)
VIP_NAME_FULL  = $(VIP_NAME)_$(HW)

# Toolchain
DK_DIR         = $(CURDIR)/../..
TOOLCHAIN_PATH = $(shell cat $(DK_DIR)/$(VIP_NAME)/toolchain_dir)
VIP_DIR        = $(DK_DIR)/$(VIP_ARCH)

Compilation

Compilers

CC is used for C compilation and CXX for C++ compilation.

# Compilers
CC  = $(TOOLCHAIN_PATH)/bin/$(VIP_ARCH)-gcc
CXX = $(TOOLCHAIN_PATH)/bin/$(VIP_ARCH)-c++

Include paths

The following paths is needed for C++ compilation.

# Include paths
CXXFLAGS += -I$(VIP_DIR)/include
CXXFLAGS += -I$(VIP_DIR)/3pp/include
ifeq ($(HW),25)
CXXFLAGS += -I$(TOOLCHAIN_PATH)/include/c++/4.2.1
CXXFLAGS += -I$(TOOLCHAIN_PATH)/include/c++/4.2.1/$(VIP_ARCH)
endif
ifeq ($(HW),29)
CXXFLAGS += -I$(TOOLCHAIN_PATH)/include/c++/4.2.1
CXXFLAGS += -I$(TOOLCHAIN_PATH)/include/c++/4.2.1/$(VIP_ARCH)
endif
ifeq ($(VIP),bcm74xx)
CXXFLAGS += -I$(TOOLCHAIN_PATH)/include/c++/4.2.0
CXXFLAGS += -I$(TOOLCHAIN_PATH)/include/c++/4.2.0/$(VIP_ARCH)
endif

Linking

Library paths

LDFLAGS += -L$(VIP_DIR)/lib
LDFLAGS += -L$(VIP_DIR)/3pp/lib

Libraries

The following is an example of libraries that may be needed when compiling an application.

LDFLAGS += -lgdk
LDFLAGS += -lgtk
LDFLAGS += -lglib
LDFLAGS += -lgmodule
LDFLAGS += -lX11
LDFLAGS += -lXext
LDFLAGS += -lexpat
LDFLAGS += -lcommondbg
LDFLAGS += -lGtkIpc
LDFLAGS += -lIpc
LDFLAGS += -lXmlParser
LDFLAGS += -ltoi

Example

Look in the Makefile for the hello world application included in the SDK for an example of how to use the toolchain.