ti-project-assistant 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ dist/
5
+ build/
6
+ *.egg-info/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AndyYang12345
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,301 @@
1
+ Metadata-Version: 2.4
2
+ Name: ti-project-assistant
3
+ Version: 0.1.0
4
+ Summary: TI MSPM0 one-click project init tool — bootstrap embedded projects from SysConfig
5
+ Project-URL: Homepage, https://github.com/AndyYang12345/Ti-Project-Assistant
6
+ Project-URL: Repository, https://github.com/AndyYang12345/Ti-Project-Assistant.git
7
+ Author-email: Harekasa <2459743667@qq.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2026 AndyYang12345
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ License-File: LICENSE
30
+ Keywords: arm,cmake,embedded,mspm0,sysconfig,ti
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.8
37
+ Classifier: Programming Language :: Python :: 3.9
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Topic :: Software Development :: Build Tools
43
+ Classifier: Topic :: Software Development :: Embedded Systems
44
+ Requires-Python: >=3.8
45
+ Description-Content-Type: text/markdown
46
+
47
+ # TI Project Assistant(TI 项目助手)
48
+
49
+ [English version](README_EN.md)
50
+
51
+ [![Platform](https://img.shields.io/badge/平台-Linux%20%7C%20Windows-blue)](https://github.com/AndyYang12345/Ti-Project-Assistant)
52
+ [![Python](https://img.shields.io/badge/python-3.8%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/)
53
+ [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
54
+ [![MSPM0](https://img.shields.io/badge/芯片-MSPM0-red)](https://www.ti.com/microcontrollers-mcus-processors/arm-based-microcontrollers/mspm0/overview.html)
55
+ [![Version](https://img.shields.io/badge/版本-v0.1.0-informational)](https://github.com/AndyYang12345/Ti-Project-Assistant)
56
+
57
+ **一行命令**,从 [SysConfig](https://www.ti.com/tool/SYSCONFIG) 图形化配置出发,自动生成完整的 TI MSPM0 嵌入式项目。告别 CCS 手动配置。
58
+
59
+ ---
60
+
61
+ ## 安装
62
+
63
+ ```bash
64
+ pip install ti-project-assistant
65
+ ```
66
+
67
+ 安装完成后,`mspm0-init` 命令即可在终端中使用(Windows / Linux / macOS)。
68
+
69
+ ---
70
+
71
+ ## 快速开始
72
+
73
+ ```bash
74
+ # 1. 用 SysConfig GUI 配好芯片和引脚,保存 .syscfg 到空目录,然后:
75
+ mspm0-init
76
+
77
+ # 2. 构建
78
+ cmake --build build -j$(nproc)
79
+
80
+ # 3. 调试(VSCode)
81
+ code .
82
+ # 按 F5 → 选择 CMSIS-DAP 或 XDS110
83
+ ```
84
+
85
+ 修改配置后:
86
+
87
+ ```bash
88
+ mspm0-init regenerate # 仅更新生成文件,src/ 下手写代码安全无虞
89
+ ```
90
+
91
+ ---
92
+
93
+ ## 功能
94
+
95
+ | 子命令 | 用途 |
96
+ |--------|------|
97
+ | (无参数) | 自动发现当前目录 `.syscfg`,原地创建项目 |
98
+ | `new` | 从 `.syscfg` 创建新项目 |
99
+ | `regenerate` | 修改引脚/外设配置后重新生成代码,**不改动手写代码** |
100
+
101
+ 脚本自动完成:
102
+
103
+ - 调用 SysConfig CLI 生成 `ti_msp_dl_config.c/h`、链接脚本
104
+ - 解析芯片型号,自动映射 SDK 中的启动文件、driverlib 库
105
+ - 创建标准项目目录结构
106
+ - 生成 `CMakeLists.txt`(arm-none-eabi-gcc 工具链)
107
+ - 生成 `.vscode/` 三件套(`launch.json` / `tasks.json` / `c_cpp_properties.json`)
108
+ - 自动 cmake configure + build 验证
109
+
110
+ ---
111
+
112
+ ## 依赖安装
113
+
114
+ ### Linux
115
+
116
+ | 依赖 | 版本 | 安装方式 |
117
+ |------|------|----------|
118
+ | Python | ≥ 3.8 | 系统自带,或 `sudo apt install python3` |
119
+ | ARM GCC | 13.x | `sudo apt install gcc-arm-none-eabi` |
120
+ | CMake | ≥ 3.13 | `sudo apt install cmake` |
121
+ | Ninja | 任意 | `sudo apt install ninja-build` |
122
+ | TI MSPM0 SDK | 2.x | [下载](https://www.ti.com/tool/MSPM0-SDK) → 解压到 `~/ti/` |
123
+ | TI SysConfig | 1.x | [下载](https://www.ti.com/tool/SYSCONFIG) → 解压到 `~/ti/` |
124
+ | OpenOCD (TI 定制) | 1.3.x | 随 [CCS Theia](https://www.ti.com/tool/CCSTUDIO) 安装 |
125
+ | arm-none-eabi-gdb | 14.x | 随 OpenOCD 一起安装 |
126
+
127
+ 一行装完基础工具:
128
+
129
+ ```bash
130
+ sudo apt install python3 gcc-arm-none-eabi cmake ninja-build
131
+ ```
132
+
133
+ ### Windows
134
+
135
+ | 依赖 | 版本 | 安装方式 |
136
+ |------|------|----------|
137
+ | Python | ≥ 3.8 | [python.org](https://www.python.org/downloads/) 或 `winget install Python.Python.3.12` |
138
+ | ARM GCC | 13.x | [ARM 官网](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) → 把 `bin\` 加入 PATH |
139
+ | CMake | ≥ 3.13 | [cmake.org](https://cmake.org/download/) 或 `winget install Kitware.CMake` |
140
+ | Ninja | 任意 | [ninja-build.org](https://ninja-build.org/) 或 `winget install Ninja-build.Ninja` |
141
+ | TI MSPM0 SDK | 2.x | [下载](https://www.ti.com/tool/MSPM0-SDK) → 解压到 `C:\ti\` |
142
+ | TI SysConfig | 1.x | [下载](https://www.ti.com/tool/SYSCONFIG) → 解压到 `C:\ti\` |
143
+ | OpenOCD (TI 定制) | 1.3.x | 随 [CCS Theia](https://www.ti.com/tool/CCSTUDIO) 安装 |
144
+ | arm-none-eabi-gdb | 14.x | 随 OpenOCD 一起安装 |
145
+
146
+ ---
147
+
148
+ ## 环境变量
149
+
150
+ **全部可选**。不设置时脚本会自动搜索 TI 工具目录。
151
+
152
+ | 变量 | Linux 默认值 | Windows 默认值 | 说明 |
153
+ |------|-------------|---------------|------|
154
+ | `MSPM0_SDK` | `~/ti/mspm0_sdk_*` | `C:\ti\mspm0_sdk_*` | MSPM0 SDK 根目录 |
155
+ | `SYSCONFIG_DIR` | `~/ti/sysconfig_*` | `C:\ti\sysconfig_*` | SysConfig 安装目录 |
156
+ | `TI_ROOT` | `~/ti` | `C:\ti` | 所有 TI 工具的根目录 |
157
+ | `OPENOCD_DIR` | `~/.config/.../openocd/*` | `C:\ti\ccs_base\DebugServer\bin\openocd.exe` | OpenOCD 目录或可执行文件 |
158
+ | `GDB_DIR` | `~/.config/.../gdb/*` | `C:\ti\ccs_base\DebugServer\bin\arm-none-eabi-gdb.exe` | GDB 目录 |
159
+
160
+ ### 推荐配置
161
+
162
+ **Linux** — 加入 `~/.zshrc` 或 `~/.bashrc`:
163
+
164
+ ```bash
165
+ export MSPM0_SDK=~/ti/mspm0_sdk_2_10_00_04
166
+ export SYSCONFIG_DIR=~/ti/sysconfig_1.27.1
167
+ ```
168
+
169
+ **Windows** — 在系统环境变量或 PowerShell 中设置:
170
+
171
+ ```powershell
172
+ $env:MSPM0_SDK = "C:\ti\mspm0_sdk_2_10_00_04"
173
+ $env:SYSCONFIG_DIR = "C:\ti\sysconfig_1.27.1"
174
+ $env:TI_ROOT = "C:\ti"
175
+ ```
176
+
177
+ ---
178
+
179
+ ## 使用详解
180
+
181
+ ### 创建新项目
182
+
183
+ ```bash
184
+ # 最简单:在只有 .syscfg 的目录下直接运行
185
+ mspm0-init
186
+
187
+ # 自动发现当前目录的 .syscfg
188
+ mspm0-init new -n my_project
189
+
190
+ # 手动指定 syscfg 文件
191
+ mspm0-init new myboard.syscfg -n my_project -d xds110
192
+
193
+ # 无 syscfg,纯裸机起点
194
+ mspm0-init new --device MSPM0G3507 --package "LQFP-48(PT)" -n bare_start
195
+ ```
196
+
197
+ ### 重新生成配置
198
+
199
+ ```bash
200
+ mspm0-init regenerate # 在项目目录内执行
201
+ mspm0-init regenerate /path/to/proj # 指定项目路径
202
+ ```
203
+
204
+ `regenerate` 会备份旧文件到 `.sysconfig_backup/`,可通过 `--no-backup` 跳过。
205
+
206
+ ### 全部参数
207
+
208
+ ```
209
+ mspm0-init new [syscfg] -n NAME [选项]
210
+
211
+ -n, --name NAME 项目名称(必填)
212
+ -o, --output DIR 输出目录(默认 ./<name>/)
213
+ -s, --sdk PATH MSPM0 SDK 路径
214
+ --sysconfig PATH SysConfig 安装目录
215
+ -d, --debugger TYPE cmsis-dap(默认)| xds110 | none
216
+ --device DEVICE 手动指定芯片,如 MSPM0G3507
217
+ --package PACKAGE 手动指定封装,如 LQFP-48(PT)
218
+ --dry-run 预览模式,不创建文件
219
+ --no-build 跳过 cmake 构建验证
220
+
221
+ mspm0-init regenerate [项目目录] [选项]
222
+
223
+ --no-build 跳过重编译
224
+ --no-backup 不备份旧文件
225
+ --dry-run 预览模式
226
+ ```
227
+
228
+ ---
229
+
230
+ ## 生成的项目结构
231
+
232
+ ```
233
+ my_project/
234
+ ├── CMakeLists.txt # CMake 构建定义
235
+ ├── my_project.syscfg # 原始 SysConfig 配置
236
+ ├── ti_msp_dl_config.h # 自动生成 — 请勿手动编辑
237
+ ├── ti_msp_dl_config.c # 自动生成 — 请勿手动编辑
238
+ ├── device_linker.lds # 链接脚本
239
+ ├── inc/
240
+ │ ├── main.h
241
+ │ └── driver/ # 你的驱动头文件
242
+ ├── src/
243
+ │ ├── main.c # 应用入口
244
+ │ └── driver/ # 你的驱动实现
245
+ ├── lib/ # 本地静态库
246
+ ├── excluded/ # 不参与编译的 SysConfig 产物
247
+ ├── build/ # 构建输出(ELF / HEX / BIN / MAP)
248
+ └── .vscode/
249
+ ├── launch.json # 调试配置(CMSIS-DAP / XDS110)
250
+ ├── tasks.json # 构建任务
251
+ └── c_cpp_properties.json # IntelliSense 配置
252
+ ```
253
+
254
+ ---
255
+
256
+ ## 支持的芯片
257
+
258
+ [![MSPM0G3507](https://img.shields.io/badge/MSPM0G3507-128KB%20Flash%20%7C%2032KB%20SRAM-red)](https://www.ti.com/product/MSPM0G3507)
259
+ [![MSPM0G3505](https://img.shields.io/badge/MSPM0G3505-64KB%20Flash%20%7C%2016KB%20SRAM-red)](https://www.ti.com/product/MSPM0G3505)
260
+ [![MSPM0L1306](https://img.shields.io/badge/MSPM0L1306-64KB%20Flash%20%7C%208KB%20SRAM-red)](https://www.ti.com/product/MSPM0L1306)
261
+
262
+ 在脚本的 `CHIP_MAP` 字典中添加新条目即可支持更多芯片。
263
+
264
+ ---
265
+
266
+ ## 依赖关系
267
+
268
+ ```
269
+ mspm0-init
270
+ ├── SysConfig 1.x ────────────── 生成 ti_msp_dl_config.c/h、linker script
271
+ ├── MSPM0 SDK 2.x
272
+ │ ├── driverlib.a ──────────── 硬件抽象层
273
+ │ ├── startup_*.c ──────────── 中断向量表 + 启动代码
274
+ │ ├── CMSIS Core ───────────── Cortex-M0+ 寄存器定义
275
+ │ └── DeviceFamily.h ──────── 芯片系列宏
276
+ ├── arm-none-eabi-gcc 13.x ──── 交叉编译
277
+ ├── CMake + Ninja ───────────── 构建系统
278
+ ├── OpenOCD 1.3.x ───────────── GDB Server + 烧录
279
+ ├── arm-none-eabi-gdb 14.x ──── 源码级调试
280
+ └── VS Code + Cortex-Debug ──── IDE 集成
281
+ ```
282
+
283
+ ## 开发
284
+
285
+ ```bash
286
+ git clone git@github.com:AndyYang12345/Ti-Project-Assistant.git
287
+ cd ti-project-assistant
288
+
289
+ # 可编辑安装(推荐,修改即时生效)
290
+ pip install -e .
291
+
292
+ # 或手动安装到 PATH(Linux)
293
+ ln -s $(pwd)/mspm0-init ~/bin/mspm0-init
294
+
295
+ # 或手动安装到 PATH(Windows)
296
+ # 将 ti-project-assistant 目录加入系统 PATH
297
+ ```
298
+
299
+ ## 许可证
300
+
301
+ [MIT](LICENSE)
@@ -0,0 +1,255 @@
1
+ # TI Project Assistant(TI 项目助手)
2
+
3
+ [English version](README_EN.md)
4
+
5
+ [![Platform](https://img.shields.io/badge/平台-Linux%20%7C%20Windows-blue)](https://github.com/AndyYang12345/Ti-Project-Assistant)
6
+ [![Python](https://img.shields.io/badge/python-3.8%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/)
7
+ [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
8
+ [![MSPM0](https://img.shields.io/badge/芯片-MSPM0-red)](https://www.ti.com/microcontrollers-mcus-processors/arm-based-microcontrollers/mspm0/overview.html)
9
+ [![Version](https://img.shields.io/badge/版本-v0.1.0-informational)](https://github.com/AndyYang12345/Ti-Project-Assistant)
10
+
11
+ **一行命令**,从 [SysConfig](https://www.ti.com/tool/SYSCONFIG) 图形化配置出发,自动生成完整的 TI MSPM0 嵌入式项目。告别 CCS 手动配置。
12
+
13
+ ---
14
+
15
+ ## 安装
16
+
17
+ ```bash
18
+ pip install ti-project-assistant
19
+ ```
20
+
21
+ 安装完成后,`mspm0-init` 命令即可在终端中使用(Windows / Linux / macOS)。
22
+
23
+ ---
24
+
25
+ ## 快速开始
26
+
27
+ ```bash
28
+ # 1. 用 SysConfig GUI 配好芯片和引脚,保存 .syscfg 到空目录,然后:
29
+ mspm0-init
30
+
31
+ # 2. 构建
32
+ cmake --build build -j$(nproc)
33
+
34
+ # 3. 调试(VSCode)
35
+ code .
36
+ # 按 F5 → 选择 CMSIS-DAP 或 XDS110
37
+ ```
38
+
39
+ 修改配置后:
40
+
41
+ ```bash
42
+ mspm0-init regenerate # 仅更新生成文件,src/ 下手写代码安全无虞
43
+ ```
44
+
45
+ ---
46
+
47
+ ## 功能
48
+
49
+ | 子命令 | 用途 |
50
+ |--------|------|
51
+ | (无参数) | 自动发现当前目录 `.syscfg`,原地创建项目 |
52
+ | `new` | 从 `.syscfg` 创建新项目 |
53
+ | `regenerate` | 修改引脚/外设配置后重新生成代码,**不改动手写代码** |
54
+
55
+ 脚本自动完成:
56
+
57
+ - 调用 SysConfig CLI 生成 `ti_msp_dl_config.c/h`、链接脚本
58
+ - 解析芯片型号,自动映射 SDK 中的启动文件、driverlib 库
59
+ - 创建标准项目目录结构
60
+ - 生成 `CMakeLists.txt`(arm-none-eabi-gcc 工具链)
61
+ - 生成 `.vscode/` 三件套(`launch.json` / `tasks.json` / `c_cpp_properties.json`)
62
+ - 自动 cmake configure + build 验证
63
+
64
+ ---
65
+
66
+ ## 依赖安装
67
+
68
+ ### Linux
69
+
70
+ | 依赖 | 版本 | 安装方式 |
71
+ |------|------|----------|
72
+ | Python | ≥ 3.8 | 系统自带,或 `sudo apt install python3` |
73
+ | ARM GCC | 13.x | `sudo apt install gcc-arm-none-eabi` |
74
+ | CMake | ≥ 3.13 | `sudo apt install cmake` |
75
+ | Ninja | 任意 | `sudo apt install ninja-build` |
76
+ | TI MSPM0 SDK | 2.x | [下载](https://www.ti.com/tool/MSPM0-SDK) → 解压到 `~/ti/` |
77
+ | TI SysConfig | 1.x | [下载](https://www.ti.com/tool/SYSCONFIG) → 解压到 `~/ti/` |
78
+ | OpenOCD (TI 定制) | 1.3.x | 随 [CCS Theia](https://www.ti.com/tool/CCSTUDIO) 安装 |
79
+ | arm-none-eabi-gdb | 14.x | 随 OpenOCD 一起安装 |
80
+
81
+ 一行装完基础工具:
82
+
83
+ ```bash
84
+ sudo apt install python3 gcc-arm-none-eabi cmake ninja-build
85
+ ```
86
+
87
+ ### Windows
88
+
89
+ | 依赖 | 版本 | 安装方式 |
90
+ |------|------|----------|
91
+ | Python | ≥ 3.8 | [python.org](https://www.python.org/downloads/) 或 `winget install Python.Python.3.12` |
92
+ | ARM GCC | 13.x | [ARM 官网](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads) → 把 `bin\` 加入 PATH |
93
+ | CMake | ≥ 3.13 | [cmake.org](https://cmake.org/download/) 或 `winget install Kitware.CMake` |
94
+ | Ninja | 任意 | [ninja-build.org](https://ninja-build.org/) 或 `winget install Ninja-build.Ninja` |
95
+ | TI MSPM0 SDK | 2.x | [下载](https://www.ti.com/tool/MSPM0-SDK) → 解压到 `C:\ti\` |
96
+ | TI SysConfig | 1.x | [下载](https://www.ti.com/tool/SYSCONFIG) → 解压到 `C:\ti\` |
97
+ | OpenOCD (TI 定制) | 1.3.x | 随 [CCS Theia](https://www.ti.com/tool/CCSTUDIO) 安装 |
98
+ | arm-none-eabi-gdb | 14.x | 随 OpenOCD 一起安装 |
99
+
100
+ ---
101
+
102
+ ## 环境变量
103
+
104
+ **全部可选**。不设置时脚本会自动搜索 TI 工具目录。
105
+
106
+ | 变量 | Linux 默认值 | Windows 默认值 | 说明 |
107
+ |------|-------------|---------------|------|
108
+ | `MSPM0_SDK` | `~/ti/mspm0_sdk_*` | `C:\ti\mspm0_sdk_*` | MSPM0 SDK 根目录 |
109
+ | `SYSCONFIG_DIR` | `~/ti/sysconfig_*` | `C:\ti\sysconfig_*` | SysConfig 安装目录 |
110
+ | `TI_ROOT` | `~/ti` | `C:\ti` | 所有 TI 工具的根目录 |
111
+ | `OPENOCD_DIR` | `~/.config/.../openocd/*` | `C:\ti\ccs_base\DebugServer\bin\openocd.exe` | OpenOCD 目录或可执行文件 |
112
+ | `GDB_DIR` | `~/.config/.../gdb/*` | `C:\ti\ccs_base\DebugServer\bin\arm-none-eabi-gdb.exe` | GDB 目录 |
113
+
114
+ ### 推荐配置
115
+
116
+ **Linux** — 加入 `~/.zshrc` 或 `~/.bashrc`:
117
+
118
+ ```bash
119
+ export MSPM0_SDK=~/ti/mspm0_sdk_2_10_00_04
120
+ export SYSCONFIG_DIR=~/ti/sysconfig_1.27.1
121
+ ```
122
+
123
+ **Windows** — 在系统环境变量或 PowerShell 中设置:
124
+
125
+ ```powershell
126
+ $env:MSPM0_SDK = "C:\ti\mspm0_sdk_2_10_00_04"
127
+ $env:SYSCONFIG_DIR = "C:\ti\sysconfig_1.27.1"
128
+ $env:TI_ROOT = "C:\ti"
129
+ ```
130
+
131
+ ---
132
+
133
+ ## 使用详解
134
+
135
+ ### 创建新项目
136
+
137
+ ```bash
138
+ # 最简单:在只有 .syscfg 的目录下直接运行
139
+ mspm0-init
140
+
141
+ # 自动发现当前目录的 .syscfg
142
+ mspm0-init new -n my_project
143
+
144
+ # 手动指定 syscfg 文件
145
+ mspm0-init new myboard.syscfg -n my_project -d xds110
146
+
147
+ # 无 syscfg,纯裸机起点
148
+ mspm0-init new --device MSPM0G3507 --package "LQFP-48(PT)" -n bare_start
149
+ ```
150
+
151
+ ### 重新生成配置
152
+
153
+ ```bash
154
+ mspm0-init regenerate # 在项目目录内执行
155
+ mspm0-init regenerate /path/to/proj # 指定项目路径
156
+ ```
157
+
158
+ `regenerate` 会备份旧文件到 `.sysconfig_backup/`,可通过 `--no-backup` 跳过。
159
+
160
+ ### 全部参数
161
+
162
+ ```
163
+ mspm0-init new [syscfg] -n NAME [选项]
164
+
165
+ -n, --name NAME 项目名称(必填)
166
+ -o, --output DIR 输出目录(默认 ./<name>/)
167
+ -s, --sdk PATH MSPM0 SDK 路径
168
+ --sysconfig PATH SysConfig 安装目录
169
+ -d, --debugger TYPE cmsis-dap(默认)| xds110 | none
170
+ --device DEVICE 手动指定芯片,如 MSPM0G3507
171
+ --package PACKAGE 手动指定封装,如 LQFP-48(PT)
172
+ --dry-run 预览模式,不创建文件
173
+ --no-build 跳过 cmake 构建验证
174
+
175
+ mspm0-init regenerate [项目目录] [选项]
176
+
177
+ --no-build 跳过重编译
178
+ --no-backup 不备份旧文件
179
+ --dry-run 预览模式
180
+ ```
181
+
182
+ ---
183
+
184
+ ## 生成的项目结构
185
+
186
+ ```
187
+ my_project/
188
+ ├── CMakeLists.txt # CMake 构建定义
189
+ ├── my_project.syscfg # 原始 SysConfig 配置
190
+ ├── ti_msp_dl_config.h # 自动生成 — 请勿手动编辑
191
+ ├── ti_msp_dl_config.c # 自动生成 — 请勿手动编辑
192
+ ├── device_linker.lds # 链接脚本
193
+ ├── inc/
194
+ │ ├── main.h
195
+ │ └── driver/ # 你的驱动头文件
196
+ ├── src/
197
+ │ ├── main.c # 应用入口
198
+ │ └── driver/ # 你的驱动实现
199
+ ├── lib/ # 本地静态库
200
+ ├── excluded/ # 不参与编译的 SysConfig 产物
201
+ ├── build/ # 构建输出(ELF / HEX / BIN / MAP)
202
+ └── .vscode/
203
+ ├── launch.json # 调试配置(CMSIS-DAP / XDS110)
204
+ ├── tasks.json # 构建任务
205
+ └── c_cpp_properties.json # IntelliSense 配置
206
+ ```
207
+
208
+ ---
209
+
210
+ ## 支持的芯片
211
+
212
+ [![MSPM0G3507](https://img.shields.io/badge/MSPM0G3507-128KB%20Flash%20%7C%2032KB%20SRAM-red)](https://www.ti.com/product/MSPM0G3507)
213
+ [![MSPM0G3505](https://img.shields.io/badge/MSPM0G3505-64KB%20Flash%20%7C%2016KB%20SRAM-red)](https://www.ti.com/product/MSPM0G3505)
214
+ [![MSPM0L1306](https://img.shields.io/badge/MSPM0L1306-64KB%20Flash%20%7C%208KB%20SRAM-red)](https://www.ti.com/product/MSPM0L1306)
215
+
216
+ 在脚本的 `CHIP_MAP` 字典中添加新条目即可支持更多芯片。
217
+
218
+ ---
219
+
220
+ ## 依赖关系
221
+
222
+ ```
223
+ mspm0-init
224
+ ├── SysConfig 1.x ────────────── 生成 ti_msp_dl_config.c/h、linker script
225
+ ├── MSPM0 SDK 2.x
226
+ │ ├── driverlib.a ──────────── 硬件抽象层
227
+ │ ├── startup_*.c ──────────── 中断向量表 + 启动代码
228
+ │ ├── CMSIS Core ───────────── Cortex-M0+ 寄存器定义
229
+ │ └── DeviceFamily.h ──────── 芯片系列宏
230
+ ├── arm-none-eabi-gcc 13.x ──── 交叉编译
231
+ ├── CMake + Ninja ───────────── 构建系统
232
+ ├── OpenOCD 1.3.x ───────────── GDB Server + 烧录
233
+ ├── arm-none-eabi-gdb 14.x ──── 源码级调试
234
+ └── VS Code + Cortex-Debug ──── IDE 集成
235
+ ```
236
+
237
+ ## 开发
238
+
239
+ ```bash
240
+ git clone git@github.com:AndyYang12345/Ti-Project-Assistant.git
241
+ cd ti-project-assistant
242
+
243
+ # 可编辑安装(推荐,修改即时生效)
244
+ pip install -e .
245
+
246
+ # 或手动安装到 PATH(Linux)
247
+ ln -s $(pwd)/mspm0-init ~/bin/mspm0-init
248
+
249
+ # 或手动安装到 PATH(Windows)
250
+ # 将 ti-project-assistant 目录加入系统 PATH
251
+ ```
252
+
253
+ ## 许可证
254
+
255
+ [MIT](LICENSE)