$REVOLUTION_SDK_ROOT/build/demos/cntdemo
The following introduces the procedures to develop NAND applications using the sample demos (located in /build/demos/cntdemo).
This development procedure uses the CNT API to easily convert disc applications to NAND applications.
(Read dvddata as DvdRoot if they are not the same.)
Create the source in the same way the disc application (ELF file) is normally created. In this case, place the file to be used in dvddata/content2/ and use CNT API to access the file. (See CNT API Function Reference or the sample program source for specific information on using the functions.) Since running make as usual (without setting any special options) creates a disc application, it can be executed with ndrun.
|
A NAND application (WAD file) is created by specifying NANDAPP=TRUE as a make option. If the application loads a file, as in the demo, specify a content file. (Here, the contents directory is specified with the CNT_IDX option.) Because cntdemo uses the two files test1.txt and test2.txt located under /dvddata/content2/, CNT_IDX is set to 2. (For details on make command options, see make Command Options.)
If make is run at this point, an application is created that corresponds to the cntdemo.o object file for disk applications, so execute make clean once and begin the build from the start.
|
This procedure causes the following processes to be performed, and in the end, a WAD file is created. Similar commands are described in the makewad target of Makefile (change DVDROOT_DIR as necessary according to your environment).
bin/RVL/cntdemoD.elf is created).% make NANDAPP=TRUE NOEXPORT=TRUENOEXPORT is defined.bin/RVL/cntdemoD.dol is created).% makedol -f bin/RVL/cntdemoD.elf -d bin/RVL/cntdemoD.dolbin/RVL/cntdemoD.dol.lz7 is created). The system is set so that LZ77 extended compression is specified for the compression format and the size is aligned to a 32-byte boundary by using the -A option.% ntcompress -lex -A32 -o bin/RVL/cntdemoD.dol.lz7 bin/RVL/cntdemoD.doldvddata/content2 directory (/dvddata/archives/content2.arc is created).% cd ../../../dvddata/content2; darch -c * ../archives/content2.arc
bin/RVL/cntdemoD.wad is created.)% makeWad -n cntdemoD -l bin/RVL/cntdemoD.dol.lz7,../../../dvddata/archives/content2.arc
Copy the WAD file to the dvddata/viewer directory (if DvdRoot is different and the viewer directory does not exist, please create it). Next, start Nmenu (Nmenu.elf).
|
Nmenu starts in Import Mode. In Import Mode, the WAD file in DvdRoot/viewer can be imported. Press A and import cntdemoD.wad. Next, press B to enter Title List Mode. Pressing the A button at this time causes the application to execute. (Click here for information on Nmenu.) The following log is output to the serial port.
|
The procedures up through Step 4 have resulted in the creation of an operational NAND application. Here, as an example, we show how to specify an initial code of RABA and a company code of ZZ for a WAD file. For more about configuring the other items, refer to makeWad.
makeWadmakeWad in Step 2. Since -gc specifies the initial code and -g is used for the company code, the command to be executed is as follows.
|
WAD_OPTION option of make during the buildmakeWad by specifying WAD_OPTION when building the application.
|
Using cntdemo as an example, the following will show an example method for making the settings for debugging a NAND application in CodeWarrior.
Start CodeWarrior from the shell.
|
From the Edit menu, select Default Wii Project Settings. Alternatively, press ALT+F7 or use the settings tab to open the default Wii project settings. Change the execution script to wadbuildrun.bat or wadbuildrun.bat as shown in the image, and remove $P. wadrun.bat will execute only; wadbuildrun.bat will perform a build before executing. For details, see appropriate sections in the manual.
Note that even if you press the Build button in CodeWarrior, the build that is performed will not be for NAND application use.
To debug a NAND application, press the Debug Execution button or the F5 key, which will start up the N menu; after a WAD file is imported, the NAND application will be started in debugger mode. Afterwards, debugging may be performed using a debugger in the same way as a normal disc application.
As discussed previously, wadbuildrun.bat should be specified when one wishes to perform a build before execution. Therefore, to perform a build and execute, specify wadbuildrun.bat in Step 2. This batch command will also call buildwad.bat from the same directory as Makefile; buildwad.bat is a batch command for building WAD files.
The settings for building a NAND application may be changed by editing this batch file. For example, a batch file that generates WAD files with a game code of RABA and a company code of ZZ would look like the following. For more information on options, see make command options and makeWad.
|
It is also mentioned in the demo program source, but the end of the archive file is not 32-byte aligned. Accordingly, a specified 32-byte aligned value is returned as the CNTRead return value for DVD applications, but a different value, the actual size that was read, is returned for NAND applications.
2009/01/15 Changed darchD to darch.
2008/03/14 Corrected links.
2008/01/08 Added a section about compression of programs. Standardized the use of "Nmenu."
2007/11/20 Standardized the use of the term "content file".
2007/09/12 Corrected a typo.
2007/08/06 Added descriptions of how to configure various settings.
2007/05/10 Added a description on methods for debugging in CodeWarrior.
2006/08/15 Initial version.
CONFIDENTIAL