5. Building

The following figure gives an overview of the workflow for building an application.

For more information about the processing and files that are required to build an application, see the CTR Guide to Developing a Build System.

Figure 5-1. Overview of the Steps for Building an Application

Source Files / armcc / Only for applications that support Download Play / CI File (Client Program) / Object Files / Bannder Data / BSD Files / makeciaarchive / armlink / makebanner / CFA File / AXF File / ICN File  / BNR File / Files to include in the ROM archive / E-manual (Manual.bcma) / makerom / RSF File / CXI File / makecia / CCI File (Card Applications) / CIA File (Downloadable Applications) / CIA File (Client Applications) Files preprared by developers / Files generated by tools / Tools

5.1. Using the CTR-SDK Build System

If you are using the CTR-SDK's build system, you can configure environment variables, build options, and build variables in an OMakefile, and run omake to easily generate an executable file for your application. Simply change the value specified for CTR_APPTYPE and a few other settings to create a downloadable application, instead of card-based software.

If you have specified a BSF file specified with CTR_BANNER_SPEC in your OMakefile, the ICN and BNR files to specify for CTR_BANNER are generated based on the BSF file when you build your application. The CTR_BANNER, CTR_ICON, CTR_NO_BANNER, and CTR_NO_ICON values, even when set, are ignored when CTR_BANNER_SPEC is set.

For more information, see the Build Rules page in the CTR-SDK documentation.

5.1.1. Creating Card-Based Applications

The following table shows both required and recommended OMakefile settings for building card-based applications.

Table 5-1. OMakefile Settings for Building Card-Based Applications
Setting Description
CTR_APPTYPE CARD
DESCRIPTOR

$(CTRSDK_ROOT)/resources/specfiles/Application.desc (standard applications)

$(CTRSDK_ROOT)/resources/specfiles/ExtApplication.desc (extended applications)

ROM_SPEC_FILE Specify an RSF file.
CTR_BANNER Specify a BNR file.
CTR_ICON Specify an ICN file.
MANUAL_DIR Specify a directory where files for an e-manual are stored.
CHILD_APPS[] Specify one or more CIA files to distribute as client programs if your application supports Download Play.
Code 5-1. Sample OMakefile (for Card-Based Applications)
SUPPORTED_TARGETS = CTR-TS.Process.MPCore.*

Omitted (header files, source files, libraries, shaders...)

TARGET_PROGRAM = MyApp
TITLE =          MyApp
CTR_APPTYPE =    CARD
DESCRIPTOR =     $(CTRSDK_ROOT)/resources/specfiles/Application.desc
ROM_SPEC_FILE =  MyApp.rsf
CTR_BANNER =     MyApp.bnr
CTR_ICON =       MyApp.icn
ROMFS_ROOT =     romfiles
MANUAL_DIR =     manual
CHILD_APPS[] =
    ../MyChildApp/images/$(BUILD_TARGET_DIR)/$(BUILD_TYPE_DIR)/MyChildApp.cia

include $(ROOT_OMAKE)/modulerules
build:  $(DEFAULT_TARGETS) 

For settings not included in the table, see the Build Rules page in the CTR-SDK documentation.

5.1.2. Creating Downloadable Applications

The following table shows both required and recommended OMakefile settings for building downloadable applications.

Table 5-2. OMakefile Settings for Building Downloadable Applications
Setting Description
CTR_APPTYPE SD
DESCRIPTOR

$(CTRSDK_ROOT)/resources/specfiles/Application.desc (standard applications, full version)

$(CTRSDK_ROOT)/resources/specfiles/DemoVersion.desc (standard applications, demo version)

$(CTRSDK_ROOT)/resources/specfiles/ExtApplication.desc (extended applications, full version)

$(CTRSDK_ROOT)/resources/specfiles/ExtDemoVersion.desc (standard applications, demo version)

ROM_SPEC_FILE Specify an RSF file.
CTR_BANNER Specify a BNR file.
CTR_ICON Specify an ICN file.
MANUAL_DIR Specify a directory where files for an e-manual are stored.
CHILD_APPS[] Specify one or more CIA files to distribute as client programs if your application supports Download Play.
Code 5-2. Sample OMakefile (for Downloadable Applications)
SUPPORTED_TARGETS = CTR-TS.Process.MPCore.*

Omitted (header files, source files, libraries, shaders...)

TARGET_PROGRAM = MyDownloadApp
TITLE =          MyApp
CTR_APPTYPE =    SD
DESCRIPTOR =     $(CTRSDK_ROOT)/resources/specfiles/Application.desc
ROM_SPEC_FILE =  MyDownloadApp.rsf
CTR_BANNER =     MyDownloadApp.bnr
CTR_ICON =       MyDownloadApp.icn
ROMFS_ROOT =     romfiles
MANUAL_DIR =     manual
CHILD_APPS[] =
    ../MyChildApp/images/$(BUILD_TARGET_DIR)/$(BUILD_TYPE_DIR)/MyChildApp.cia

include $(ROOT_OMAKE)/modulerules
build:  $(DEFAULT_TARGETS) 

For settings not included in the table, see the Build Rules page in the CTR-SDK documentation.

5.1.3. Creating Client Programs

The following table shows both required and recommended OMakefile settings for building client programs.

Table 5-3. OMakefile Settings for Building Client Programs
Setting Description
CTR_APPTYPE NAND
DESCRIPTOR

$(CTRSDK_ROOT)/resources/specfiles/DlpChild.desc (standard applications)

Note: You cannot create client programs for extended applications.

ROM_SPEC_FILE Specify an RSF file.
CTR_NO_BANNER true
CTR_ICON Specify an ICN file.
Code 5-3. Sample OMakefile (for Client Programs)
SUPPORTED_TARGETS = CTR-TS.Process.MPCore.*

Omitted (header files, source files, libraries, shaders...)

TARGET_PROGRAM = MyChildApp
TITLE =          ChildApp
CTR_APPTYPE =    NAND
DESCRIPTOR =     $(CTRSDK_ROOT)/resources/specfiles/DlpChild.desc
ROM_SPEC_FILE =  MyChildApp.rsf
CTR_NO_BANNER =  true
CTR_ICON =       MyChildApp.icn
ROMFS_ROOT =     romfiles

include $(ROOT_OMAKE)/modulerules
build:  $(DEFAULT_TARGETS) 

For settings not included in the table, see the Build Rules page in the CTR-SDK documentation.

5.2. Using Your Own Build System

This section describes the required steps to create an application when using your own build system instead of the build system provided with the CTR-SDK.

For more information, see the Guide to Developing a Build System section in the CTR-SDK documentation.

5.2.1. Creating AXF Files

Use armlink to link the object files and library files compiled with armcc, and create the AXF file.

 

Sample Usage:

armlink --datacompressor off --keep=nnMain \
--scatter=$CTRSDK_ROOT/resources/specfiles/linker/CTR.Process.MPCore.ldscript \
-o MyApp.axf MyApp.o MyAppLib.a ... 

For more information, see the ARMCC documentation and the Guide to Developing a Build System in the CTR-SDK documentation.

5.2.2. Creating ICN Files and BNR Files

Create the icon and banner files used in the application.

 

Sample Usage:

ctr_makebanner32.exe MyApp.bsf 

If the only argument specified is a BSF file, the ICN file and BNR file are created with the same name as the BSF file, except for the different filename extensions. The example above would create two files, MyApp.icn and MyApp.bnr.

For more information, see 4.2. BSF Files and the reference for the ctr_makebanner tool in the CTR-SDK documentation.

5.2.3. Creating E-Manual CFA Files

Run ctr_makerom32.exe with the following options to create the CFA file for the e-manual included with your application. You must first use CTR-ManualTools to create the Manual.bcma files for the e-manual.

  • -f data
  • -rsf $CTRSDK_ROOT/resources/specfiles/Manual.rsf
  • -DROMFS_ROOT=<Directory where e-manual files (Manual.bcma) are stored>
  • -o <Name of CFA file to create>

 

Sample Usage:

ctr_makerom32.exe -DROMFS_ROOT=manual_dir -f data \
-rsf $CTRSDK_ROOT/resources/specfiles/Manual.rsf -o Manual.cfa 

For more information, see 4.3. E-Manuals and the reference for the ctr_makerom tool in the CTR-SDK documentation.

5.2.4. Creating Card-Based Applications

CCI files are the final ROM image format for card-based applications. These files are used for debugging or for ROMs to be submitted as masters.

5.2.4.1. Creating CCI Files

You need the following files in order to create a CCI file.

  • AXF file
  • DESC files (included in CTR-SDK)
  • RSF file
  • ICN files
  • BNR files
  • E-manual CFA files (when supporting an e-manual)
  • Client program CFA files (when supporting Download Play)

Run ctr_makerom32.exe with the following options to create the CCI file.

  • -f card
  • -rsf <RSF file>
  • -desc $CTRSDK_ROOT/resources/specfiles/Application.desc
    • For extended applications: -desc $CTRSDK_ROOT/resources/specfiles/ExtApplication.desc
  • -icon <ICN file>
  • -banner <BNR file>
  • -content <CFA file>:<Index>
    • Specify 1 for the index value if the CFA file is for an e-manual.
    • Specify 2 for the index value if the CFA file is for a client program.
  • -o <Name of CCI file to create>

For more information, see the reference for the ctr_makerom tool in the CTR-SDK documentation.

 

Sample Usage:

ctr_makerom32.exe MyApp.axf -f card -rsf MyApp.rsf \
-desc $CTRSDK_ROOT/resources/specfiles/Application.desc \
-icon MyApp.icn -banner MyApp.bnr \
-content Manual.cfa:1 -content MyChildApp.cfa:2 \
-o MyApp.cci 

5.2.5. Creating Downloadable Applications

CIA files are the final ROM image format for downloadable applications. These files are used for debugging or for ROMs to be submitted as masters.

You must first create a CXI file before you can create a CIA file.

5.2.5.1. Creating CXI Files

You need the following files in order to create a CXI file.

  • AXF file
  • DESC files (included in CTR-SDK)
  • RSF file
  • ICN files
  • BNR files

Run ctr_makerom32.exe with the following options to create the CXI file.

  • -f exec
  • -rsf <RSF file>
  • -desc $CTRSDK_ROOT/resources/specfiles/Application.desc
    • For demo versions of standard applications: -desc $CTRSDK_ROOT/resources/specfiles/DemoVersion.desc
    • For extended applications: -desc $CTRSDK_ROOT/resources/specfiles/ExtApplication.desc
    • For demo versions of extended applications: -desc $CTRSDK_ROOT/resources/specfiles/ExtDemoVersion.desc
  • -icon <ICN file>
  • -banner <BNR file>
  • -o <Name of CXI file to create>

For more information, see the reference for the ctr_makerom tool in the CTR-SDK documentation.

 

Sample Usage:

ctr_makerom32.exe MyDownloadApp.axf -f exec -rsf MyApp.rsf \
-desc $CTRSDK_ROOT/resources/specfiles/Application.desc \
-icon MyApp.icn -banner MyApp.bnr \
-o MyDownloadApp.cxi 

5.2.5.2. Creating CIA Files

You need the following files in order to create a CIA file.

  • CXI file
  • E-manual CFA file
  • Client program CFA files (when supporting Download Play)

Run ctr_makecia32.exe with the following options to create the CIA file.

  • -i <CXI file>
  • -man <E-manual CFA file>
  • -i <Client program CFA file>:2 (You must specify the index value.)
  • -o <Name of CIA file to create>

For more information, see the reference for the ctr_makecia tool in the CTR-SDK documentation.

 

Sample Usage:

ctr_makecia32.exe -i MyDownloadApp.cxi -man Manual.cfa -o MyDownloadApp.cia 

5.2.6. Creating Client Programs

Client programs included with card-based applications or downloadable applications are bundled into a single CFA file, as specified in the options when creating the card-based application or downloadable application.

You must first create the CIA file before you can create a CFA file, and to create the CIA file, you must first create a CXI file. In order, create the CXI file, create the CIA file, and then create the CFA file.

5.2.6.1. Creating CXI Files

You need the following files in order to create a CXI file. Banners are not displayed, so you do not need a BNR file.

  • AXF file
  • DESC files (included in CTR-SDK)
  • RSF file
  • ICN files

Run ctr_makerom32.exe with the following options to create the CXI file.

  • -f exec
  • -rsf <RSF file>
  • -desc $CTRSDK_ROOT/resources/specfiles/DlpChild.desc
  • -icon <ICN file>
  • -o <Name of CXI file to create>

For more information, see the reference for the ctr_makerom tool in the CTR-SDK documentation.

 

Sample Usage:

ctr_makerom32.exe MyChildApp.axf -f exec -rsf MyChildApp.rsf \
-desc $CTRSDK_ROOT/resources/specfiles/DlpChild.desc \
-icon MyChildApp.icn \
-o MyChildApp.cxi 

5.2.6.2. Creating CIA Files

You need the following files in order to create a CIA file.

  • CXI file

Run ctr_makecia32.exe with the following options to create the CIA file.

  • -i <CXI file>
  • -o <Name of CIA file to create>

For more information, see the reference for the ctr_makecia tool in the CTR-SDK documentation.

 

Sample Usage:

ctr_makecia32.exe -i MyChildApp.cxi -o MyChildApp.cia 

5.2.6.3. Creating CFA Files

You need the following files in order to create a CFA file.

  • All CIA files for client programs to distribute

Run ctr_makeciaarchive32.exe with the following options to create the CFA file. Client programs distributed for Download Play are bundled into a single CFA file.

  • -cia <List of client program CIA files>
  • -o <Name of CFA file to create>

For more information, see the reference for the ctr_makeciaarchive tool in the CTR-SDK documentation.

 

Sample Usage:

ctr_makeciaarchive32.exe -cia MyChildApp.cia -o MyChildApp.cfa 

This CFA file is used when creating a card-based application with the -content option (index 2), or when creating a downloadable application with the -i option (index 2).


CONFIDENTIAL