Device development instructions
- A DLDI template is installed as part of DevkitARM r20. Get it using the [DevkitPro Updater].
- Install the NDS examples as part of DevkitARM.
- Copy the dldi directory from <path_to_devkitPro>/examples/nds/templates/.
- Rename the dldi folder to the four character code for the driver.
- Replace the functions inside source/iointerface.c with ones specific to the device.
- Open source/dldi_header.s for editting:
- Change the text "Name of driver goes here" to an appropriate description for the device.
- Change the text "XXXX" to the four character code for the driver.
- In the IO_INTERFACE data section, make sure that either FEATURE_SLOT_GBA or FEATURE_SLOT_NDS is specified, depending on which slot the device goes into.
- Compile by running make in the top level directory of the driver.
- If you get an error containing the text "overlaps previous sections", the driver is too big to fit in the available space. Since only 32KiB are allocated for DLDI patches, you will need to reduce the size of the driver. Try reducing the size of global arrays or let some card initialisation be done by the device firmware.
- Test it out by following the testing instructions on a Nintendo DS in DS mode or a Nintendo DS Lite in DS mode. As of May 2007, there is no way to test a DLDI driver in GBA mode.
- If it works you may like to add a page to this wiki for it. Contact a Wiki Sysop to gain file upload rights.
 DLDI coding advices
- Use as few resources as possible. You don't know which resources of the DS are used by the patched program.
- Don't use SWI calls. They might not be available.
- Don't use Interrupts or DMA. They might be used by the patched program.
- If you need to disable Interrupts, save the old state of the Interrupt Flag and restore it before returning to caller.
- Don't use big stack space. You don't know how much stack space is allocated by the calling program. DSLINUX allocates 2048 Bytes.