wiki:TBR/BSP/Nds

Nds

{{Infobox BSP | BSP_name = NDS, Nintendo DS | image = Nintendo_DS_logo.png?|250px| | Manufacturer = Foxconn | Board_URL = http://en.wikipedia.org/wiki/Nintendo_ds | Architecture = ARM | CPU_model = One 67.028 MHz ARM946E-S and one 33.514 MHz ARM7TDMI | Monitor = Two TFT LCD screens: 62 mm × 46 mm (2.4 in × 1.8 in), 77 mm (3.0 in) diagonal, 0.24 mm dot pitch, 18-bit depth (262,144 colors), 21 mm gap between screens | Simulator = DeSmuME, NO$GBA | Aliases = NDS | RAM = 4 MB RAM Cartridge save | NVMEM = 256 KB of serial flash memory | Serial = no serial port | Other = Wireless, handled by the WFC configuration | Video = Video Unspecified }}

This is start page of Nintendo DS BSP

Features in NDS BSP:

Basic console device

  • LCD, very small fonts but still readable.
  • output on the lower screen

Multiboot support in linkcmds

How to run Multi-boot programs

  • You can load the generated nds file with desmume
  • You can copy the nds file on a micro-sd card that is then started using a linker.

LibNDS

  • The BSP embedds an old version of libnds that is a library to handle low-level aspects of the hardware
  • Most of libnds functions can be used to manipulate the touchscreen, keys, wireless, etc.

How to use Framebuffer

There is an example of an RTEMS task that show grey scale on a periodic basis. This example relies on the libnds.

rtems_task Init(

rtems_task_argument ignored

) {

int i; int j; int k; uint16_t custom_color; k = 0;

while (1) {

k = (k + 1) % 200; custom_color= RGB15(k, k, k); for (i = 0 ; i < SCREEN_WIDTH ; i++) {

for (j = 0 ; j < SCREEN_HEIGHT ; j++) {

my_image[i][j] = custom_color;

}

} display_image (my_image); printf ("test %d\n", k); usleep (10);

}

}

How to use Keypad

With the libnds, you can proceed as follow :

uint32_t keys; while (1) {

scanKeys (); keys = keysHeld(); if (keys & KEY_A) {

printf ("A PRESSED\n");

} if (keys & KEY_B) {

printf ("B PRESSED\n");

}

How to use Touchscreen

With the libnds, you can use it as follow :

touchscreen_initialize (0, 0, NULL); touchPosition tp; tp = touchReadXY (); printf ("x=%u, y=%u, px=%u, py=%u, z1=%u, z2=%u\n", tp.x, tp.y, tp.px, tp.py, tp.z1, tp.z2);

See the touchscreen-related functions for more information about the relevant data structures.

More information

  • Desmume emulator : desmume
  • Many functions are implemented on top of third-party libraries available in the devkitpro tool-chain (devkitpro).

Test Reports

Binaries from the RTEMS examples and other examples that use libnds are available here : http://julien.gunnm.org/public/rtems/

4.10.99: User:Julien Delange? reports that as for the 26/08/2011, the current CVS works correctly.

4.10-cvs : User:Julien Delange? reports that the support works correctly.

4.10.0 : User:Julien Delange? reports that the support is broken (26/08/2011)

Last modified on Jan 27, 2013 at 6:11:30 AM Last modified on Jan 27, 2013, 6:11:30 AM