Skip to main content

kst

STM32CubeIDE プロジェクトを VS Code などの外部エディタでビルド・書き込みするための CLI ツールです。

.ioc ファイルと CubeIDE の内蔵ツールチェーンだけに依存するため、CubeIDE ユーザーのワークフローを一切変えずに、エディタを選ばない開発環境を実現します。

前提条件

  • Windows
  • STM32CubeIDE がインストール済み(C:\ST\STM32CubeIDE_*
  • Python 3.11 以上

インストール

1. パッケージをインストールする

pip install --user kikaiken-kst

2. Scripts ディレクトリを PATH に追加する

pip install --userkst.exe を以下のディレクトリに配置します。

C:\Users\<ユーザー名>\AppData\Roaming\Python\Python3xx\Scripts

このディレクトリが PATH に含まれていない場合、以下の手順で追加してください。

PowerShell で自動追加(一度だけ実行):

$scriptsPath = "$env:APPDATA\Python\$(python -c 'import sys; print(f\"Python{sys.version_info.major}{sys.version_info.minor}\")')\Scripts"
[Environment]::SetEnvironmentVariable("PATH", "$([Environment]::GetEnvironmentVariable('PATH','User'));$scriptsPath", "User")

設定後、ターミナルを再起動すると kst コマンドが使えるようになります。

アップデート

pip install --user --upgrade kikaiken-kst

使い方

1. 初期化(初回・CubeMX 再生成後)

kst init <プロジェクトディレクトリ>
  • .clangd を生成(VS Code + clangd の IntelliSense 設定)
  • compile_commands.json を生成(clangd が IntelliSense に使用)
  • kst.toml を生成(ビルド設定ファイル)
  • .gitignore に kst の生成物を追加

2. ビルド

kst build <プロジェクトディレクトリ>
  • .ioc を解析して MCU フラグを取得
  • プロジェクトを走査してソース・インクルードを収集
  • Makefile.kstcompile_commands.json を生成
  • CubeIDE 内蔵の gcc / make でビルド

3. 書き込み

kst flash <プロジェクトディレクトリ>

ビルドを行ってから、CubeIDE 内蔵の STM32CubeProgrammer を使って ST-LINK 経由で書き込みます。
接続モードは CubeIDE のデフォルト(Under Reset + Hardware Reset)に合わせています。

ビルド済みの ELF をそのまま書き込む場合は --no-build を指定します。

kst flash --no-build <プロジェクトディレクトリ>

4. クリーン

kst clean <プロジェクトディレクトリ>

kst_build/ ディレクトリを削除します。


プロジェクトディレクトリの指定を省略するとカレントディレクトリが使われます。

cd path/to/project
kst build

kst.toml

kst init で生成されるプロジェクト設定ファイルです。git で管理してチームで共有します。

[build]
# printf / scanf での浮動小数点数の出力・入力を有効にする
# newlib-nano のデフォルトでは無効のため約 +20 KB 増加する
float_io = true

[scan]
# コンパイル対象から除外するファイル(プロジェクトルートからの相対パス)
# 同じディレクトリに排他的な実装が複数ある場合に使用する
exclude_files = []

仕組み

役割 CubeIDE kst
MCU フラグ取得 .cproject .ioc を解析
ソース収集 GUI で手動登録 フォルダをスキャンして自動収集
ビルド CDT make 同じ CubeIDE 内蔵 gcc / make
書き込み ST-LINK GDB Server 同じ CubeIDE 内蔵 STM32CubeProgrammer
IntelliSense CDT Indexer clangd + compile_commands.json

git 管理について

ファイル git 管理 説明
kst.toml ✅ する プロジェクト共通のビルド設定
kst_build/ ❌ しない ビルド成果物
Makefile.kst ❌ しない kst build で毎回生成
.clangd ❌ しない 環境依存(CubeIDE のインストールパスを含む)
compile_commands.json ❌ しない 環境依存

CubeIDE ユーザーへの影響

ありません。 .ioc の Toolchain/IDE 設定は STM32CubeIDE のままです。
CubeIDE ユーザーは従来通り CubeIDE でビルド・書き込みできます。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kikaiken_kst-0.10.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kikaiken_kst-0.10.0-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file kikaiken_kst-0.10.0.tar.gz.

File metadata

  • Download URL: kikaiken_kst-0.10.0.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for kikaiken_kst-0.10.0.tar.gz
Algorithm Hash digest
SHA256 50fc102518850d144d1b07327b4828b309ea61d04d841024d240328ef5863db5
MD5 8dbd702b6af075e3894aa652188c547f
BLAKE2b-256 c268a67181935ec390d65526fbba29bdd08b835a46b0593d86836b5398fecce3

See more details on using hashes here.

File details

Details for the file kikaiken_kst-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: kikaiken_kst-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for kikaiken_kst-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53982727ac1130f9838786f8133114415cfc57c5d1aaad9749ad63ecd12ac378
MD5 bbeb9f8a5201fdae1500c1ed90abaf2b
BLAKE2b-256 791c1f983a183324b9155f52516281f40a2d64f5c5e29fee1da784ba6b0581ca

See more details on using hashes here.

Release history Release notifications | RSS feed

0.11.0

2 files

This release

0.10.0 This release

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page