PS2 Retail DeBugging Startup Card

Discussion in 'Homebrew' started by sp193, Jun 10, 2017.

  1. 125
    215
    53
    sp193

    sp193 Developer

    Joined:
    Oct 13, 2014
    Messages:
    125
    Likes Received:
    215
    Trophy Points:
    53
    Location:
    Singapore
    Home Page:
    What is the Retail DeBugging (RDB) startup card?
    It is a clone of the Sony TDB startup card, which gives certain TEST/debugstation consoles (which support Magicgate) some DECI2 debugging functionality.

    Traditionally, development and debugging of games and software was entirely done on PlayStation 2 TOOL consoles,
    which are basically each a PlayStation 2 console and PC in one unit.
    Both entities are linked together through something known as the "PIF":
    [​IMG]

    Retail consoles are essentially similar to debugstation consoles,
    except that their CD/DVD drive MECHAnics CONtroller (MECHACON) chips don't accept master discs, but support MagicGate and DVD video discs fully.

    Since these consoles lack the TOOL unit's PIF, Sony substitutes it with a virtual interface that is known as the "TIF", which sends data over the network:
    [​IMG]

    Unfortunately, like the debugstation, the retail set has a boot ROM that contains an IOPBTCONF file
    (a list of modules to be loaded during every IOP reboot) that doesn't list the DECI2 modules.
    As a result, it is not possible to reboot the IOP normally without cutting off DECI2 support.

    On a real TOOL unit, the IOP is usually not reboot during development, so being unable to reboot the IOP during development is not much of a loss.

    What is DSNET?DSNET is a collection of development tools that run on the development PC. Some of the probably more important tools would be:
    • DSNETM: DSNET Manager (all tools connect to this, which will connect to the PlayStation 2)
    • DSEDB: EE debugger
    • DSIDB: IOP debugger
    • DSICONS: IOP console monitor
    • DSECONS: EE console monitor

    Variations of RDB
    Currently, there are two variants of RDB:
    • RDB - the "vanilla" version of RDB. This works similarly to the TDB Startup Card.
    • RDB-UIF - a variation of RDB that has the network protocol stack and SMAP driver integrated into the host interface driver.
    The host interface driver was renamed to become the "Universal InterFace" (UIF). While it is still dependent on the customizations to the IOP DECI2 manager, it allows DSIDB to be used because the networking functionality can run from the interrupt context.​

    Limitations, which the TDB startup card also has:
    1. The IOP cannot be rebooted at all, so functions like SifIopReboot() and SifIopReset() must not be used.
    2. LoadExecPS2() cannot be used, as it causes an IOP reset.
    3. The Ethernet port cannot be used, as it is used by RDB itself. However, it is still possible to use the HDD unit. DEV9.IRX will be automatically loaded by RDB.
    4. IOP-side debugging cannot be performed due to limitations in RDB's design. dsidb can still be run, but the IOP will cease to respond if a BREAK is issued *.
    5. As DEV9.IRX is loaded, an expansion bay unit cannot be reset by pressing the RESET button once. If the button is held down, the console will be switched off.
    6. When the IOP is heavily loaded, dsedb may not respond well.
    7. There is no support for IKTTY (i.e. Kprintf) *.
    *Does not apply to RDB-UIF.

    There will be no support for IKTTY within RDB because it would not make sense; like with the TDB startup card, RDB's IOP DECI2 manager has additional code for interfacing with network modules that run from threads. However, this results in context switches between the thread, interrupt and DECI2 contexts.
    Kprintf is meant to send out characters directly from within an interrupt context, so this custom design of TDB/RDB would nullify the purpose of Kprintf - it would be like using printf.

    If IKTTY is required, please use RDB-UIF instead, since RDB-UIF includes the IKTTY driver.

    Limitations, which are unique to RDB:
    • If the stock EE kernel is used, thread information cannot be retrieved because these kernels don't support the "EE thread extension". See "Other features" to learn about replacing the EE kernel.
    • If the stock EE kernel is used, the DECI2 reset command cannot be used because of missing functionality. To reset RDB, perform a hard reset.
    Differences in functionality from the TDB startup card:
    • IOP-side TTY output works. Homebrew software redirect EE-side printf() output to the IOP, so printf() from the EE will be sent to dsicons.
    Other features:

    1. EE kernel replacement: By default, RDB uses your retail console's stock EE kernel. However, this kernel lacks the "EE thread extension", which renders it unable to show information related to threading (e.g. thread and semaphore status).
      By placing a replacment EE kernel (e.g. the one from the TDB startup card or a TOOL) as KERNEL.bin in the same location as RDB, RDB will use the substitute EE kernel instead.
    2. IOP kernel module replacement: By default, RDB uses your retail console's stock IOP kernel modules. By placing a replacment IOP kernel module image as IOPRP.img in the same location as RDB, RDB will use the substitute IOP kernel modules instead.
    3. Network configuration: RDB retrieves your network configuration from mc:/SYS-CONF/IPCONFIG.DAT, which has this format:
    IP address
    Subnet mask
    Gateway
    <optional: link speed and duplex mode: 10HDX, 10FDX, 100HDX,100FDX or AUTO. AUTO is the default if nothing is specified>
    Supported boot device:
    • Memory Card only
    Note: while RDB will still boot from unsupported devices (i.e. USB disks), it will not be able to load replacement EE/IOP kernels.

    How to use RDB:
    1. Prepare your network configuration file (IPCONFIG.DAT).
    2. Copy RDB to the desired place on your memory card.
    3. Download the DSNET tools, including DSNETM.
    4. Connect your PS2 to your network/to your PC.
    5. Start DSNETM, specifying your PS2's IP address.
    6. Run other DECI2 tools. If DSEDB/DSIDB are run, remember to specify the "no reset" option (-nr).
    Credits:
    SilverBull, for the DECI2 modules, DSNET programs and for sharing his knowledge.

    Downloads/Links
    RDB v0.9.5: http://www.mediafire.com/file/79fy03rwwbh3ycd/[170610]RDB-095-bin.7z
    RDB v0.9.5 (source code): https://www.mediafire.com/?vsgw3g91d7mk90z
    DSNET tool set (2014/03/28): http://www.mediafire.com/file/oio3fbf81osi526/[140328]dsnet-bin.7z
     
    Last edited: Jun 29, 2017
  2. 125
    215
    53
    sp193

    sp193 Developer

    Joined:
    Oct 13, 2014
    Messages:
    125
    Likes Received:
    215
    Trophy Points:
    53
    Location:
    Singapore
    Home Page:
    Unlike the TDB startup card, ITTY is usable with RDB. While making it work:
    DECI2LOAD was also changed during its lifetime. The DECI2LOAD module within RDB is a custom version with code that automatically adapts to the version of MODLOAD used:
    DECI2 Modules and load order (as listed in IOPBTCONF and loaded by the startup card):
    IDNameModule Description (within module)
    1DECI2Deci2_Manager
    2DECI2DRPDeci2_PIF_interface_driver
    3DECI2HSYN Deci2_host_sync
    4DECI2DRSDeci2_SIF2_interface_driver
    5DECI2FILEDeci2_TTY/FILE_driver
    6DECI2KPRTDeci2_Kprintf_driver
    7DECI2LOADDeci2_Load_Manager
    8DRVTIFDeci2_TIF_interface_driver
    9TIFINETTIF_bridge_for_INET
    Notes:
    1. DRVTIF and TIFINET are used on debugstation consoles, in place of DECI2DRP.
    2. DECI2KPRT is not used on debugstation consoles.
    3. DECI2DRP is only available on TOOL units because only TOOLs have the PIF.
    4. The TDB startup card has a newer DECI2 module that has additional functions for managing the TIF.
    5. The TDB startup card has a slight different DECI2DRS module that doesn't wait for ongoing transfers to end and doesn't notify the EE of the shutdown.
    Additional functions in the newer DECI2 manager, as found in the TDB startup card.
    #25 sceDeci2SetTifHandlers
    #26 sceDeci2GetTifHandlers
    #27 (Notifies the DECI2 manager of completed transmission and receiving activities)
    #28 (Notifies the DECI2 manager of TIF activity)
    #29-32 Does nothing.

    Differences between the CEX (DEX included) and the TDB Startup Card's kernel:
    1. The initialization code that is run at the entry point (0x80001000) initializes the OSD parameters with values that are stored in the scratch pad by the TDB Startup Card program.
    2. Like with the TOOL's kernel, there are breakpoints after initialization and within the exit syscall, which halt the EE kernel.
    3. To keep the TDB Startup Card messages visible on the screen, the initialize function (executed at the first boot of the kernel) does not invoke SetGsCrt and its GS initialization code does not reset the GS.
    4. Supports the full set of DECI2 commands (including EE thread extension and GS/VU Debugging functionality).
    5. Unlike all other kernels, it supports a special DCMP packet that triggers a reboot process of the EE, which runs in tandem with the reboot process that is triggered by TIFINET on the IOP. During the reboot process, the stock kernels are copied from ROM.
     
    Last edited: Jun 10, 2017
    nCadeRegal, Rommy667, Berion and 3 others like this.
  3. 125
    215
    53
    sp193

    sp193 Developer

    Joined:
    Oct 13, 2014
    Messages:
    125
    Likes Received:
    215
    Trophy Points:
    53
    Location:
    Singapore
    Home Page:
    I have uploaded the source code, but only for the things that I wrote.
     
    bguerville and nCadeRegal like this.
Tags:

Share This Page