]> granicus.if.org Git - esp-idf/blob - docs/en/get-started/linux-setup.rst
17d49c93b6c9cf0f2dc3b9344d86594ae832d2c5
[esp-idf] / docs / en / get-started / linux-setup.rst
1 *************************************
2 Standard Setup of Toolchain for Linux
3 *************************************
4
5
6 Install Prerequisites
7 =====================
8
9 To compile with ESP-IDF you need to get the following packages:
10
11 - CentOS 7::
12
13     sudo yum install git wget make ncurses-devel flex bison gperf python pyserial
14
15 - Ubuntu and Debian::
16
17     sudo apt-get install git wget make libncurses-dev flex bison gperf python python-serial
18
19 - Arch::
20
21     sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial
22
23
24 Toolchain Setup
25 ===============
26
27 ESP32 toolchain for Linux is available for download from Espressif website:
28
29 - for 64-bit Linux:
30
31   https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
32
33 - for 32-bit Linux:
34
35   https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-80-g6c4433a-5.2.0.tar.gz
36
37 1.  Download this file, then extract it in ``~/esp`` directory::
38
39         mkdir -p ~/esp
40         cd ~/esp
41         tar -xzf ~/Downloads/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
42
43 .. _setup-linux-toolchain-add-it-to-path:
44
45 2.  The toolchain will be extracted into ``~/esp/xtensa-esp32-elf/`` directory.
46
47     To use it, you will need to update your ``PATH`` environment variable in ``~/.profile`` file. To make ``xtensa-esp32-elf`` available for all terminal sessions, add the following line to your ``~/.profile`` file::
48
49         export PATH="$PATH:$HOME/esp/xtensa-esp32-elf/bin"
50
51     Alternatively, you may create an alias for the above command. This way you can get the toolchain only when you need it. To do this, add different line to your ``~/.profile`` file::
52
53         alias get_esp32='export PATH="$PATH:$HOME/esp/xtensa-esp32-elf/bin"'
54
55     Then when you need the toolchain you can type ``get_esp32`` on the command line and the toolchain will be added to your ``PATH``.
56
57     .. note::
58
59         If you have ``/bin/bash`` set as login shell, and both ``.bash_profile`` and ``.profile`` exist, then update ``.bash_profile`` instead.
60
61 3.  Log off and log in back to make the ``.profile`` changes effective. Run the following command to verify if ``PATH`` is correctly set::
62
63         printenv PATH
64
65     You are looking for similar result containing toolchain's path at the end of displayed string::
66
67         $ printenv PATH
68         /home/user-name/bin:/home/user-name/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/user-name/esp/xtensa-esp32-elf/bin
69
70     Instead of ``/home/user-name`` there should be a home path specific to your installation.
71
72
73 Permission issues /dev/ttyUSB0
74 ------------------------------
75
76 With some Linux distributions you may get the ``Failed to open port /dev/ttyUSB0`` error message when flashing the ESP32. :ref:`This can be solved by adding the current user to the dialout group<linux-dialout-group>`.
77
78
79 Arch Linux Users
80 ----------------
81
82 To run the precompiled gdb (xtensa-esp32-elf-gdb) in Arch Linux requires ncurses 5, but Arch uses ncurses 6. 
83
84 Backwards compatibility libraries are available in AUR_ for native and lib32 configurations:
85
86 - https://aur.archlinux.org/packages/ncurses5-compat-libs/
87 - https://aur.archlinux.org/packages/lib32-ncurses5-compat-libs/
88
89 Before installing these packages you might need to add the author's public key to your keyring as described in the "Comments" section at the links above.
90
91 Alternatively, use crosstool-NG to compile a gdb that links against ncurses 6.
92
93
94 Next Steps
95 ==========
96
97 To carry on with development environment setup, proceed to section :ref:`get-started-get-esp-idf`.
98
99
100 Related Documents
101 =================
102
103 .. toctree::
104     :maxdepth: 1
105
106     linux-setup-scratch
107
108
109 .. _AUR: https://wiki.archlinux.org/index.php/Arch_User_Repository