Stm32 Debugのロゴ

Stm32 Debug

コミュニティ
XZhaoSudo
stm32-debug

Compiles, flashes, debugs, and monitors STM32 firmware. Invoke for build, flash, GDB, SWO logs, or real-time variable/register monitoring.

概要

公開者XZhaoSudo
リポジトリstm32debug-skill
スキル名stm32-debug
スター
61
フォーク
13
同梱ファイル
7
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 7個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    XZhaoSudoがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Stm32 Debug」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/XZhaoSudo/stm32debug-skill/tree/main
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/XZhaoSudo/stm32debug-skill.git \
  .claude/skills/stm32-debug
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでStm32 Debugを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にStm32 Debugを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Stm32 Debugは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

STM32 Debug Skill

This skill provides a comprehensive suite of tools for STM32 development, including compilation, flashing, debugging, SWO logging, and real-time monitoring of variables and registers.

Prerequisites

  • arm-none-eabi-gcc
  • openocd
  • gdb-multiarch
  • python3
  • SVD file (e.g., STM32F746.svd)

Commands

1. Unified CLI

Prefer the unified entrypoint:

bash
./scripts/stm32-debug <command> [options]

Recommended first step for a project:

bash
./scripts/stm32-debug start \
  --elf build/firmware.elf \
  --svd STM32F746.svd \
  --source-root Core \
  --build-cmd "cmake --build build/Release" \
  --flash-elf build/firmware.elf

2. Build And Flash

Build via your project build system:

bash
make

Flash firmware directly:

bash
./scripts/flash.sh <elf_file>

Or use one-step cycle mode:

bash
./scripts/stm32-debug cycle counter voltage --flash --wait 10

3. Read Variables, Registers, Fields, Addresses

The read command auto-detects the target kind and uses ELF or SVD accordingly.

bash
# Variable from ELF symbols
./scripts/stm32-debug read counter voltage --type uint

# Register using SVD
./scripts/stm32-debug read 'GPIOA->ODR' --type hex

# Dot notation avoids shell quoting issues
./scripts/stm32-debug read GPIOA.ODR GPIOA.MODER.MODER0 --type uint

# Direct address
./scripts/stm32-debug read 0x20000000 --type hex

Generate a GDB memory-read script for offline use:

bash
./scripts/stm32-debug generate-script counter voltage

Read history:

bash
./scripts/stm32-debug history counter --limit 10

Optional variable interpretation config:

bash
# .stm32-debug.yaml
variables:
  test_step:
    0: "Initializing"
    100: "Complete"

4. Breakpoints And Stepping

Logical breakpoints and watchpoints are stored in .stm32-debug/session.json and reapplied to each GDB invocation.

bash
# Breakpoint management
./scripts/stm32-debug break main.c:145
./scripts/stm32-debug break HAL_I2C_Mem_Read --condition "voltage_index==2"
./scripts/stm32-debug break --list
./scripts/stm32-debug break --delete 1

# Watchpoints
./scripts/stm32-debug watch voltage_index
./scripts/stm32-debug watch 0x20000028
./scripts/stm32-debug watch --list

# Run control
./scripts/stm32-debug restart
./scripts/stm32-debug continue
./scripts/stm32-debug step 3
./scripts/stm32-debug next 2
./scripts/stm32-debug finish

5. Inspect Program State

bash
./scripts/stm32-debug info
./scripts/stm32-debug backtrace
./scripts/stm32-debug backtrace 5
./scripts/stm32-debug locals
./scripts/stm32-debug registers
./scripts/stm32-debug registers r0 r1 pc sp
./scripts/stm32-debug frame 1
./scripts/stm32-debug interactive

6. Monitor SWO Output

Capture printf logs via SWO pin. If the MCU is configured to a non-default clock frequency (e.g., 216MHz), you must pass the CPU frequency in Hz:

bash
./scripts/monitor_swo.sh [cpu_frequency_hz]

Example (default 16MHz):

bash
./scripts/monitor_swo.sh

Example (216MHz):

bash
./scripts/monitor_swo.sh 216000000

Use a custom OpenOCD board config when needed:

bash
OPENOCD_CONFIG=board/stm32h7x.cfg ./scripts/monitor_swo.sh 400000000

Read the log:

bash
tail -f swo.log

7. Inspect Register Definitions

View register or field details (address, mask, fields, description) from SVD:

bash
./scripts/read_svd.py <svd_file> <peripheral> [register] [field]

Example:

bash
./scripts/read_svd.py STM32F746.svd RCC CR

# Inspect one field directly
./scripts/read_svd.py STM32F746.svd GPIOA MODER MODER0

8. Session Management

bash
./scripts/stm32-debug start --elf build/firmware.elf --svd STM32F746.svd
./scripts/stm32-debug status
./scripts/stm32-debug stop

9. SVD Sources

If your target SVD is missing, common sources are:

  • STM32Cube device packages from ST
  • ST official MCU download pages
  • CMSIS-SVD mirror: https://github.com/posborne/cmsis-svd/tree/master/data/STMicro

Troubleshooting

  • OpenOCD Init Failed: Ensure no other OpenOCD instance is running (pkill openocd).
  • Connection Refused: Ensure OpenOCD is running before using monitoring scripts.
  • Symbol Not Found: Ensure the variable is global (not static/local) and the ELF file is up-to-date.
  • GDB Error: Ensure gdb-multiarch is installed to resolve complex types like structs.
  • Shell Redirect Issue: Quote targets using ->, for example 'GPIOA->ODR', or prefer dot notation such as GPIOA.ODR.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Stm32 Debug」では何ができますか?

Compiles, flashes, debugs, and monitors STM32 firmware. Invoke for build, flash, GDB, SWO logs, or real-time variable/register monitoring.

TypingMindでStm32 Debugを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Stm32 Debugはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにStm32 Debugをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/XZhaoSudo/stm32debug-skill/tree/mainを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Stm32 Debugを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Stm32 Debugで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもStm32 Debugを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Stm32 Debug」は無料ですか?

XZhaoSudoがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇