develop/sca/index.html · develop/sca/index.rst 공식 원문 ↗

Zephyr 3.7.0 · Develop · SCA

Static Code Analysis(SCA)

CMake SCA root에 analyzer integration을 등록하고 build variant로 선택합니다.

Official pathdevelop/sca/index.html
Source filedevelop/sca/index.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

ZEPHYR_SCA_VARIANT, SCA_ROOT, out-of-tree sca.cmake 구조와 기본 지원 도구를 설명합니다.

Select

ZEPHYR_SCA_VARIANT

Extend

SCA_ROOT · sca.cmake

Native

4 analyzers

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 C7C2ADC084EA126D92A98FF3A736F90776DB50C9B33EFD59A802E9D04CA7F33F
.. _sca:

Static Code Analysis (SCA)
##########################

Support for static code analysis tools in Zephyr is possible through CMake.

The build setting :makevar:`ZEPHYR_SCA_VARIANT` can be used to specify the SCA
tool to use. :envvar:`ZEPHYR_SCA_VARIANT` is also supported as
:ref:`environment variable <env_vars>`.

Use ``-DZEPHYR_SCA_VARIANT=<tool>``, for example ``-DZEPHYR_SCA_VARIANT=sparse``
to enable the static analysis tool ``sparse``.

.. _sca_infrastructure:

SCA Tool infrastructure
***********************

Support for an SCA tool is implemented in a file:`sca.cmake` file.
The file:`sca.cmake` must be placed under file:`<SCA_ROOT>/cmake/sca/<tool>/sca.cmake`.
Zephyr itself is always added as an :makevar:`SCA_ROOT` but the build system offers the
possibility to add additional folders to the :makevar:`SCA_ROOT` setting.

You can provide support for out of tree SCA tools by creating the following
structure:

.. code-block:: none

   <sca_root>/                 # Custom SCA root
   └── cmake/
       └── sca/
           └── <tool>/         # Name of SCA tool, this is the value given to ZEPHYR_SCA_VARIANT
               └── sca.cmake   # CMake code that configures the tool to be used with Zephyr

To add ``foo`` under ``/path/to/my_tools/cmake/sca`` create the following structure:

.. code-block:: none

   /path/to/my_tools
            └── cmake/
                └── sca/
                    └── foo/
                        └── sca.cmake

To use ``foo`` as SCA tool you must then specify ``-DZEPHYR_SCA_VARIANT=foo``.

Remember to add ``/path/to/my_tools`` to :makevar:`SCA_ROOT`.

:makevar:`SCA_TOOL` can be set as a regular CMake setting using
``-DSCA_ROOT=<sca_root>``, or added by a Zephyr module in its :file:`module.yml`
file, see :ref:`Zephyr Modules - Build settings <modules_build_settings>`

.. _sca_native_tools:

Native SCA Tool support
***********************

The following is a list of SCA tools natively supported by Zephyr build system.

.. toctree::
   :maxdepth: 1

   codechecker
   sparse
   gcc
   cpptest

Part 3

한국어 전문 번역

Static Code Analysis(SCA)

Zephyr는 CMake를 통해 static code analysis 도구를 지원합니다.

ZEPHYR_SCA_VARIANT build setting으로 사용할 SCA tool을 지정합니다. 같은 이름의 environment variable도 지원합니다.

-DZEPHYR_SCA_VARIANT=<tool>을 사용합니다. 예를 들어 -DZEPHYR_SCA_VARIANT=sparse는 Sparse를 활성화합니다.

SCA tool infrastructure

SCA tool 지원은 sca.cmake file에 구현합니다. 이 file은 <SCA_ROOT>/cmake/sca/<tool>/sca.cmake 아래에 있어야 합니다. Zephyr 자체는 항상 SCA_ROOT로 추가되며 build system에서 SCA_ROOT folder를 더 추가할 수 있습니다.

Out-of-tree SCA tool 지원을 제공하려면 다음 구조를 만듭니다.

<sca_root>/                 # Custom SCA root
└── cmake/
    └── sca/
        └── <tool>/         # Name of SCA tool, this is the value given to ZEPHYR_SCA_VARIANT
            └── sca.cmake   # CMake code that configures the tool to be used with Zephyr

/path/to/my_tools/cmake/sca 아래에 foo를 추가하는 구조:

/path/to/my_tools
         └── cmake/
             └── sca/
                 └── foo/
                     └── sca.cmake

foo를 SCA tool로 사용하려면 -DZEPHYR_SCA_VARIANT=foo를 지정하고 /path/to/my_tools를 SCA_ROOT에 추가합니다.

원문은 SCA_TOOL을 일반 CMake setting으로 설정할 수 있다고 설명하면서 command line에는 -DSCA_ROOT=<sca_root>를 사용합니다. 또한 Zephyr module의 module.yml에서 SCA_ROOT를 추가할 수 있습니다.

Native SCA tool 지원

Zephyr build system이 기본 지원하는 SCA tool 목록입니다.

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.