STM32 build tool for non-CubeIDE editors
Project description
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 でビルド・書き込みできます。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kikaiken_kst-0.5.0.tar.gz.
File metadata
- Download URL: kikaiken_kst-0.5.0.tar.gz
- Upload date:
- Size: 19.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6875c1a8fd32b98d934a3c08d3790032ceb5e5c56c1a742740e5199ede58bffd
|
|
| MD5 |
d5f50ddb2f5ecaa984467cf095361c07
|
|
| BLAKE2b-256 |
1cbf634a41262fad948ce723a6be8f9302a3c1f31e69366e4d7fbff81525b59f
|
File details
Details for the file kikaiken_kst-0.5.0-py3-none-any.whl.
File metadata
- Download URL: kikaiken_kst-0.5.0-py3-none-any.whl
- Upload date:
- Size: 21.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
113ccb4f4df2e3d6bf467352b47fa0136ee6e3e39fe6eefa7a04a7f04af06d30
|
|
| MD5 |
e021cfbac68915afba373a0cd0d1744e
|
|
| BLAKE2b-256 |
6f7ba6563e28be42e3b24874eafc784e1d80d96c7361d640ca37f2b79a17338b
|