boards/native/native_posix/doc/index.html · boards/native/native_posix/doc/index.rst 공식 원문 ↗

Zephyr 3.7.0 · Boards · Native · Legacy

Native POSIX 실행 (native_posix)

Zephyr를 Linux 네이티브 실행 파일로 만드는 이전 세대 보드 대상이며 신규 개발에는 native_sim이 권장됩니다.

Official pathboards/native/native_posix/doc/index.html
Source fileboards/native/native_posix/doc/index.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

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

Part 1

요약·해설

호스트 C 라이브러리만 사용할 수 있어 Zephyr POSIX 추상화와 함께 빌드할 수 없다는 점이 가장 큰 차이입니다.

Status

native_sim 이전 세대

32-bit

native_posix · ILP32

64-bit

native_posix/native/64 · LP64

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 0F834647DF811FF852612B4F7E062D922F06596309C5BBC9EC0D03B322EFBAD1
.. _native_posix:

Native POSIX execution (native_posix)
#######################################

.. contents::
   :depth: 1
   :backlinks: entry
   :local:

Overview
********

``native_posix`` is the predecessor of :ref:`native_sim<native_sim>`.
Just like with :ref:`native_sim<native_sim>` you can build your Zephyr application
with the Zephyr kernel, creating a normal Linux executable with your host tooling,
and can debug and instrument it like any other Linux program.

But unlike with :ref:`native_sim<native_sim>` you are limited to only using the host C library.
:ref:`native_sim<native_sim>` supports all ``native_posix`` use cases.

.. note::

   | If you are a new user, you are encouraged to use :ref:`native_sim<native_sim>` directly.
   | If you have been using native_posix you are recommended to start using
     :ref:`native_sim<native_sim>` instead.
   | If needed, :ref:`native_sim<native_sim>` includes a compatibility mode
     :kconfig:option:`CONFIG_NATIVE_SIM_NATIVE_POSIX_COMPAT`,
     which will set its configuration to mimic a native_posix's like configuration.

This board does not intend to simulate any particular HW, but it provides
a few peripherals such as an Ethernet driver, display, UART, etc., to enable
developing and testing application code which would require them.
This board supports the same :ref:`peripherals<native_sim_peripherals>`
:ref:`and backends as native_sim<native_sim_backends>`.

.. _native_posix_deps:

Host system dependencies
************************

Please check the
:ref:`Posix Arch Dependencies<posix_arch_deps>`

.. _native_important_limitations:

Important limitations
*********************

This board inherits
:ref:`the limitations of its architecture<posix_arch_limitations>`

Moreover, being limited to build only with the host C library, it is not possible to build
applications with the :ref:`Zephyr POSIX OS abstraction<posix_support>`, as there would be symbol
collisions between the host OS and this abstraction layer.

.. _native_posix_how_to_use:

How to use it
*************

To build, simply specify the ``native_posix`` board as target:

.. zephyr-app-commands::
   :zephyr-app: samples/hello_world
   :host-os: unix
   :board: native_posix
   :goals: build
   :compact:

Now you have a Linux executable, ``./build/zephyr/zephyr.exe``, you can use just like any
other Linux program.

You can run, debug, build it with sanitizers or with coverage just like with
:ref:`native_sim<native_sim>`.
Please check :ref:`native_sim's how to<native_sim_how_to_use>` for more info.

.. _native_posix32_64:

32 and 64bit versions
*********************

Just like :ref:`native_sim<native_sim>`, ``native_posix`` comes with two targets:
A 32 bit and 64 bit version.
The 32 bit version, ``native_posix``, is the default target, which will compile
your code for the ILP32 ABI (i386 in a x86 or x86_64 system) where pointers
and longs are 32 bits.
This mimics the ABI of most embedded systems Zephyr targets,
and is therefore normally best to test and debug your code, as some bugs are
dependent on the size of pointers and longs.
This target requires either a 64 bit system with multilib support installed or
one with a 32bit userspace.

The 64 bit version, ``native_posix/native/64``, compiles your code targeting the
LP64 ABI (x86-64 in x86 systems), where pointers and longs are 64 bits.
You can use this target if you cannot compile or run 32 bit binaries.

Part 3

한국어 전문 번역

개요

native_posix는 native_sim의 이전 세대 대상입니다. native_sim과 마찬가지로 Zephyr 애플리케이션과 Zephyr 커널을 호스트 도구로 빌드해 일반 Linux 실행 파일을 만들 수 있으며, 다른 Linux 프로그램처럼 디버깅하고 계측할 수 있습니다.

하지만 native_sim과 달리 호스트 C 라이브러리만 사용할 수 있습니다. native_sim은 native_posix의 모든 사용 사례를 지원합니다.

이 보드는 특정 하드웨어를 시뮬레이션하려는 대상이 아닙니다. 다만 Ethernet 드라이버, 디스플레이, UART 등 몇 가지 주변장치를 제공해 해당 기능이 필요한 애플리케이션 코드를 개발·시험할 수 있습니다. native_sim과 동일한 주변장치 및 backend를 지원합니다.

호스트 시스템 의존성

필요한 호스트 환경은 POSIX 아키텍처 의존성 문서를 따릅니다. Linux와 32비트 빌드용 라이브러리 요구사항을 먼저 확인해야 합니다.

중요한 제한

이 보드는 POSIX 아키텍처의 제한을 그대로 물려받습니다.

또한 호스트 C 라이브러리로만 빌드할 수 있으므로 Zephyr POSIX OS 추상화를 사용하는 애플리케이션은 빌드할 수 없습니다. 호스트 OS와 Zephyr 추상화 계층에 같은 심볼이 있어 충돌하기 때문입니다.

사용 방법

빌드 대상에 native_posix를 지정합니다.

west build -b native_posix samples/hello_world

빌드가 끝나면 ./build/zephyr/zephyr.exe라는 Linux 실행 파일이 만들어집니다. 일반 Linux 프로그램처럼 실행·디버깅할 수 있고 sanitizer 또는 coverage를 켜 빌드할 수도 있습니다. 자세한 실행·분석 방법은 native_sim 사용법과 같습니다.

32비트와 64비트 버전

native_sim과 마찬가지로 native_posix에는 32비트와 64비트 대상이 있습니다.

  • native_posix: 기본 32비트 대상입니다. x86 또는 x86_64 시스템에서 i386 ILP32 ABI를 사용해 포인터와 long을 32비트로 컴파일합니다. 대부분의 Zephyr 임베디드 대상 ABI를 흉내 내므로 포인터·long 크기에 의존하는 버그를 시험하고 디버깅하는 데 보통 더 적합합니다. multilib가 설치된 64비트 시스템 또는 32비트 userspace가 필요합니다.
  • native_posix/native/64: x86 시스템의 x86-64 LP64 ABI를 사용해 포인터와 long을 64비트로 컴파일합니다. 32비트 실행 파일을 컴파일하거나 실행할 수 없는 환경에서 사용할 수 있습니다.

Source

출처

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