Build Switch

Environmental variables when building SDK

The below table is a list of the environmental variables for changing the build conditions of the NitroSDK tree. Besides setting these values with normal environmental variables, it is possible to configure them by passing make NITRO_DEBUG=True as a make command argument or by describing NITRO_DEBUG=True in Makefile. When not configured, the initial value is used.

CWFolder_NITRO
or
CWFOLDER_NITRO
CodeWarrior is installed in this directory.
It is automatically configured when IS NITRO EMULATOR is installed.
This directory must be delimited by single quotes as shown below when set using bash of cygwin.
% export CWFolder_NITRO='D:/Program Files/Metrowerks/CodeWarrior' 

This directory must be specified as shown below when set using a Windows environment variable.
D:/Program Files/Metrowerks/CodeWarrior
Both / and \ will work as path delimiters.
Initial value: C:/Program Files/Metrowerks/CW for NINTENDO DS V1.0.2
LM_LICENSE_FILE License file path for CodeWarrior.
Initial value: None Usually set when CodeWarrior is installed.
NITROSDK_ROOT
Important
Directory in which NITRO-SDK is installed and $NitroSDK is deployed.
Both / and \ can be used as path delimiters, but \ is recommended because \ is preferred in the IDE of CodeWarrior.
The default value is C:\NitroSDK, but the path selected by the installer will be set when the SDK is provided by the installer.
NITRO_STD_PCHDR
NITRO_NO_STD_PCHDR
When some value is set for NITRO_STD_PCHDR, the build system precompiles $NitroSDK/include/nitro.h before the build, and reads in the result during the build. Faster builds can be expected. If you want to temporarily suppress this compile, set a value for NITRO_NO_STD_PCHDR.
This feature is supported beginning with NITRO-SDK 3.0.
NITROSDK_LANG You can switch the NitroSDK compile options between Japanese and English.

For the options, use "-enc ascii" for English and "-enc SJIS".
en English
jp Japanese
Initial value: Japanese
NITRO_PROC
No change necessary
This switch switches between generating code for the main processor and the sub processor. Use the initial value as is.
ARM9 Code for the Main Processor
ARM7 Code for the Sub Processor
Initial value: ARM9 (Code for the Main Processor)
NITRO_MAKEROM
No change necessary
If any value has been set for NITRO_MAKEROM, a ROM image of the program will be generated by the makerom.exe tool. Since this is always specified, there is no need to make an explicit setting.
NITRO_CODEGEN This gives the compiler and the assembler default values for whether to generate ARM code or Thumb code. If there is no explicit setting in the source, the compiler and assembler generate the code according to these values.
ARM 32-bit ARM code
THUMB 16-bit THUMB code
Initial value: ARM
NITRO_PLATFORM
and
NITRO_TS_VERSION
No change necessary
The NITRO compile target is specified as follows.
Use the initial value as is.

Specify the architecture with the NITRO_PLATFORM value. For TS,
specify the exact version with NITRO_TS_VERSION.
Switching by NITRO_PLATFORM
TS IS-NITRO-EMULATOR hardware as well as the retail version of the Nintendo DS system
(Select the exact version with NITRO_TS_VERSION)
TEG TEG board
BB Breadboard
Switching by NITRO_TS_VERSION
0 From the TS Breadboard to IS-NITRO-EMULATOR hardware version C
100 IS-NITRO-EMULATOR hardware version D
200 IS-NITRO-EMULATOR hardware version E as well as the retail version of the Nintendo DS system (as of 09/10/2004)
Initial value: NITRO_PLATFORM=TS as well as NITRO_TS_VERSION=200

Note: In the NITRO-SDK, os and spi libraries are prepared for each TS_VERSION. This is relevant when the development environment uses the TS breadboard, etc. and has owner information in an old save format. But when the save format is the same as that used for the retail DS system, the library is exactly the same. When the make system is used, the library for linking is selected automatically based on the environment variable. But in a development environment using IDE, you need to manually select which library to link. Note, however, that selecting a library is meaningless except when a development environment that uses TS breadboard has been used, so there is no problem using libraries linked by default.
NITRO_MEMSIZE
No change necessary
This specifies the main memory size of NITRO compile targets.
This build switch specification method has been kept for back-compatibility.
We recommend using OS_EnableMainExArena instead, since it does not require rebuilding the SDK.
4M 4 Megabytes
8M 8 Megabytes
Initial value: 4M
NITRO_CCTYPE Compiler settings. CW is currently specifiable.
CW CodeWarrior
SNC ProDG (scheduled)
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 an appropriate value to one of the three values.
See $NitroSDK/man/jp_JP/information/compiletarget.html (compile target explanation) for details of these three options.
Initial value: NITRO_RELEASE
NITRO_COMPRESS
Important
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 when building SDK.
If a value is set, the program will build for a DS download play child program that uses overlays.
NITRO_PROFILE If a value is set, the -profile option is added when compiling. This is primarily used during debugging so that input and output of each function can be traced during execution. For details of use, see OS_DumpCallTrace().
Initial value: None (-profile option is disabled)
NITRO_NO_OPT_G When some value has been set, the -g option used to specify normal compilation and linking is removed. Programmers can expect a reduction in linking times that can become a problem in larger projects.
Initial value: None (-g option enabled)
IS_NITRO_DIR This is the directory where IS NITRO EMULATOR related files are installed.
It is automatically configured when IS NITRO EMULATOR is installed.
If this environmental variable exists, the IS NITRO EMULATOR related library is automatically linked.
Initial value: C:/Program Files/INTELLIGENT SYSTEMS/IS-NITRO-EMULATOR
NITRO_ROMSPEED
Important
When the default RSF file is used, the RomSpeedType parameter in the Property section is assigned a value.
The value is the value in the MAKEROM_ROMSPEED symbol that is passed to the makerom.exe tool.
When an original file is used rather than the default RSF file, it is simply ignored.
For details on the RomSpeedType parameter, see the reference for the makerom.exe tool.
1TROM One-time PROM
MROM Mask ROM
UNDEFINED None specified
Initial value: UNDEFINED
CW_LIBFP You can set one of the following floating-point library names to be specified to the CodeWarrior compiler.
If nothing is specified, the initial value will be used.
For details on the differences in performance between the libraries, see the CodeWarrior reference.
FP_fastI_v5t_LE.a fast IEEE
FP_fixedI_v5t_LE.a fixed-rounding IEEE
FP_fullI_v5t_LE.a full IEEE
FP_flush0_v5t_LE.a flush to zero (not IEEE compatible)
Initial value: FP_fastI_v5t_LE.a
NITRO_SVC_WAITVBLANK_COMPATIBLE
Define this when you do not wish to automatically replace the SVC_WaitVBlankIntr function call with the OS_WaitVBlankIntr function call.
However, the SVC_WaitVBlankIntr function has the specification that will not release the resource to a low-priority thread, so depending upon how this is used some problems may occur. If a system call must be used as it has been in the past, it should be used after thorough verification.

Note that this replacement is made using a define inside a header file, so it will be valid only after the NITRO-SDK is re-built.
If these environmental variables are defined during make, SDK_SVC_WAITVBLANK_COMPATIBLE will be defined and you can find it in the source via #ifdef - #endif statements.

This is not defined with the initial values, so the SVC_WaitVBlankIntr function call is automatically replaced with the OS_WaitVBlankIntr function call.

Macro Switches that can be Used in the Source

The below table is a list of the macro variables for finding the NitroSDK tree build conditions from the source by means of #ifdef - #endif directives. Fundamentally, they are controlled by the environment variables mentioned in the previous section.
All names start with SDK_.

SDK_TS
SDK_TEG
SDK_BB

One of them is defined in accordance with the NITRO compile target specification (environmental variable NITRO_PLATFORM). Currently, only SDK_TS is supported, so there is no need to be conscious of the settings.
SDK_TS Retail version of the Nintendo DS system
SDK_TEG Support finish:TEG board
SDK_BB Support finish:Breadboard
Initial value: SDK_TS
SDK_4M
SDK_8M
One of them is defined in accordance with the NITRO compile target main memory size specification (environmental variable NITRO_MEMSIZE). Since the expanded arena can be used, there currently is no need to use the 8M setting.
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. Application developers do not need to pay attention to the SDK_ARM7 code.
SDK_ARM9 Build for Main Processor
SDK_ARM7 Build for Sub Processor
Initial value: SDK_ARM9
SDK_CODE_ARM
SDK_CODE_THUMB
Indicates whether the compile 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. (_thumb_ with CW) 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 The instructions set for ARM
SDK_CODE_THUMB The instructions set for THUMB
Initial value: Follows CODEGEN_CC/CODEGEN_AS settings.
SDK_CW
SDK_SNC
One of these is defined in accordance with the compiler that is being used.
SDK_CW CodeWarrior
SDK_SNC ProDG Compiler (scheduled)
Initial value: SDK_CW
SDK_ASM This is defined when assembled by the assembler.
It can be used when you want write a description that causes an error in the assembler when sharing the C header file.
SDK_DEBUG
SDK_RELEASE
SDK_FINALROM
Important
In accordance with the specifications of the DEBUG version, the RELEASE version, or the FINALROM version, one of these is defined as the compile target.
SDK_DEBUG DEBUG version
SDK_RELEASE RELEASE version
SDK_FINALROM FINALROM version
Initial value: SDK_RELEASE
SDK_PACKING_DATE
SDK_VERSION_DATE
SDK_VERSION_MAJOR
SDK_VERSION_MINOR
SDK_VERSION_RELSTEP
SDK_PACKING_DATE and SDK_VERSION_DATE indicate the date when the SDK package was created. The date is expressed as an 8-digit number in the YYYYMMDD format. Under current specifications, these two date values are set to the same value.

SDK_VERSION_MAJOR and SDK_VERSION_MINOR represent the version number of the SDK. For example, if the SDK version number is 2.1, SDK_VERSION_MAJOR is set to 2 and SDK_VERSION_MINOR is set to 1.

SDK_VERSION_RELSTEP is used to distinguish between the official SDK release and PR and RC version releases which may be shipped before the official version of the SDK. The value 30000 is used in the official release version.

These values are defined in the file $NitroSDK/include/nitro/version.h.Unlike in previous versions, version.h is placed in an include statement in nitro.h, beginning with SDK 2.2.
SDK_SVC_WAITVBLANK_COMPATIBLE This is defined if NITRO_SVC_WAITVBLANK_COMPATIBLE is defined during make.
For further details, refer to the section about NITRO_SVC_WAITVBLANK_COMPATIBLE.
Other Below are other temporary compile switches that have been provided. There are currently no general methods for users to switch these compile switches. Use them as keywords when searching.
SDK_NO_THREAD Creates a library that does not use the THREAD feature.
SDK_*BUG_* This switch is for providing measures against bugs.
SDK_NO_INTERWORKING Creates a library that does not take switching between Thumb and ARM into considerations.
SDK_SMALL_BUILD Creates a library of a reduced code size by limiting some of the functionalities.
(Operation of the library created with this option is not guaranteed.j

Other Macros that can be used in the source

The below table contains the other macros that can be used in the source file.

All names start with SDK_.

SDK_WEAK_SYMBOL This macro modifies the type name when the function is defined, and shows that the function is a weak symbol.
When CodeWarrior is used as the compiler, this macro is defined as follows:

#define SDK_WEAK_SYMBOL __declspec(weak)

There is no guarantee that this macro will work with all compilers. If the compiler does not support weak symbols, the macro will be defined as NULL.
SDK_INLINE
SDK_DECL_INLINE
This shows whether a function is configured as a static inline function or an inline function.
The entire NITRO-SDK must be rebuilt if these macro values are changed.
These values are defined in the file $NitroSDK/include/nitro/types.h.

However, the code size can be reduced by changing these macros from static inline to inline only when using the environment with the compiler version in which the the inline function materialization problem has been fixed and using the functions that have been changed from inline to static inline to avoid this problem.
Since the result of changing these macros is essentially not guaranteed, base the decision on the application.

Initial value: SDK_INLINE static inline, SDK_DECL_INLINE static

Linker Symbols that can be Used in the Source

The below table shows the values defined in the LCFile (linker script file).
These values are determined during linking.

All names start with SDK_.

SDK_SYS_STACKSIZE This symbol controls the size of the DTCM stack used during application startup. It is possible to customize for each game by making corrections in the LCF file and the LCF spec 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 as the DTCM arena.
For 0 All available DTCM are placed on the stack.
In this case, 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. Therefore, this value can be reduced in the shipping version of ROM that does 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 set automatically during linker.

Macro Switches set within the SDK Makefile

The below table is for configuring the build conditions for each directory in the NitroSDK Makefile. Specifies the source locations as well as Makefile to concatenate.

SUBDIRS
Important
Enumerates the directories you want the make process to concatenate.
Initial value: None
SUBMAKES Enumerates the Makefiles you want the make process to concatenate. Initial value: None
SRCS
Important
Enumerates the source file you want to compile and assemble.
make tries to generate an object file by the compiler or assembler of the programming language shown in the following table according to the extension of each file.
Extension Programming Language
.c C
.cpp C++
.s Assembler
SRCS_OVERLAY
For Overlay
Enumerates the source file you want to compile or assemble. The object files generated from the files specified here are registered as belonging to an OVERLAY group.
SRCDIR Specifies the source file's directory.
Initial value: ./src
This initial value indicates the directory specified by the relative path src from the directory from which make was executed.
INCDIR
Specifies the directory if there are private include files (module-specific include files). If there is no need for this, it does not need to be used.
Initial value: ./include
OBJDIR
BINDIR
LIBDIR
Rewrite prohibited
This is the directory to which temporary files are output by make.
Since this directory may change to accommodate the source tree, avoid overwriting 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 Specify the configuration file to be used as the base when you want to automatically generate a link command file with the makelcf command. Initial value: Not Defined
ROM_SPEC Specifies the file that describes the contents of the ROM file. This file is passed to the makerom command and becomes a hint for ROM generation.
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 resulting object files, making them the target files. A.nef file will be created automatically.if a .srl file is specified as the target.
TARGET_LIB Specify this if you want to create a library file.
It compiles or assembles the source files specified by SRCS, and links the resulting object files, making them a library. Normally, TARGET_BIN and TARGET_LIB are not configured at the same time.
TARGET_OBJ Specify this if you want to create an object file as a target.
This is not normally used. In the library, this is used when crt0.c is compiled and installed as a library.
NITRO_PROC
Important for ARM7
This is a switch that switches between generating code for the Main Processor and the Sub Processor. This is often specified in the Makefile.
ARM9 Code for the Main Processor
ARM7 Code for the Sub Processor
Initial value: ARM9 (Code for the Main Processor)
TARGETS
Rewrite prohibited
Targets to which the relative path was added to TARGET_BIN and TARGET_LIB are set up automatically. The storage directories for .srl and .a files changes depending on the NITRO_PLATFORM and NITRO_DEBUG/NITRO_RELEASE/NITRO_FINALROM setting. This macro was prepared to absorb this change.
INSTALL_TARGETS Enumerates the files you want to install. The TARGETS described above will function in this setting. Initial value: None
INSTALL_DIR Configures the file install destination. Initial value: None
LINCLUDES Specifies the directory if there are other include files.
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
Specifies the file you want to delete along with object files and such when executing make clean or make clobber command. With make clean, all files specified with LDIRT_CLEAN are deleted. With make clobber, all files specified with LDIRT_CLEAN and those specified with LDIRT_CLOBBER are deleted.