Lines Matching +full:ninja +full:- +full:build
1 .. _cmake-details:
3 Build System (CMake)
7 CMake is used to build your application together with the Zephyr kernel. A
8 CMake build is done in two stages. The first stage is called
9 **configuration**. During configuration, the CMakeLists.txt build scripts are
11 Zephyr build, and can generate build scripts that are native to the host
14 CMake supports generating scripts for several build systems, but only Ninja and
16 **build** stage by executing the generated build scripts. These build scripts
19 be executed again before building. The build scripts can detect some of these
23 Zephyr uses CMake's concept of a 'target' to organize the build. A
26 understand. All source code that goes into a Zephyr build does so by
30 build scripts like this:
32 .. code-block:: cmake
47 Build and Configuration Phases
50 The Zephyr build process can be divided into two main phases: a configuration
51 phase (driven by CMake) and a build phase (driven by Make or Ninja).
56 -------------------
59 build system, specifying a source application directory and a board target.
61 .. figure:: build-config-phase.svg
63 :alt: Zephyr's build configuration phase
64 :figclass: align-center
69 top-level directory, which in turn refers to :file:`CMakeLists.txt` files
70 throughout the build tree (directly and indirectly). Its primary output is a
71 set of Makefiles or Ninja files to drive the build process, but the CMake
74 Note that paths beginning with :file:`build/` below refer to the build
87 placed in :file:`build/zephyr/zephyr.dts.pre`.
91 :file:`build/zephyr/include/generated/zephyr/devicetree_generated.h` header with
99 :file:`build/zephyr/zephyr.dts` in the build directory. This file's contents
103 :file:`build/zephyr/zephyr.dts` to catch any extra warnings and errors
108 :ref:`dt-guide`.
131 Build Phase
132 -----------
134 The build phase begins when the user invokes ``make`` or ``ninja``. Its
137 :file:`zephyr.hex`, etc.) The build phase can be broken down, conceptually,
138 into four stages: the pre-build, first-pass binary, final binary, and
139 post-processing.
141 Pre-build
144 Pre-build occurs before any source files are compiled, because during
148 Access to high-level data structures and members is sometimes
158 .. figure:: build-build-phase-1.svg
160 :alt: Zephyr's build stage I
161 :figclass: align-center
171 generated during the configuration phase and the pre-build stage(s)).
173 .. figure:: build-build-phase-2.svg
175 :alt: Zephyr's build stage II
176 :figclass: align-center
201 by post-process steps that will impact the size of the final binary.
203 .. figure:: build-build-phase-3.svg
205 :alt: Zephyr's build stage III
206 :figclass: align-center
216 .. figure:: build-build-phase-4.svg
218 :alt: Zephyr's build stage IV
219 :figclass: align-center
222 Intermediate binaries post-processing
228 To complete the build procedure the following scripts are executed on the
239 .. figure:: build-postprocess-1.svg
241 :alt: Zephyr's intermediate binary post-process I
242 :figclass: align-center
253 .. figure:: build-postprocess-2.svg
255 :alt: Zephyr's intermediate binary post-process II
256 :figclass: align-center
264 .. figure:: build-postprocess-3.svg
266 :alt: Zephyr's intermediate binary post-process III
267 :figclass: align-center
279 .. figure:: build-postprocess-4.svg
281 :alt: Zephyr's intermediate binary post-process IV
282 :figclass: align-center
285 When no intermediate binary post-processing is required then the first
297 .. figure:: build-build-phase-5.svg
299 :alt: Zephyr's build final stage
300 :figclass: align-center
310 .. figure:: build-build-phase-6.svg
312 :alt: Zephyr's build final stage post-process
313 :figclass: align-center
322 The following is a detailed description of the scripts used during the build process.
326 :zephyr_file:`scripts/build/gen_syscalls.py`
327 --------------------------------------------
329 .. include:: ../../../scripts/build/gen_syscalls.py
330 :start-after: """
331 :end-before: """
335 :zephyr_file:`scripts/build/gen_device_deps.py`
336 -----------------------------------------------
338 .. include:: ../../../scripts/build/gen_device_deps.py
339 :start-after: """
340 :end-before: """
344 :zephyr_file:`scripts/build/gen_kobject_list.py`
345 ------------------------------------------------
347 .. include:: ../../../scripts/build/gen_kobject_list.py
348 :start-after: """
349 :end-before: """
353 :zephyr_file:`scripts/build/gen_offset_header.py`
354 -------------------------------------------------
356 .. include:: ../../../scripts/build/gen_offset_header.py
357 :start-after: """
358 :end-before: """
362 :zephyr_file:`scripts/build/parse_syscalls.py`
363 ----------------------------------------------
366 .. include:: ../../../scripts/build/parse_syscalls.py
367 :start-after: """
368 :end-before: """
373 ----------------------------------
376 :start-after: """
377 :end-before: """
382 ----------------------------------
385 :start-after: """
386 :end-before: """
390 :zephyr_file:`scripts/build/gen_relocate_app.py`
391 ------------------------------------------------
393 .. include:: ../../../scripts/build/gen_relocate_app.py
394 :start-after: """
395 :end-before: """
399 :zephyr_file:`scripts/build/process_gperf.py`
400 ---------------------------------------------
402 .. include:: ../../../scripts/build/process_gperf.py
403 :start-after: """
404 :end-before: """
406 :zephyr_file:`scripts/build/gen_app_partitions.py`
407 --------------------------------------------------
409 .. include:: ../../../scripts/build/gen_app_partitions.py
410 :start-after: """
411 :end-before: """
415 :zephyr_file:`scripts/build/check_init_priorities.py`
416 -----------------------------------------------------
418 .. include:: ../../../scripts/build/check_init_priorities.py
419 :start-after: """
420 :end-before: """