2019-10-22 05:57:37 -04:00
|
|
|
|
********************************************************
|
|
|
|
|
从零开始设置 Mac OS 环境下的工具链(传统 GNU Make)
|
|
|
|
|
********************************************************
|
2019-06-24 21:26:53 -04:00
|
|
|
|
:link_to_translation:`en:[English]`
|
|
|
|
|
|
|
|
|
|
.. include:: ../gnu-make-legacy.rst
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
安装工具链的标准方法请见 :doc:`这里 <macos-setup>`。请参考 :ref:`工具链自定义设置 <get-started-customized-setup-legacy>` 章节,查看可能需要从头开始设置工具链的情况。
|
|
|
|
|
|
|
|
|
|
安装准备
|
|
|
|
|
========
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
|
|
|
|
- 安装 pip::
|
|
|
|
|
|
|
|
|
|
sudo easy_install pip
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
``pip`` 稍后将用于安装 :ref:`必要的 Python 软件包 <get-started-get-packages-legacy>`。
|
|
|
|
|
|
|
|
|
|
从源代码编译工具链
|
2019-10-22 05:57:37 -04:00
|
|
|
|
===================
|
|
|
|
|
|
|
|
|
|
- 安装依赖项:
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 安装 MacPorts_ 或 homebrew_ 安装包管理器。MacPorts 需要完整的 XCode 软件,而 homebrew 只需要安装 XCode 命令行工具即可。
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
|
|
|
|
.. _homebrew: https://brew.sh/
|
|
|
|
|
.. _MacPorts: https://www.macports.org/install.php
|
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 对于 MacPorts::
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 对于 homebrew::
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 创建一个文件系统镜像(区分大小写)::
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
|
|
|
|
hdiutil create ~/esp/crosstool.dmg -volname "ctng" -size 10g -fs "Case-sensitive HFS+"
|
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 挂载::
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
|
|
|
|
hdiutil mount ~/esp/crosstool.dmg
|
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 创建指向您工作目录的符号链接::
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
|
|
|
|
mkdir -p ~/esp
|
|
|
|
|
ln -s /Volumes/ctng ~/esp/ctng-volume
|
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 前往新创建的目录 ::
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
|
|
|
|
cd ~/esp/ctng-volume
|
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 下载并编译 ``crosstool-NG`` :
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
2019-11-12 22:46:16 -05:00
|
|
|
|
.. include-build-file:: inc/scratch-build-code.inc
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
- 编译工具链::
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
|
|
|
|
./ct-ng xtensa-esp32-elf
|
|
|
|
|
./ct-ng build
|
|
|
|
|
chmod -R u+w builds/xtensa-esp32-elf
|
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
编译得到的工具链会被保存到 ``~/esp/ctng-volume/crosstool-NG/builds/xtensa-esp32-elf``。请按照 :ref:`标准设置指南 <setup-macos-toolchain-add-it-to-path-legacy>` 的介绍,将工具链添加到 ``PATH``。
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
后续步骤
|
|
|
|
|
========
|
2019-06-24 21:26:53 -04:00
|
|
|
|
|
2019-10-22 05:57:37 -04:00
|
|
|
|
继续设置开发环境,请前往 :ref:`get-started-get-esp-idf-legacy` 章节。
|