OVMS3-idf/docs/zh_CN/api-guides/jtag-debugging/building-openocd-windows.rst
2019-01-30 11:34:04 +08:00

76 lines
2.8 KiB
ReStructuredText
Raw 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.

********************************
Windows 环境下从源码编译 OpenOCD
********************************
:link_to_translation:`en:[English]`
除了从 `Espressif 官方 <https://github.com/espressif/openocd-esp32/releases>`_ 直接下载 OpenOCD 可执行文件,你还可以选择从源码编译得到 OpenOCD。如果想要快速设置 OpenOCD 而不是自行编译,请备份好当前文件,前往 :doc:`setup-openocd-windows` 章节查阅。
.. highlight:: bash
下载 OpenOCD 源码
=================
支持 ESP32 的 OpenOCD 源代码可以从乐鑫官方的 GitHub 获得,网址为 https://github.com/espressif/openocd-esp32。请使用以下命令来下载源代码::
cd ~/esp
git clone --recursive https://github.com/espressif/openocd-esp32.git
克隆后的源代码被保存在 ``~/esp/openocd-esp32`` 目录中。
安装依赖的软件包
================
安装编译 OpenOCD 所需的软件包。
.. note::
依次安装以下软件包,检查安装是否成功,然后继续下一个软件包的安装。在进行下一步操作之前,要先解决当前报告的问题。
::
pacman -S libtool
pacman -S autoconf
pacman -S automake
pacman -S texinfo
pacman -S mingw-w64-i686-libusb-compat-git
pacman -S pkg-config
.. note::
安装 ``pkg-config`` 会破坏 esp-idf 的工具链,因而在 OpenOCD 构建完成后,应将其卸载。详见文末进一步说明。如果想要再次构建 OpenOCD你需要再次运行 ``pacman -S pkg-config``。此步骤安装的其他软件包(在 ``pkg-config`` 之前)并不会出现这一问题。
构建 OpenOCD
============
配置和构建 OpenOCD 的流程如下::
cd ~/esp/openocd-esp32
./bootstrap
./configure
make
你可以选择最后再执行 ``sudo make install`` ,如果你已经安装过别的开发平台的 OpenOCD请跳过这个步骤因为它可能会覆盖掉原来的 OpenOCD。
.. note::
* 如果发生错误,请解决后再次尝试编译,直到 ``make`` 成功为止。
* 如果 OpenOCD 存在子模块问题,请 ``cd````openocd-esp32`` 目录,并输入 ``git submodule update --init`` 命令。
* 如果 ``./configure`` 成功运行JTAG 被使能的信息会被打印在 ``OpenOCD configuration summary`` 下面。
* 如果您的设备信息未显示在日志中,请根据 ``../openocd-esp32/doc/INSTALL.txt`` 文中的描述使用 ``./configure`` 启用它。
* 有关编译 OpenOCD 的详细信息,请参阅 ``openocd-esp32/README.Windows``
一旦 ``make`` 过程成功完成OpenOCD 的可执行文件会被保存到 ``~/esp/openocd-esp32/src/openocd`` 目录中。
如安装依赖步骤所述,最后还需要移除 ``pkg-config`` 软件包::
pacman -Rs pkg-config
下一步
======
想要进一步配置调试环境,请前往 :ref:`jtag-debugging-configuring-esp32-target` 章节。