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 --user は kst.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.kst と compile_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 でビルド・書き込みできます。

Metadata

Release files for kikaiken-kst 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kikaiken-kst 0.11.0
File Size Uploaded Provenance Actions
kikaiken_kst-0.11.0.tar.gz 27.0 kB Without provenance Details for kikaiken_kst-0.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kikaiken-kst 0.11.0
File Interpreter ABI Platform Actions
kikaiken_kst-0.11.0-py3-none-any.whl Python 3 none any Details for kikaiken_kst-0.11.0-py3-none-any.whl

Total release size: 59.2 kB

Release files / kikaiken_kst-0.11.0.tar.gz

Download URL kikaiken_kst-0.11.0.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9ae637bdd7e95b4d5df01c634e3fadf139729f511e62dadc73038e88018286ee
BLAKE2b-256 checksum
How to use checksums
d17b4e09d0b55b6f2a10cf497138b877de63d552adf72788607a538289bc33e1
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / kikaiken_kst-0.11.0-py3-none-any.whl

Download URL kikaiken_kst-0.11.0-py3-none-any.whl
Size 32.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b4377edd3f50c2ba853fd3eb2f9a6ae0a86e989f83f67b4ff3fd7116b1fd57d
BLAKE2b-256 checksum
How to use checksums
cea0c279d38b9208a5ac3c7a825039aa498da11c3fb9343e6ca4522e1ef7e132
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for kikaiken-kst 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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