diff --git a/docs/source/get_started/debug.rst b/docs/source/get_started/debug.rst index 99fd5e7e..11980411 100644 --- a/docs/source/get_started/debug.rst +++ b/docs/source/get_started/debug.rst @@ -5,6 +5,90 @@ 本节主要介绍如何使用调试器进行代码的调试。 -使用 CKlink + Eclipse 调试代码 +使用 CKLink + Eclipse 调试代码 ------------------------------------------- +- 从 Bouffalo Lab 开发者社区下载带有 RISC-V 工具链的 `Eclipse 安装包 `_ 。 +- 从 T-HEAD 官网下载最新版本 `CKLink 驱动 `_ + +安装和配置 Eclipse +^^^^^^^^^^^^^^^^^^^^ + +- 将获取到的 eclipse 压缩包拷贝到您的工作目录,解压 eclipse 压缩包 +- 进入 eclipse 目录,双击 ``eclipse.exe`` 启动 eclipse +- 选择您的 ``Workspace`` 目录,点击 ``Launch`` 进入工作空间 + +.. figure:: img/eclipse1.png + :alt: + +- 点击菜单栏中 ``Window->preferences`` 打开环境配置相关页面,准备导入相关的配置环境 + +.. figure:: img/eclipse2.png + :alt: + +- 点击下图 1 处的图标,打开导入配置界面,按照如图所示步骤,选择 ``eclipse.exe`` 目录下的 ``bflb_mcu_preferences.epf`` 配置文件。 + +.. figure:: img/eclipse3.png + :alt: + +- 选择好对应的文件后,点击 ``Finish``,在弹出的对话框选中点击 ``cancel`` ,不用重新启动。 + +.. figure:: img/eclipse4.png + :alt: + +- 点击 菜单栏 ``File->Import`` ,打开导入项目的配置界面 + +.. figure:: img/eclipse5.png + :alt: + +- 在打开的 ``Import`` 窗口中选择 ``C/C++->Existing Code as Makefile Project`` ,然后点击 ``Next`` + +.. figure:: img/eclipse6.png + :alt: + +- 导入 bl_mcu_sdk 的工程路径后,点击 ``Finsh`` 完成 + +.. figure:: img/eclipse7.png + :alt: + +- 最终效果如下 + +.. figure:: img/eclipse8.png + :alt: + +安装和配置 CKLink +^^^^^^^^^^^^^^^^^^^^ + +- 将下载的 CKLink 安装包解压,并双击 `Setup` ,一路 next 即可,安装完成以后,桌面会有一个 `T-HeadDebugServer` 图标 + +.. figure:: img/cklink1.png + :alt: + +.. figure:: img/cklink2.png + :alt: + +- 将板子的 JTAG 引脚和 CKLink 调试器连接以后,点击 **三角** 按钮,如果变成 **圆圈**,则表示 JTAG 连接成功。如果失败,则需要检查 JTAG 线序是否正确。 + +.. figure:: img/cklink3.png + :alt: + + +调试 ELF +^^^^^^^^^^^^^^^^^^^^ + +完成上述两步以后,如果是在 **flash 上调试,需要先将 bin 文件烧录到芯片中** ,最后才能够进行下面的调试环节。 + +- 在 Eclipse 中 点击 `debug` 图标,并点击 `Debug Configurations` + +.. figure:: img/eclipse9.png + :alt: + +- 左侧打开 `GDB Hardware Debugging`,选择对应芯片的配置按钮,并导入编译生成的 **elf**,最后点击 `Debug` + +.. figure:: img/eclipse10.png + :alt: + +- 最终进入调试界面 + +.. figure:: img/eclipse11.png + :alt: diff --git a/docs/source/get_started/img/cklink1.png b/docs/source/get_started/img/cklink1.png new file mode 100644 index 00000000..4a1565c8 Binary files /dev/null and b/docs/source/get_started/img/cklink1.png differ diff --git a/docs/source/get_started/img/cklink2.png b/docs/source/get_started/img/cklink2.png new file mode 100644 index 00000000..1694bd05 Binary files /dev/null and b/docs/source/get_started/img/cklink2.png differ diff --git a/docs/source/get_started/img/cklink3.png b/docs/source/get_started/img/cklink3.png new file mode 100644 index 00000000..fdece2c6 Binary files /dev/null and b/docs/source/get_started/img/cklink3.png differ diff --git a/docs/source/get_started/img/cklink4.png b/docs/source/get_started/img/cklink4.png new file mode 100644 index 00000000..78e632bb Binary files /dev/null and b/docs/source/get_started/img/cklink4.png differ diff --git a/docs/source/get_started/img/eclipse1.png b/docs/source/get_started/img/eclipse1.png new file mode 100644 index 00000000..9866e309 Binary files /dev/null and b/docs/source/get_started/img/eclipse1.png differ diff --git a/docs/source/get_started/img/eclipse10.png b/docs/source/get_started/img/eclipse10.png new file mode 100644 index 00000000..645071f4 Binary files /dev/null and b/docs/source/get_started/img/eclipse10.png differ diff --git a/docs/source/get_started/img/eclipse11.png b/docs/source/get_started/img/eclipse11.png new file mode 100644 index 00000000..3fd4ef3c Binary files /dev/null and b/docs/source/get_started/img/eclipse11.png differ diff --git a/docs/source/get_started/img/eclipse2.png b/docs/source/get_started/img/eclipse2.png new file mode 100644 index 00000000..2d5129bc Binary files /dev/null and b/docs/source/get_started/img/eclipse2.png differ diff --git a/docs/source/get_started/img/eclipse3.png b/docs/source/get_started/img/eclipse3.png new file mode 100644 index 00000000..0e20a992 Binary files /dev/null and b/docs/source/get_started/img/eclipse3.png differ diff --git a/docs/source/get_started/img/eclipse4.png b/docs/source/get_started/img/eclipse4.png new file mode 100644 index 00000000..9424826d Binary files /dev/null and b/docs/source/get_started/img/eclipse4.png differ diff --git a/docs/source/get_started/img/eclipse5.png b/docs/source/get_started/img/eclipse5.png new file mode 100644 index 00000000..40158e36 Binary files /dev/null and b/docs/source/get_started/img/eclipse5.png differ diff --git a/docs/source/get_started/img/eclipse6.png b/docs/source/get_started/img/eclipse6.png new file mode 100644 index 00000000..0ce0f1f5 Binary files /dev/null and b/docs/source/get_started/img/eclipse6.png differ diff --git a/docs/source/get_started/img/eclipse7.png b/docs/source/get_started/img/eclipse7.png new file mode 100644 index 00000000..ee0ad4ef Binary files /dev/null and b/docs/source/get_started/img/eclipse7.png differ diff --git a/docs/source/get_started/img/eclipse8.png b/docs/source/get_started/img/eclipse8.png new file mode 100644 index 00000000..5a3e87c0 Binary files /dev/null and b/docs/source/get_started/img/eclipse8.png differ diff --git a/docs/source/get_started/img/eclipse9.png b/docs/source/get_started/img/eclipse9.png new file mode 100644 index 00000000..e18f7da5 Binary files /dev/null and b/docs/source/get_started/img/eclipse9.png differ