macos-setup-scratch.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ***********************************************
  2. Setup Toolchain for Mac OS from Scratch
  3. ***********************************************
  4. :link_to_translation:`zh_CN:[中文]`
  5. Package Manager
  6. ===============
  7. To set up the toolchain from scratch, rather than :doc:`downloading a pre-compiled toolchain<macos-setup>`, you will need to install either the MacPorts_ or homebrew_ package manager.
  8. MacPorts needs a full XCode installation, while homebrew only needs XCode command line tools.
  9. .. _homebrew: https://brew.sh/
  10. .. _MacPorts: https://www.macports.org/install.php
  11. See :ref:`Customized Setup of Toolchain <get-started-customized-setup>` section for some of the reasons why installing the toolchain from scratch may be necessary.
  12. Install Prerequisites
  13. =====================
  14. - install pip::
  15. sudo easy_install pip
  16. - install pyserial::
  17. pip install --user pyserial
  18. - install CMake & Ninja build:
  19. - If you have HomeBrew, you can run::
  20. brew install cmake ninja dfu-util
  21. - If you have MacPorts, you can run::
  22. sudo port install cmake ninja dfu-util
  23. Compile the Toolchain from Source
  24. =================================
  25. - Install dependencies:
  26. - with MacPorts::
  27. sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake make
  28. - with homebrew::
  29. brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake make
  30. Create a case-sensitive filesystem image::
  31. hdiutil create ~/esp/crosstool.dmg -volname "ctng" -size 10g -fs "Case-sensitive HFS+"
  32. Mount it::
  33. hdiutil mount ~/esp/crosstool.dmg
  34. Create a symlink to your work directory::
  35. mkdir -p ~/esp
  36. ln -s /Volumes/ctng ~/esp/ctng-volume
  37. Go into the newly created directory::
  38. cd ~/esp/ctng-volume
  39. Download ``crosstool-NG`` and build it:
  40. .. include-build-file:: inc/scratch-build-code.inc
  41. Build the toolchain::
  42. ./ct-ng xtensa-{IDF_TARGET_TOOLCHAIN_NAME}-elf
  43. ./ct-ng build
  44. chmod -R u+w builds/xtensa-{IDF_TARGET_TOOLCHAIN_NAME}-elf
  45. Toolchain will be built in ``~/esp/ctng-volume/crosstool-NG/builds/xtensa-{IDF_TARGET_TOOLCHAIN_NAME}-elf``. To use it, you need to add ``~/esp/ctng-volume/crosstool-NG/builds/xtensa-{IDF_TARGET_TOOLCHAIN_NAME}-elf/bin`` to ``PATH`` environment variable.
  46. Python 2 deprecation
  47. ====================
  48. Python 2 reached its `end of life <https://www.python.org/doc/sunset-python-2/>`_ and support for it in ESP-IDF will be removed soon. Please install Python 3.6 or higher. Instructions for macOS are listed above.
  49. Next Steps
  50. ==========
  51. To carry on with development environment setup, proceed to :ref:`get-started-get-esp-idf`.