makerom

Description

makerom is a tool for creating NITRO application ROM images. It creates the ROM image based on the entries in the ROM Spec file.

How to Use

Start Command

(1) Normal Start

% makerom [-d] [-DNAME=VALUE...] [-MDEFINES_FILE] [-A] [-F] [-WWARNING_TYPE] SPECFILE [ROMFILE] [LISTFILE]

This links files and creates a ROM image file named ROMFILE in accordance with the description in the ROM Spec file (described below) specified by SPECFILE. The ROM structure information is output to the file specified by LISTFILE.

ROMFILE and LISTFILE can be omitted. If you omit them, the two files use the same name as that specified by SPECFILE but with the extension changed to .rom and .nlf, respectively. Also, the -D option can be used to define a variable and its values. The value of this variable can be referenced when writing the ROM Spec file.

The -M option lets you define a variable and its value just like the -D option. The text file that consists of the [NAME=VALUE] line is received as an argument. By using this option, the variables and their values that exceed the command line length restriction can be described in the definition.

When the -F option is specified, a ROM image file will be created even if the ROM file exceeds the size limitation value (refer to RomSize in the Property section).

Specifying the -A option determines whether or not the ROM size restriction value (refer to RomSize in the Property section) is exceeded when adding digital signature with the attachsign command. When the value has been exceeded, an error occurs. However when the above-mentioned -F option has been set, processing continues.

The -W option will output the warnings that are normally suppressed. -Wrom_speedtype_undefined will appear when RomSpeedType in the Property section is not explicitly defined and left in the SDK default setting. With -Wall, all warnings will be output.

The -d option is for outputting messages when debugging makerom. This is usually unnecessary.

(2) The -l option

% makerom [-d] [-DNAME=VALUE...] [-MDEFINES_FILE]-l SPECFILE [LISTFILE]

This operates the same as the Normal Start method (1) except that a ROM image is not output. The file specified by SPECFILE is read, and the ROM structure information is output to the file named LISTFILE.

LISTFILE can be omitted. If you omit it, the filename takes the same name as that specified by SPECFILE, but with the extension .nlf. The -D option can be used to define a variable and its values. The value of this variable can be referenced when writing the ROM Spec file.

(3) The -r option

% makerom [-d] [-F] [-A] -r LISTFILE [ROMFILE]

A ROM image is constructed from the ROM structure information specified by LISTFILE and output as a file with the name specified by ROMFILE.

ROMFILE can be omitted. If you omit it, the filename takes the same name as that specified by SPECFILE, but with the extension .rom.

The -F and -A options behave the same as described above in (1) Normal Start.

ROM Spec File Format

The contents of the NITRO ROM image can be managed using a simple file system. The ROM Spec file is a text file that describes the structure of this file system and is divided into four sections. ARM9, ARM7, and incidental information sections should be defined before the ROM image section. The format for the section definitions have a declaration for the start of the section definition that is followed by section-related parameters enclosed in curly brackets.

Section definition target Section definition format Example definition
ARM9
Executable binary
Arm9
{
[ARM9 parameter description part]
  ....
}
Arm9
{
Static        main.sbin
OverlayDefs   main_defs.sbin
OverlayTable  main_table.sbin
Nef           main.nef
}
ARM7
Executable binary
Arm7
{
[ARM7 parameter description part]
  ....
}
Arm7
{
Static        sub.sbin
OverlayDefs   sub_defs.sbin
OverlayTable  sub_table.sbin
Nef           sub.nef
}
Incidental
information
(Property)
Property
{
[Incidental information parameter description part]
  ....
}
Property
{
RomHeader  rom_header.sbin
}
ROM Image
RomSpec
{
[ROM image parameter description part]
  ....
}
RomSpec
{
Offset   0x00000000
Segment  All
File     data.bin
}

Section Parameters

Arm9 section (ARM9 execution file definitions section)

This configures settings related to the executable file on the ARM9 side.

Static [ARM9's Resident Module filename]
Specifies the filename of the Resident Module of the ARM9's execution file.
OverlayDefs [Name of the ARM9's Overlay Name file]
Specifies the ARM9's OverlayDefs filename.
OverlayTable [ARM9's OverlayTable filename]
Specifies the ARM9's OverlayTable filename. This file is not needed if overlays are not being used. If this is the case, the OverlayTable definition can be omitted.
Nef [Name of the ARM9's nef file (debug information file)]
Specifies the nef file where ARM9 debug information will be retained.
If debugging is executed, this Nef definition is not needed, and the description can be omitted.  Instead of Nef, you can use the alternative keyword Elf.

Arm7 section (ARM7 execution file definitions section)

This is for settings related to the execution file on the ARM7 side.

Static [ARM7's Resident Module filename]
OverlayDefs[Name of the ARM7's Overlay Name file]
OverlayTable [ARM7's OverlayTable filename]
Nef [Name of the ARM7's nef file (debug information file)]
Same as the ARM9's parameters.

Property section (Incidental Information definitions section)

Items with the symbol "◎" after the name are items that must be configured when creating the master ROM.

RomHeaderTemplate [Template file name of ROM header]
Specifies the template file in the header section of the Rom image. When this not specified, the default is rom_header.template.sbin, which is in the same directory as makerom.exe. For the file name, specify the name of the master ROM template file that our company distibutes for each game application when the master ROM is being created. We recommend that you do not perform binary correction on the contents of the ROM header template file.Set the incidental information in each master ROM by describing parameters such as TitleName in a ROM spec file.
TitleName [Title name]
Specifies the title name. Up to 12 characters of ASCII code. When it is shorter than 12 characters, 0 will be stored in the unused area. When this is not specified, the value that is embedded in RomHeaderTemplate is used.
MakerCode [Manufacturer code]
Specifies a manufacturer code that was determined when signing licensing agreement with our company. Two ASCII characters are used.
When this is not specified, the value that is embedded in RomHeaderTemplate is used.
RemasterVersion [Remaster version]
Specifies the remaster version number of the ROM being manufactured for retail products. Hexadecimal notation, decimal notation, and octal notation can be used. When this is not specified, the value that is embedded in RomHeaderTemplate is used. This is equivalent to the ROM versions used in earlier versions. In previous versions of the makerom tool, the definition for the term "ROM version" differed from our company's standard definition, so a change was made so the names match. For compatibility with previous ROM spec files, the keyword "RomVersion" can be used as a separate name.
RomSpeedType [1TROM|MROM|UNDEFINED]
Defines the ROM type and selects the proper access speed. "1TROM" specifies one-time PROM and "MROM" specifies mask ROM. Because the one-time PROM setting is slower, if one-time PROM is selected, it can also work with mask ROM. But it is not possible to operate the other way around.
If this parameter is not specified, it is treated as if "UNDEFINED" has been specified. "UNDEFINED" takes the same setting for access speed as "1TROM". However, when set to "UNDEFINED", a warning flag is set in the ROM registration data when the ROM binary is being created, so it cannot be submitted as the final master ROM. This is to done in order to prevent the human-induced mistake of shipping the master ROM with the access speed unintentionally set. When creating the final master ROM, be sure to check that you are using either "1TROM" or "MROM", and clearly specify this in the ROM spec file.
RomSize [ 64M | 128M | 256M | 512M | 1G | 2G ]
Specifies the ROM size in bits. Under the current circumstances, select from 64M/128M/256M/512M/1G/2G character strings. When the ROM image exceeds the specified value, an error or a warning (when the -F option is specified) is output. When this is not specified, the value that is embedded in RomHeaderTemplate (current one is "2G") is used.
RomFootPadding [TRUE|FALSE]
Specify TRUE if you want the unused region above the program storage area in ROM to be filled with data, and create the binary that matches the ROM size specified by RomSize. The data stored in the unused region is the value specified with the Padding parameter in the RomSpec section. To enable this feature, it is necessary to specify RomSize. If it is not specified, the values is FALSE.
RomHeader [file name of ROM header]
Name of the image file in the header section of the ROM image. This file is generated by embedding the information from ROM spec files to the copy of the template that is explained in the above section.
Normally it is not necessary to specify the name. When it is not specified, the file name is made by taking out the file extension from the file name of ARM9 resident module and then adding header.sbin.
FileName [FileNameTable file name]
Name of the image file in the file name table section of the ROM file system. This file is generated from the RomSpec item in the ROM spec file. Normally it is not necessary to specify the name. When it is not specified, the file name is made by taking out the file extension from the file name of ARM9 resident module and then adding files.sbin.
BannerFile [banner file name]
Specifies the banner file, that consists of the application identification image information that is displayed at the startup of NITRO.
ForChina [TRUE|FALSE]
Specifies whether this application is designed to run on the Chinese version of the DS system. If this property is set to TRUE, the application will run only on a Chinese version of the DS system. Also, in order to determine if the Chinese language was selected on a Chinese version of the DS system's settings menu, this property must be set to TRUE. If nothing is specified, the setting will be FALSE and the English language code is obtained. Note that the value embedded in RomHeaderTemplate is not used.

RomSpec section (ROM image definitions section)

This section needs to be defined after other sections.

Offset [offset value]
Specifies the offset value for the location of the ROM image file (or data). To prevent the overlap of ROM image regions, the offset value that can be set must be larger than the final position where all files (or data) are set at that time. If it is not, then an error will occur.
OffsetMin [offset value]
The same as Offset, except that an error will not occur even if the offset value is not larger than the final position where files are set. (Instead, the setting will be ignored.)
Segment All
Sets all data for file system management. This management data must precede other files and be placed at the start of ROM.
Padding [Character codes 0 - 255]
Specifies the value to assign for padding when aligning ROM images. Specify a value between 0 and 255. The initial value is 0.
Align [alignment value]
Matches the ROM image starting position of the next file or data-set to store to the specified memory boundary. Empty space is filled using the value specified by Padding. The alignment value must be an exponent of 2. Because the Align statement is only used to temporarily manipulate the memory boundary of the file, it affects the file placed immediately after this description. To specify a permanent memory boundary, use the AlignAll statement.
AlignAll [alignment value]
Matches the ROM image starting position of all subsequent files and data-sets being stored to the specified memory boundary. Empty space is filled using the value specified by Padding. If Align and AlignAll are both defined, the larger value is used for the alignment value. The initial value of AlignAll is 512.Note: Access to the NITRO Software NITRO CARD is limited to the units of 512-byte blocks when the boundary for the file allocation is set to less than 512.
Segment RomHeader
Segment Static Arm9
Segment OverlayTable Arm9
Segment Overlays Arm9
Segment Static Arm7
Segment OverlayTable Arm7
Segment Overlays Arm7
Segment FileName
Segment FileAlloc
Segment Banner
Sets the data used for file system management. Starting from the top:
  • ROM header
  • ARM9 Resident Module
  • ARM9 Overlay Table
  • ARM9 Overlay Module
  • ARM7 Resident Module
  • ARM7 Overlay Table
  • ARM7 Overlay Module
  • Filename Table
  • File Allocation Table
  • Banner File
  This is used only when you want total control over the position of each set of data. The ROM header precedes the other data and must be located at the start of the ROM image.
Normally, the use of Segment All is sufficient and there is no need to use these definitions to individually specify the locations of the file system management data. Segment All has the following definitions and equivalencies:
    Segment RomHeader
Align       512
Segment     Static          Arm9
OffsetMin   0x8000
Segment     OverlayTable    Arm9
Segment     Overlays        Arm9
Align       512
Segment     Static          Arm7
Segment     OverlayTable    Arm7
Segment     Overlays        Arm7
Segment     FileName
Segment     FileAlloc
Align       512
Segment     Banner
HostRoot [Root directory name of PC]
This is the standard directory on the PC for the files stored in the ROM image. HostRoot can be omitted, in which case the current directory (.) is used as the default value.
Root [Root directory name of NITRO]
This is the standard directory on NITRO for the files stored in the ROM image. The directory indicated by HostRoot on the PC gets mapped to the NITRO directory indicated by Root. Root can be omitted, in which case the root directory (/) is used as the default value.
File [filename ...]
Specifies files to store in the ROM image. If the specified filename is a directory, all files in all sub-directories get stored in the ROM image. However, any files or subdirectories that match the pattern specified by Reject will be excluded. You can use the symbols "*" and "?" as wildcards when specifying files.   *The symbol "*" represents any number of characters, while "?" represents a single character (single-byte).  
Reject [filename pattern ...]
These are the names of the files not to store in the ROM image. makerom internally requests a list of the files to expand and store in ROM. This list is built from the description of directories and files in File. Using the Reject definition you can specify certain files that you do not want placed on that list.


You can specify more than one filename pattern in the Reject statement by using blank spaces, and you can also employ the * and ? wildcards. The specifications made in Reject remain effective until the next Reject description. The initial values set as the Reject filename pattern are CVS or vssver.scc.
Fixed [Default | True | False]
This is for fixing nlf file parameters; it controls the flag that determines whether subsequently-placed data can be moved. There is normally no need for this. The initial value is Default (auto-configuration according to type of data installed).
TagType [Default | Name | Id | None ]
This is for fixing nlf file parameters; it specifies how to access subsequently-placed data (auto-configuration / filename/ file ID / no access method). There is normally no need for this. The initial value is Default (auto-configuration according to type of data installed).

Variable References and Modifier Options

You can reference the value of a variable that is defined outside of the ROM Spec file by describing the variable in the format: $([variable name]). The variable's value can be set with the command line option like this: -D[variable name]=[value]. Alternately, you can set the value using an environment variable. If the same variable is defined with both the -D option and an environment variable, the -D option value takes priority. Following is an example of a description for a variable reference:

RomSpec
{
Offset     0x00000000
Segment    All
File       $(FILENAME)
}

If the variable value takes the form of a file path, you can reference the value by attaching a modifier option immediately after the variable name. The following values can be referenced with the modifier options :h, :t, :r and :e

For $(FILE)=C:/home/Nitro/readme.txt:
:h The portion of the path before the final path delimiter $(FILE:h)=C:/home/Nitro/
:t The portion of the path after the final path delimiter $(FILE:t)=readme.txt
:r The portion of the path excluding the file extension $(FILE:r)=C:/home/Nitro/readme
:e The path file-extension portion $(FILE:e)=txt


Other formats

Keywords like RomSpec used in section definitions can be written either in uppercase (ROMSPEC) or in lowercase (romspec). Anything than follows the pound sign (#) is treated as a comment.

To specify multiple items in File and Reject, separate them with blank spaces. Use double quotes (" ") to specify filenames that include blank spaces.

#
# Lines that begin with # are comments
# Arm9 { Static "c:/Program Files/myApps/lib/main.sbin" OverlayDefs "c:/Program Files/myApps/lib/overlaydefs.sbin" } Property { RomSpeedType 1TROM BannerFile ./etc/default.bnr } ROMSPEC # Uppercase is also OK { Segment ALL File boo.dat foo.dat woo.dat }

Location

$NitroSDK/tools/bin/makerom.exe
$NitroSDK/tools/bin/rom_header.template.sbin

See Also

makelcf, makebanner

Revision History

04/26/2005 - Changed term from "1-time ROM" to "One-time PROM"
04/11/2005 - Added explanation relating to ForChina
04/05/2005 - Added explanation relating to "UNDEFINED" for RomSpeedType
03/28/2005 - Added explanations for RomSpeedType and the -W option
09/22/2004 - Added explanation about the order of appearance of sections
07/23/2004 - Added explanations regarding Align/AlignAll
06/08/2004 - Initial version