Building with Simplemake

Overview

The Cafe SDK build system is based upon a sophisticated hierarchy of makefiles and supports several types of executables. Integrating an application into this build system can be a daunting task.

Simplemake demonstrates how to build an external application for the Cafe platform with minimum dependence on the SDK environment.

Simplemake is a set of three demos. The first example, the dynload demo, has a set of makefiles and sample code that produce an RPX and a pair of RPLs. The makefile for the RPX application binary can be found here:

($CAFE_ROOT)/system/src/demo/dynload/mod_char/game/Makefile

The makefiles that create the RPL modules can be found here:

($CAFE_ROOT)/system/src/demo/dynload/mod_char/char1/makefile.sub
($CAFE_ROOT)/system/src/demo/dynload/mod_char/char2/makefile.sub

The other demo, helloworld has a single makefile and sample code that produce an RPX.

The makefiles that create the RPX modules can be found here:

($CAFE_ROOT)/system/src/demo/helloworld/makefile
($CAFE_ROOT)/system/src/demo/helloworld/makefile

These makefiles capture SDK dependencies into a set of environment variables that are customizable.

Goals

The goals of Simplemake:

Requirements

Shell Environment

The simplemake demos must be executed from a Cygwin shell. However, simplemake does not require a Cafe Cygwin shell.

System Variables

The following variables must be defined in each simplemake makefile or shell environment:

Variable Description
CAFE_SDK_ROOT The installation path of the Cafe SDK.
GHS_ROOT The installation path of the Green Hills Software MULTI tool chain.

Customizing Simplemake for Your Application

The makefiles for these demos define key environment variables for adaptation into your application's build system. Refer to the makefiles for more information. Common customizations are discussed below.

Moving Outside Cafe SDK

The simplemake demos can be moved to any location on the host PC. However, ensure that the CAFE_SDK_ROOT and GHS_ROOT variables are set correctly in each makefile.

Location of Executables

All RPX and RPL files must be located in the same directory when executing. The RPL_TARGET variable indicates the directory to which executables will be installed.

Other Variables

The following variables may also be useful when adapting your build process for Cafe.

Variable Description Remarks
OBJ_DIR Destination directory for object files. Default is ./obj/
BIN_DIR Destination directory for linked files. Default is ./bin/
RPL_TARGET Destination directory for final RPX and RPL files. Default is $CAFE_SDK_ROOT/data/disc/rpl/
BINNAMES Name of the main RPX file. Used in primary RPX makefile only.
RPLNAME Name of the RPL module file. Used in sub-makefile only.
SPECIFY_DEF_FILE Used in conjunction with PrepRPL tool. By default retrieves export list from a text file ('-x [file]'). To export everything, use '-xall'.
CSCRS Names of all source files necessary for build.
DEFINES #define values needed by the SDK headers.
DUAL_FLAGS Directives needed by both the compiler and linker.
RPL_CONFIG_SDA Specifies how to exploit the small data area (as described by the PowerPPC EABI). This is an optimization for global variable address look-up.
CCFLAGS Compiler directives/flags.
LDFLAGS Linker directives/flags.
RPL1/RPL2 *new* Points to the dependent RPL files for the application. This demonstrates a new option of caferun to point to dependent RPL files.

For more information and additional variables, refer to the makefiles directly.

Generating RPX and RPL Files

For information, see the "Build Products" section of the Building the SDK MAN page.

Known Issues

Auto SDA Optimization

Large applications may encounter link failures if the Small Data Area optimization is enabled, due to a known issue in the compiler/linker tool chain.

The simplemake demo illustrates how to work around this problem by disabling SDA optimizations.

For RPLs, the -sda=none, -nothreshold, and -checknosda flags are used.

For RPXs, the -sda=none flag is used.

For more information, refer to the simplemake makefiles .

General Design Stability

The build system and application structure continue to evolve as the platform matures. We hope to concisely capture these changes in the simplemake demo.

The caferun -l option enables you to have RPLs in different directories from the RPX. The -l option specifies the highest level directory above all the RPLs to be included and/or the specific RPL file. For further details, see the caferun MAN page.

See Also

Environment Settings
RPX/RPL Developer Overview
makerpl[32|64]
preprpl[32|64]

Revision History

2013/08/06 Removed references to older SDKs.
2013/05/08 Automated cleanup pass.
2011/08/03 Add helloworld examples.
2011/07/21 Caferun -l option added.
2011/02/21 Initial version.


CONFIDENTIAL