# oh-my-renesas

OpenCode plugin for Renesas MCU development with 4 specialized AI agents and 17 tools.

## Features

- **renesas-fsp-expert** — FSP expert for RA MCU development (drivers, interrupts, clocks, build, flash)
- **renesas-librarian** — Product information specialist (MCU family search and comparison)
- **renesas-community** — Community knowledge agent (accesses community.renesas.com via Playwright)
- **renesas-freertos-expert** — FreeRTOS expert for RA MCU development (task design, config, debugging, TCP/FAT)
- **17 tools** — 9 FSP tools + 2 hardware tools + 2 product tools + 3 FreeRTOS tools

## Installation

### Quick Install (Recommended)

```bash
bunx oh-my-renesas
# or
npx oh-my-renesas
```

### Manual Install

Add to `~/.config/opencode/opencode.json` or `~/.config/opencode/opencode.jsonc`:
```json
{
  "plugin": ["oh-my-renesas"]
}
```

### Uninstall

```bash
bunx oh-my-renesas --uninstall
```

## Configuration (Optional)

Create `~/.config/opencode/oh-my-renesas.json`:
```json
{
  "agents": {
    "renesas-fsp-expert": { "model": "anthropic/claude-opus-4-5" },
    "renesas-freertos-expert": { "model": "anthropic/claude-sonnet-4-20250514" }
  },
  "fsp": {
    "fsp_pack_path": "/path/to/fsp",
    "jlink_path": "/path/to/JLink",
    "e2studio_cli": "/path/to/e2studio"
  }
}
```

## Tools

### FSP Tools
- `RenesasGetDriverForPeripheral` — Find correct FSP driver for MCU family + peripheral
- `RenesasGetApiUsage` — Get open/configure/use/close code example for a driver
- `RenesasCompareMcuFamilies` — Side-by-side MCU family comparison
- `RenesasGetInterruptConfig` — IRQ setup checklist for driver + family
- `RenesasDiagnoseError` — Root cause analysis for FSP error codes
- `RenesasGetClockConfig` — Clock setup recipe for MCU family + goal
- `RenesasSearchFspDocs` — Full-text search across FSP documentation
- `RenesasGetFspModules` — List FSP modules for a family
- `RenesasGetFspErrors` — All known FSP error codes

### Hardware Tools
- `RenesasRaBuildProject` — Build RA project via e2studio CLI or CMake
- `RenesasRaFlashFirmware` — Flash firmware via J-Link
- `RenesasRaReadRegister` — Read MCU register/memory via J-Link

### Product Tools
- `searchRenesasProducts` — Search Renesas MCU families by keyword/core/application
- `getProductFamily` — Get detailed info about a specific MCU family

### FreeRTOS Tools
- `RenesasGetFreertosConfig` — FreeRTOSConfig.h setup recipe for MCU family + goal (basic-multitasking, tcp-networking, fat-filesystem)
- `RenesasDiagnoseFreertosIssue` — Root cause analysis and fixes for FreeRTOS issues (stack overflow, deadlock, priority inversion)
- `RenesasGetFreertosApiUsage` — FreeRTOS API code examples (task-creation, queue, mutex, semaphore, timer, event-group)

## Requirements

- OpenCode with plugin support
- Playwright MCP (for renesas-community agent)
- J-Link (optional, for hardware tools)
- e2studio CLI (optional, for build tool)
- Renesas FSP pack (optional, for RenesasSearchFspDocs)

## Migration

See [MIGRATION.md](./MIGRATION.md) if upgrading from fsp-mcp.
