Build Switch

SDK Build Time Environment Variables

The following table is a list of environment variables for changing Nitro-SDK tree build conditions. In addition to setting their values with normal environment variables, it is also possible to set them by passing NITRO_DEBUG=True as a make command argument, or by defining NITRO_DEBUG=True with Makefile, etc. Initial values will be used if no settings are made.

CWFolder_NITRO
or
CWFOLDER_NITRO
The directory in which CodeWarrior is installed.

Setting is automatic when you install CodeWarrior for NITRO. When setting with bash in cygwin, the path must be enclosed in single quotes:

% export CWFolder_NITRO='D:/Program Files/Metrowerks/CodeWarrior' 

When setting with Windows environment variables, it becomes:

D:/Program Files/Metrowerks/CodeWarrior

Both / and \ will work as path delimiters.

Initial value: C:\Program Files\Metrowerks\CodeWarrior for NITRO V0.5

LM_LICENSE_FILE
Directory that contains the CodeWarrior license file.

Initial value: none. Normally this is not required.

NITROSDK_ROOT
Important
NITROSDK is installed in this directory. Additionally, $NITROSDK is deployed in this directory.

Although / and \ will both work as path delimiters, there are many cases in which the IDE in CodeWarrior prefers \, so we recommend using \.

Initial value: C:\NitroSDK. However, if the SDK is provided by the installer, the path that is selected by the installer will be set.

NITROSDK_LANG You can switch the NitroSDK compile options between Japanese and English.

For the options, English uses "-enc ascii". Japanese uses "-enc SJIS".

en English
jp Japanese

Initial value: If the SDK that is provided by a zip file and Japanese is provided by the installer, the language that is selected by the installer will be set.
NITRO_PROC
Important for ARM7
This switch switches between generating code for the main processor and the sub processor. It is also often specified in the makefile.

ARM9 Code for the Main Processor
ARM7 Code for the Sub Processor

Initial value: ARM 9 (code for the Main Processor)
NITRO_CODEGEN This gives the compiler and the assembler default values for whether to generate ARM code or Thumb code. If the output type is not specified by the source code, the compiler and assembler create the executable according to these values.

ARM 32-bit ARM code
THUMB 16-bit THUMB code

Initial value: ARM
NITRO_PLATFORM
and
NITRO_TS_VERSION
The NITRO compile target is specified as shown below.
The architecture is specified with NITRO_PLATFORM, and the exact version related to the TS is specified with NITRO_TS_VERSION.

Switching by NITRO_PLATFORM
TS
IS-NITRO-EMULATOR hardware or the NINTENDO-DS retail unit (Detailed differences between the versions is selected with NITRO_TS_VERSION)
TEG
TEG board
BB
Breadboard

Switching by NITRO_TS_VERSION
0
From TS Bread Board to IS-NITRO-EMULATOR hardware Ver. C
100
IS-NITRO-EMULATOR hardware Ver. D
200
IS-NITRO-EMULATOR hardware Ver. E or Nintendo DS retail device (current as of 9/10/04)

Initial value: NITRO_PLATFORM=TS and NITRO_TS_VERSION=100
NITRO_MEMSIZE
This specifies the NITRO compile target main memory size. This environment variable is currently disabled.

4M
4 Megabytes
8M
8 Megabytes

Initial value: 4M
NITRO_CCTYPE
Compiler specification. However, currently only CodeWarrior is supported.

CW
CodeWarrior
ARM
ARM ADS
GCC
GNU C Compiler

Initial value: CW
NITRO_DEBUG
NITRO_RELEASE
NITRO_FINALROM
Important
You can select from the following compile targets: DEBUG version, RELEASE version, FINALROM version. When the make command is executed, the compile options and the linked libraries will change according to this setting. Unlike other variables, this variable is enabled by setting a value that is applicable to one of the three values.

Initial value: NITRO_RELEASE

NITRO_COMPRESS
When some value has been specified, the STATIC/OVERLAY segment is compressed after the link is completed.
Initial value: None (no compression)
NITRO_DIGEST
This build switch is enabled only for applications. It is disabled at SDK build time. If a value is set, the program will build for a DS Single-Card Play child program that uses overlays.
NITRO_PROFILE
If some value is set, the -profile option is added when compiling. This is primarily used during debugging so that input and output can be traced during execution. For more details, please refer to OS_DumpCallTrace().

Initial value: None (-profile is invalid)

NITRO_NO_OPT_G
If some value is set, remove the specified -g option when performing a standard compile or when linking. This can shorten the link processing time that causes problems in large-scale projects.

Initial value: None (-g is valid)

IS_NITRO_DIR
IS-NITRO-EMULATOR related files are installed in this directory.
Setting is automatic when you install IS-NITRO-EMULATOR.
If this environment variable exists, the IS-NITRO-EMULATOR related library is automatically linked.

Initial value: C:/Program Files/INTELLIGENT SYSTEMS/IS-NITRO-EMULATOR

NITRO_AUTOTEST
In case some value was set, the code for the automated test becomes effective. Management macro for SDK.

Initial value: None. (test code is invalid)

Macro switches that can be used with source

The following table lists macro variables. They are used so that the source side can understand the Nitro-SDK tree build conditions by means of #ifdef#endif C Specifications, etc. Basically, they're controlled by the environment variables set in the source code.
All names begin with SDK_.

SDK_BB
SDK_TEG
SDK_TS
One of these is defined in accordance with the NITRO compile target specification (environment variable NITRO_PLATFORM).

SDK_BB
Breadboard (not currently used)
SDK_TEG
TEG board
SDK_TS
TS

Initial value: SDK_TEG
SDK_4M
SDK_8M
One of these is defined in accordance with the NITRO compile target main memory size specification (environment variable NITRO_MEMSIZE).

SDK_4M
4 Megabytes
SDK_8M
8 Megabytes

Initial value: SDK_4M
SDK_ARM9
SDK_ARM7
One of these is defined in accordance with the processor for which the compile or assembly is performed.

SDK_ARM9
Build for main processor
SDK_ARM7
Build for subprocessor

Initial value: SDK_ARM9
SDK_CODE_ARM
SDK_CODE_THUMB

Shows whether the compiler option is set to generate Thumb code or ARM code.

This is simply to show "Initial Settings". You must reference the definition macro that is incorporated in the compiler to see which code is actually being generated (in the case of CW, _thumb_).

We recommend that when pragma has been used to explicitly switch code generation within one range of the source, when this range ends you should return code generation to the setting shown by this value.

SDK_CODE_ARM
Command set for ARM
SDK_CODE_THUMB
Command set for THUMB

Initial value: CODEGEN_CC/CODEGEN_AS settings
SDK_CW
SDK_ADS
SDK_GCC
One of these is defined in accordance with the compiler that is being used.

SDK_CW
CodeWarrior
SDK_ADS
ARM ADS
SDK_GCC
GNU C Compiler

Initial value: SDK_CW
SDK_ASM
This is defined when assembling with the assembler.

Use this when you want to note that sharing the C header file will cause an error in the assembler.

SDK_DEBUG
SDK_RELEASE
SDK_FINALROM
Important
One of these is defined in accordance with which one of the target compile targets has been specified: DEBUG, RELEASE, or FINALROM).

SDK_DEBUG
DEBUG version
SDK_RELEASE
RELEASE version
SDK_FINALROM
FINALROM version

Initial value: SDK_RELEASE
SDK_PACKING_DATE
SDK_VERSION_DATE

This 8-digit number indicates the packaging date of the SDK as YYYYMMDD.

This value is defined in the $NitroSDK/include/nitro/version.h file.

Because version.h is not included in nitro.h, use the #include <nitro/version.h> statement when referencing this value from the source code.

Generally, SDK_PACKING_DATE and SDK_VERSION_DATE are set in same date value. However, when applying a patch for some kind of modification after the release of the SDK, SDK_PACKING_DATE becomes the release date of the patch and SDK_VERSION_DATE becomes the release date of the SDK that is the target to be modified.

SDK_AUTOTEST

This is an SDK Management Macro.

When build is performed, it works with the environment variable NITRO_AUTOTEST.

The testing code inside your SDK needs to be written as valid auto-test code, only when this macro is defined.

Miscellaneous
There are other temporary compile switches, such as those shown below. Currently no general method has been prepared for these user compile switches. Use them as keywords when searching.

SDK_NO_THREAD
Creates a library that does not use the THREAD function.
SDK_*BUG_*
This is the bug handling switch.
SDK_NO_INTERWORKING
Creates a library that does not consider Thumb/ARM switching.
SDK_SMALL_BUILD
Creates a library with a smaller code size by limiting some functions. (Operation of libraries created with this option is not guaranteed.)

Linker Symbols that can be used with the Source

The following are values defined by LCFile (the linker script file), and they are determined during the linking process.

All names begin with SDK_.

SDK_SYS_STACKSIZE
This symbol controls the size of the DTCM stack used during application startup. Games can be customized by revising the LCF file or LCF specification file.

The OS_Init() function allocates the DTCM region that can be used (excluding the region reserved by the system and interrupt process) to the stack and DTCM arena based on the stack size determined by this value. The configuration method used by OS_Init() depends on whether the value of SDK_SYS_STACKSIZE is positive, negative, or 0.

For Positive Values
The value of SDK_SYS_STACKSIZE is taken as the stack size and the remaining region is allocated to the DTCM arena.
For 0
All available DTCM is set as the stack.

The DTCM arena cannot be used.

For Negative Values
The absolute value of SDK_SYS_STACKSIZE is set as the size of the DTCM arena and the remaining region is used as the stack.

Initial Value: 0
All available DTCM is used as the stack.
SDK_IRQ_STACKSIZE
This is the stack size that is used in the interrupt routine. It is secured as a system region in DTCM.

Here we have taken into account function calls in the interrupt routine that use a lot of the stack, such as OS_Printf. Therefore the initial value is a little high. It is possible to reduce this in the ship ROM version, which will not use OS_Printf.

Depending on the debug environment, you will have to call the debug routine from the interrupt handler, and in some cases you will need to increase this value. For this refer to the documentation for each debug environment.

Initial value: 0x400 bytes.
SDK_MAIN_ARENA_LO
Initial value of the Low address of the main arena.
This value is automatically set during linking.

Macro Switches That Are Set Within SDK Makefile

The switches in the following table are for setting build conditions for each directory using Makefile in the Nitro-SDK. They specify source location, the linking Makefile, and the like.

SUBDIRS
Important
Enumerates directories you want to associate with the make process.

Initial value: None

SUBMAKES
Enumerates the Makefiles that you want to associate with the make process.

Initial value: None

SRCS
Important
Enumerates source files you want to compile or assemble.

Based on each file extension, make will attempt to generate object files using a compiler or assembler for the following programming languages:

Extension
Programming language
.c
C
.cpp
C++
.s
Assembler
SRCS_OVERLAY
For Overlay
Lists the source files to compile or assemble. The object files created from the files specified here are registered as being affiliated with the OVERLAY group.
SRCDIR
Specifies the source file's directory.

Initial value: ./src

The initial value is a path specified by src. The path is relative to the directory from which make is performed.

INCDIR
If there is a private include file (an include file specific to the module) this specifies the directory. You don't need to use this if it is not needed.

Initial value: ./include

OBJDIR
BINDIR
LIBDIR
Prohibit overwrite
make outputs all temporary files to this directory.

This may be changed to accommodate the source tree. Therefore, avoid overwrite within Makefile in individual directories.

LCFILE
Specify this if you want to use your own link command file (.lcf).

Initial value: $NitroSDK/include/nitro/arm9.$(NITRO_PLATFORM).lcf

LCFILE_SPEC
Specifies the source configuration file when automatically creating a link command file with the makelcf command.

Initial Value: Not Defined

ROM_SPEC
Specifies the file describing ROM file contents. This file is passed to the makerom command and is a hint for ROM creation.
TARGET_BIN
Important
Specifies a target file with .srl format or .nef format.

It compiles or assembles the source files specified by SRCS, and links the resultant object files, making them the target files.

When .srl files are specified as the target, .nef files will be created automatically.

TARGET_LIB
Specifies when you want to create a library file.

It compiles or assembles the source files specified by SRCS, and links the resultant object files, making them a library.

Normally TARGET_BIN and TARGET_LIB are not set at the same time.

TARGET_OBJ
Specifies when you want to create an object file as a target.

Normally this is not used very much. Use it for a library when you want to compile crt0.c and install it as a library.

NITRO_PROC
Important for ARM7
This switches between generating code for the Main Processor and the Sub Processor. This is often specified in the Makefile.

ARM9
Code for Main Processor
ARM7
Code for Sub Processor

Initial value: ARM9 (Code for Main Processor)
TARGETS
Overwrite prohibited
All items with relative paths attached to TARGET_BIN and TARGET_LIB will be set automatically. The directories where .srl/.a files are stored will change according to NITRO_PLATFORM and NITRO_DEBUG/ NITRO_RELEASE/ NITRO_FINALROM settings. This macro was prepared to absorb this difference.
INSTALL_TARGETS
Enumerates the files you want to install. The TARGETS described above will function in this setting.

Initial value: None

INSTALL_DIR
Sets file installation target.

Initial value: None

LINCLUDES
If there are other include files, this specifies their directory.
LLIBRARY_DIRS
LLIBRARIES
If there are other library files, this enumerates their directory with LLIBRARY_DIRS, and the library files with LLIBRARIES.
LDIRT_CLEAN
LDIRT_CLOBBER
When make clean or make clobber are executed, this specifies the files that will be erased with the object file. When using make clean, the files specified with LDIRT_CLEAN are erased; when using make clobber, the files specified with both LDIRT_CLEAN and LDIRT_CLOBBER are erased.

© 2004 Nintendo

NTR-06-0021-001-A6