K1Guitar/DEVELOPMENT_SETUP.md

93 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# YNGJ-GT1-M (K1电吉他) 开发环境配置指南
# MCU: AT32F403ARCT7 (雅特力 Cortex-M4F)
# IDE: IAR Embedded Workbench for ARM 7.4+
## 工程入口
| 项目 | 路径 |
|------|------|
| 主程序 | `project/IAR_V7.4/YNGJ-GT1-M.eww` |
| Bootloader | `AT32F403ARCT7_BOOT/project/IAR_V7.4/AT32F403ARCT7_BOOT.eww` |
## 需要安装的工具
### 1. IAR Embedded Workbench for ARM必需编译用
本项目使用 **IAR EWARM 7.40+** 创建,建议使用 IAR 7.x 或 9.x。
1. 访问 [IAR 免费试用](https://www.iar.com/embedded-development-tools/free-trials)
2. 选择 **IAR Embedded Workbench for Arm**,注册并下载安装包
3. 安装时勾选 **ARM** 工具链
4. 首次启动用邮件中的 License 激活(试用版 14 天 / 32KB 代码限制)
> 若原开发团队有正式 License直接安装后导入 License 文件即可。
### 2. AT32 IAR Device Pack必需芯片支持
1. 访问 [雅特力 AT32F403A 产品页](https://www.arterytek.com/cn/product/AT32F403A.jsp)
2.**工具与软件** 区域下载 **IAR_AT32MCU_AddOn**(或 IAR Pack
3. 运行安装程序,它会自动识别 IAR 安装路径
4. 安装后 IAR 中应能看到 `ArteryTek AT32F403ARCT7`
参考文档:[AT32F403A/407 入门指南 (PDF)](https://www.arterytek.com/download/APNOTE/AN0023_AT32F403A_407_Get_started_guide_V2.0.5_ZH.pdf)
### 3. SEGGER J-Link 软件(必需,调试/下载)
工程调试器配置为 **J-Link + SWD**
```powershell
winget install NordicSemiconductor.JLink --accept-package-agreements --accept-source-agreements
```
安装后确认:
```powershell
JLink.exe -?
```
### 4. 调试硬件
- **J-Link** 调试器(或板载 J-Link OB
- 通过 **SWD** 接口连接 AT32F403ARCT7
- 首次调试前在 IAR 中确认Project → Options → Debugger → Driver = **J-Link/J-Trace**
## 打开与编译
1. 双击或用 IAR 打开 `project/IAR_V7.4/YNGJ-GT1-M.eww`
2. 选择配置 **YNGJ-GT1-M**Release/Debug
3. 菜单 **Project → Rebuild All**(或 F7 编译)
命令行编译IAR 安装后):
```powershell
& "C:\Program Files\IAR Systems\Embedded Workbench 9.5\common\bin\IarBuild.exe" `
"project\IAR_V7.4\YNGJ-GT1-M.ewp" -build YNGJ-GT1-M -log all
```
> 路径按实际 IAR 版本调整。
## 调试步骤
1. J-Link 通过 USB 连接 PCSWD 线连接目标板
2. IAR 中按 **Ctrl+D** 进入调试Download and Debug
3. 若提示找不到 Device Pack回到步骤 2 安装 AT32 Pack
4. 若提示 J-Link 未找到,检查 SEGGER 软件是否安装、驱动是否正常
## 环境检查脚本
在项目根目录运行:
```powershell
.\scripts\check-dev-env.ps1
```
## 常见问题
**Q: 打开工程提示找不到 AT32F403ARCT7**
→ 安装雅特力 IAR PackIAR_AT32MCU_AddOn
**Q: 调试器连接失败?**
→ 检查 SWD 接线、目标板供电、J-Link 驱动IAR Debugger 选项选 J-Link
**Q: 工程里有 F:\IAR_WorkBench 旧路径?**
→ 这是原开发机路径,安装 IAR 后 IAR 会自动更新settings 目录已在 .gitignore 中忽略
**Q: 需要烧录 HEX 但不调试?**
→ 使用雅特力 **AT-Link / ISP 工具**,或 J-FlashJ-Link 附带)