COS Shell Commands

Using COS Shell Commands

COS shell commands can be used with the Cafe SDK to perform various COS tasks. When using a terminal emulator, such as Tera Term, you can issue COS shell commands to perform actions such as:

Installing and Using Tera Term

Tera Term is an open-source terminal emulator that can be used with the Cafe SDK. The following steps describe how to install and configure Tera Term to be used with the Cafe SDK.

Installing the Tera Term software on your host PC

  1. Download Tera Term 4.82 (http://en.sourceforge.jp/projects/ttssh2/releases/) to a location on the host PC.
  2. Extract the content of the Tera Term 'zip' files to an empty folder on the host PC.

Using the Tera Term software with a Telnet Connection

  1. From the cafe_sdk folder, launch cafe.bat.
  2. Launch a Cafe SDK application.
  3. Navigate to the folder where the Tera Term files were previously extracted, and then double-click ttermpro.exe.
  4. In the Tera Term: New Connection window, specify the following connection configuration settings.
    (Connection) TCP/IP
    Host localhost
    TCP port# 6008
    Service Telnet
    Protocol UNSPEC
  5. Telnet Settings
  6. With the Cafe SDK based application already running, click OK in the Tera Term: New Connection window.
  7. At the Tera Term command prompt, use one of the COS shell commands as described in the COS Shell Commands section below.

Using the Tera Term software with a Serial Connection

  1. Use a USB-to-Serial adapter to connect the devkit (CAT-DEV or CAT-R) to the host PC. For more information on USB-to-Serial adapters, see Serial Logging on the Wii U.
  2. From the cafe_sdk folder, launch cafe.bat.
  3. Launch a Cafe SDK application.
  4. Navigate to the folder where the Tera Term files were previously extracted, and then double-click ttermpro.exe.
  5. In the Tera Term: New Connection window, select the Serial connection and select the serial adapter Port number.
  6. Serial Settings
  7. Click OK.
  8. In the main Tera Term console window, click the Setup menu-item and select Serial port.
  9. In the Tera Term: Serial port setup window, specify the following connection configuration settings.
    Port Your serial adapter port number
    Baud rate 57600
    Data 8-bit
    Parity none
    Stop 1 bit
    Flow control none
  10. Serial Settings
  11. With the Cafe SDK based application already running, click OK in the Tera Term: Serial port setup window.
  12. At the Tera Term command prompt, use one of the COS shell commands as described in the COS Shell Commands section below.

COS Shell Commands

Command Description
cos debug Dump all best-possible debugging information.
cos help List all commands.
cos coretrace Dump stacktraces and registers of all 3 cores from the kernel.
cos kpanic Force a kernel panic.
cos crashdump Force a crashdump.
cos threads List all threads and last-running threads on a per-core basis.
cos memdump addr [words] Display memory.
cos modules Display all loaded RPL modules.
cos ttrace List all threads and all thread stacks.
cos tcheck Check all running threads for validity.
cos ctxdump addr Dump one thread context.
cos ospanic Force an OS panic.
cos iostats [coreId] Display per-core I/O statistics.
cos intstats [coreId] Display per-core interrupt statistics.
cos osstats [coreId] Display per-core user-mode OS statistics.
cos kstats [coreId] Display per-core kernel statistics.
cos disasm addr [words] Display disassembly.
cos stacktrace addr Display the stacktrace from the stack at the specified address (e.g., gpr1).
cos logdump Display COS log dump.
cos logsave Save OS Event Log.
NOTE:
Using the cos logsave command has potential consequences for the current foreground application. The command, like all COS system calls, runs with interrupts off. Any subsequent delay can affect unprepared applications.
cos iodump [coreId] Display the most recent I/O commands.
cos bootperf Display boot performance information.
cos runonthread [r] Run the COS shell command on a thread (default 1).
cos launch hi lo Start the title with the specified 64-bit title-id.
cos launchex tid [args] Start the title with the specified 64-bit title-id and arguments.
cos heaps Display all heaps.
cos heapdump addr Display blocks for the heap at the specified address.
cos heapcheck addr Check the heap at the specified address for consistency.
cos setdabr addr [r] [w] Set DABR to the specified address, 8-byte aligned, on all cores, and the current process.
cos setiabr addr Set IABR to the specified address on all cores and the current process.
cos setword addr value Set the 32-bit word at the specified address to the specified value.
cos sdkversion Display the current SDK version.
cos cpuusage [c] [p] Display each Core's CPU usage (c=count, p=period (s)).
cos getsym addr Display the module and function name for the given address.
cos setfslog enable Start/stop logging the FS API (default enable=0).
cos fslogdump Display FS log dump.
cos kill Kill (abort/crash) the current master process.
cos killrestart Kill (abort/crash) and restart the current master process.
cos fault [cmd] Cause a fault in the user or kernel level. cmd options are:unull, upanic, uheartbeat, ufatalerror, knull, kpanic, kheartbeat or kfatalerror. Where u = user or k = kernel.

addr, size, words, coreId, hi, and lo may be hex or decimal 32-bit values.
[r], and [w] may be 0 or 1 only.

Example

In this example, the COS shell command cos ospanic is used to force the operating system to forcibly exit the cafeon application.

  1. From the cafe_sdk folder, launch cafe.bat.
  2. In the Cafe Cygwin shell, type cafeon.
  3. Navigate to the folder where the Tera Term files were previously extracted, and then double-click ttermpro.exe.
  4. With the cafeon application running, click OK in the Tera Term: New Connection window.
  5. With the Tera Term connection to the CAT-DEV established, at the Tera Term prompt, type the COS shell command cos ospanic.
  6. # # # # # # cos ospanic	
    
  7. The cafeon application exits and the Cafe Cygwin shell window displays the [+-*APPLICATION EXITED 0*-+] information as shown below.
  8. AppPanic 0x00060000
    OSPanic in "OSIopShell.c" at line 191 on thread = {SYS CDS Thread}.
    
    INFO: nn::ipc avoided busy close on /dev/acp_main (moduleId = 301, tag = 0) from
     pid = 21
    00:03:10:946: CBL Trace:
    [CBL] Saving crashdump to /vol/storage_hfiodisc01/save if available...
    
    00:03:10:952: CBL Trace: Creating OS memory block save file /vol/storage_hfiodis
    c01/save/osblocklog/mar21_093604/OSEventLog.bin.
    00:03:10:988: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [8%].
    00:03:11:026: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [16%].
    00:03:11:060: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [25%].
    00:03:11:094: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [33%].
    00:03:11:132: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [41%].
    00:03:11:167: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [50%].
    00:03:11:205: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [58%].
    00:03:11:239: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [66%].
    00:03:11:273: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [75%].
    00:03:11:311: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [83%].
    00:03:11:346: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [91%].
    00:03:11:384: CBL Trace: Saved /osblocklog/mar21_093604/OSEventLog.bin [100%].
    00:03:11:390: CBL Trace: In total, 1 OS memory blocks were saved.
    [+-*APPLICATION EXITED 0*-+]	
    

Revision History

2014/06/24 Reworked external link.
2014/06/19 Added cos fault command.
2014/05/09 Added note to cos logsave.
2014/03/21 Initial version.


CONFIDENTIAL