EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1283 background imageLoading...
Page #1283 background image
Chapter 4. API Guides
mkdir -p build
cd build
cmake .. -G Ninja # or 'Unix Makefiles'
ninja
In the above list, the cmake command configures the project and generates build files for use with the final build
tool. In this case the final build tool is Ninja: running ninja actually builds the project.
Its not necessary to run cmake more than once. After the first build, you only need to run ninja each time.
ninja will automatically re-invoke cmake if the project needs reconfiguration.
If using CMake with ninja or make, there are also targets for more of the idf.py sub-commands - for example
running make menuconfig or ninja menuconfig in the build directory will work the same as idf.py
menuconfig.
Note: If youre already familiar with CMake, you may find the ESP-IDF CMake-based build system unusual
because it wraps a lot of CMakes functionality to reduce boilerplate. See writing pure CMake components for some
information about writing more CMake stylecomponents.
Flashing with ninja or make Its possible to build and flash directly from ninja or make by running a target like:
ninja flash
Or:
make app-flash
Available targets are: flash, app-flash (app only), bootloader-flash (bootloader only).
When flashing this way, optionally set the ESPPORT and ESPBAUD environment variables to specify the serial port
and baud rate. You can set environment variables in your operating system or IDE project. Alternatively, set them
directly on the command line:
ESPPORT=/dev/ttyUSB0 ninja flash
Note: Providing environment variables at the start of the command like this is Bash shell Syntax. It will work on
Linux and macOS. It wont work when using Windows Command Prompt, but it will work when using Bash-like
shells on Windows.
Or:
make -j3 app-flash ESPPORT=COM4 ESPBAUD=2000000
Note: Providing variables at the end of the command line is make syntax, and works for make on all platforms.
Using CMake in an IDE
You can also use an IDE with CMake integration. The IDE will want to know the path to the projects CMake-
Lists.txt file. IDEs with CMake integration often provide their own build tools (CMake calls thesegenerators
) to build the source files as part of the IDE.
When adding custom non-build steps like flashto the IDE, it is recommended to execute idf.py for these
specialcommands.
For more detailed information about integrating ESP-IDF with CMake into an IDE, see Build System Metadata.
Espressif Systems 1272
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish