Compiling for Naomi

From dreamcast.wiki
Revision as of 16:43, 4 February 2024 by Tchan (talk | contribs)
Jump to navigation Jump to search

KallistiOS is able to produce executables that can run on the Sega Naomi arcarde boards.

Prerequisites

  • if you want to use GLdc, you need recent GLdc code (you need commit bd17c995 of 03 feb 2024)
  • download (git clone) kos & kos-ports into separate folders, eg /kosnaomi & /kos-portsnaomi
  • adapt the following in /kosnaomi/environ.sh:
    KOS_SUBARCH="naomi"
    KOS_BASE  <- point to your naomi kos folder
    KOS_PORTS <- point to your naomi kos-ports folder
  • Build these /kosnaomi & /kos-portsnaomi
  • if you want to use raylib, you need recent raylib4Dreamcast code (you need commit TODO of 04 feb 2024)

Compilation to a .ELF

Example compilation for a raylib example:

  • Go to the folder that contains your example, eg:
    cd /opt/toolchains/dc/kos-portsnaomi/raylib4Dreamcast/samples/shapes/basic_shapes
  • source the environ.sh of your naomi folder:
    source /opt/toolchains/dc/kosnaomi/environ.sh
  • build the .elf for Naomi:
    make

Converting an .ELF to a .DAT to send to a Naomi DIMM

  • Convert your Naomi-built KOS .ELF to a .BIN file:
    /opt/toolchains/dc/sh-elf/sh-elf/bin/objcopy -R .stack -O binary raylib.elf raylib_nao.bin
  • convert your Naomi .BIN to a .DAT file:
    /opt/toolchains/dc/kosnaomi/utils/naomibintool/naomibintool build raylib_nao.dat -d DEVELOPERNAME -t GAMETITLE -b raylib_nao.bin

Send your .DAT file to a Naomi DIMM via ethernet

  • Assuming the IP address of the Naomi is 192.168.1.202:
    /opt/toolchains/dc/kosnaomi/utils/naominetboot/naominetboot -t 192.168.1.202 -x raylib_nao.dat -a

Send your file to a Naomi via a serial cable

If you don't have a DIMM board, or just want to use dc-tool-serial to upload a Naomi .elf via a serial cable, you need:

  • a custom bios containing dc-load-ser
  • recent KallistiOS code (you need commit d059b92 of 04 feb 2024)
  • upload the .ELF via your regulat dc-tool-ser command, eg:
    dc-tool-ser -b 1562500 -t /dev/ttyUSB0 -x raylib.elf