twl.h | The definition file for the TWL-SDK standard library. |
---|---|
twl_win32.h | Contains the definitions that are needed when creating tools on a Windows PC, such as the variable types defined for the TWL-SDK. |
Include these header files in modules that use TWL-SDK.
nitro/sinit.h |
This header file enables use of the module initialization function NitroStaticInit . |
---|
Enables the use of the C language static initializer NitroStaticInit()
.
Place this header file in an include statement only in the module that defines NitroStaticInit()
. The static initializer of the overlay module starts when the overlay is linked. With this mechanism, you can prepare an entry for a pointer to a function so that the corresponding function gets registered in NitroStaticInit()
when the overlay module is linked.
twl/code32.h | All subsequent code is output as ARM instructions (32-bit code). |
---|---|
twl/code16.h | All subsequent code is output as THUMB instructions (16-bit code). |
twl/codereset.h | At compile time, all subsequent code is outputted as an instruction set, according to the specified options. |
The ARM9 and ARM7 CPUs of the TWL can use two kinds of instruction sets: ARM and THUMB instructions. You can switch between these two instruction sets using jump instructions. In C, switching between jump instructions is performed with function calls. Therefore, the instruction set is normally selected by a function.
Use code32.h
or code16.h
by combining with codereset.h
. With code32.h
and codereset.h
, enclose the function for the instruction set you want to fix with the ARM. With code16.h
and codereset.h
, enclose the function you want to fix with the THUMB. When you are using assembly, always enclose the function with code32.h
or code16.h
, depending on the instruction set.
#include <twl/code32.h> // This outputs the following arm_inst() using the ARM instruction set int arm_inst(int n)
{
// 32-bit code area return n * n; }
#include <twl/codereset.h> // The instruction set is restored (as per the compiler options)
twl/dtcm_begin.h twl/dtcm_end.h |
The code in between is output to the *.dtcm section. According to the SDK standard setting, the *.dtcm section is placed in ARM9 DTCM (data TCM). |
---|---|
twl/itcm_begin.h twl/itcm_end.h |
The code in between is output to the *.itcm section. According to the SDK standard setting, the *.itcm section is placed in ARM9 ITCM (instruction TCM). |
The TWL ARM9 processor has a scratchpad region in CPU (a high-speed buffer region that is fixed in the memory map) called TCM. The region can be accessed as fast as cache in the CPU; so by making better use of this region you can limit the slow-down in processing speed that might otherwise occur because of a cache miss.
When defining the functions you want to place in the TCM region, enclose them with twl/itcm_begin.h and twl/itcm_end.h as shown below. Function regions that are enclosed this way are transferred to the instruction TCM (ITCM) region at startup.
#include <twl/itcm_begin.h> // Place the following tcm_inst() in ITCM int tcm_inst(int n) { // 32-bit code area return n * n; } #include <twl/item_end.h> // Return the placement destination to normal
When you want to place a data block in the data TCM (DTCM) region, enclose it with twl/dtcm_begin.h and twl/dtcm_end.h, as shown below.
#include <twl/dtcm_begin.h> // Place the following tcm_data() in DTCM u32 tcm_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } #include <twl/dtcm_end.h> // Return the placement destination to normal
nitro/parent_begin.h |
The code in between gets output to the *.parent section. This is used during a clone boot operation. |
---|---|
twl/ltdmain_begin.h twl/ltdmain_end.h |
The code in between is output to the .ltdmain section. This is used with HYBRID applications. |
nitro/version_begin.h |
The code in between gets output to the *.version section. Do not use this section; it is reserved in the TWL-SDK library. |
twl/wram_begin.h twl/wram_end.h |
The code in between is output to the *.wram section. This is enabled only in the ARM7. |
There are also other special sections besides the TCM sections.
The *.parent
section is essential for clone boot--one form of DS Download Play.
The .ltdmain
section is used with HYBRID applications. This section is only loaded when an application runs on TWL, not when an application is run on a Nintendo DS.
The *.version
section and the *.wram
section are used in the TWL-SDK implementation internally, so there is no need to be aware of them when using the SDK.
twl/version.h | This library contains TWL-SDK version information. Defines the macro SDK_VERSION_NUMBER and the constant SDK_CURRENT_VERSION_NUMBER .
|
---|
This defines the TWL-SDK version information.
CONFIDENTIAL