# Windows 개발 환경

다음 지침은 Windows 10에서 (Cygwin 기반) PX4 개발 환경 설정 방법을 설명합니다. 이 환경은 다음을 위한 PX4를 구축하는 데 사용합니다.

WARNING

The current version of this toolchain does not work with the master codeline (though it does with stable versions). The Windows WSL2-Based Development Environment is a highly recommended Windows 11 (only) alternative, and is likely to become the supported Windows solution in the near future.

TIP

This setup is supported by the PX4 dev team. To build other targets you will need to use a different OS (or an unsupported windows development environment).

# 설치 방법

  1. Github 릴리스 (opens new window) 또는 Amazon S3 (opens new window)(빠른 다운로드)에서 바로 사용할 수 있는 MSI 설치 프로그램의 최신 버전을 다운로드합니다.
  2. 실행후, 설치 위치를 지정하고 설치하십시오:jMAVSimOnWindows
  3. 설치가 끝날 때 상자를 선택하여 PX4 리포지토리를 복제하고, jMAVSim으로 시뮬레이션을 빌드 및 실행합니다(이렇게 하면 시작 프로세스가 간소화됨). :::note 이 단계를 놓친 경우 PX4-Autopilot 저장소를 수동으로 복제하여야 합니다. :::

WARNING

At time of writing the installer is missing some dependencies (and cannot yet be rebuilt to add them - see PX4-windows-toolchain#31 (opens new window)).

To add these yourself:

  1. 도구 모음 설치 디렉터리로 이동합니다(기본값 C:\PX4\).
  2. Run run-console.bat (double click) to start the linux-like Cygwin bash console
  3. Enter the following command in the console:
    pip3 install --user kconfiglib jsonschema future
    

# 시작하기

The toolchain uses a specially configured console window (started by running the run-console.bat script) from which you can call the normal PX4 build commands:

  1. 도구 모음 설치 디렉터리로 이동합니다(기본값 C:\PX4\).
  2. Run run-console.bat (double click) to start the linux-like Cygwin bash console (you must use this console to build PX4).
  3. Clone the PX4 PX4-Autopilot repository from within the console:

Note

Skip this step if you ticked the installer option to clone the PX4 repository, build and run simulation with jMAVSim. Cloning only needs to be done once!

# Clone the PX4-Autopilot repository into the home folder & loads submodules in parallel
git clone --recursive -j8 https://github.com/PX4/PX4-Autopilot.git

You can now use the console/PX4-Autopilot repository to build PX4.

  1. For example, to run JMAVSim:

    # Navigate to PX4-Autopilot repo
    cd Firmware
    # Build and runs SITL simulation with jMAVSim to test the setup
    make px4_sitl jmavsim
    

    The console will then display:

    jMAVSimOnWindows

# 다음 단계

Once you have finished setting up the command-line toolchain:

# 문제 해결

# 파일 모니터링 도구와 툴체인 속도

Antivirus and other background file monitoring tools can significantly slow down both installation of the toolchain and PX4 build times.

You may wish to halt them temporarily during builds (at your own risk).

# 윈도우와 Git 특수 사례

# Windows CR+LF 대 Unix LF 줄 끝

We recommend that you force Unix style LF endings for every repository you're working with using this toolchain (and use an editor which preserves them when saving your changes - e.g. Eclipse or VS Code). Compilation of source files also works with CR+LF endings checked out locally, but there are cases in Cygwin (e.g. execution of shell scripts) that require Unix line endings (otherwise you get errors like $'\r': Command not found.). Luckily git can do this for you when you execute the two commands in the root directory of your repo:

git config core.autocrlf false
git config core.eol lf

If you work with this toolchain on multiple repositories you can also set these two configurations globally for your machine:

git config --global ...

This is not recommended because it may affect any other (unrelated) git use on your Windows machine.

# 유닉스 권한 실행 비트

Under Unix there's a flag in the permissions of each file that tells the OS whether or not the file is allowed to be executed. git under Cygwin supports and cares about that bit (even though the Windows NTFS file system does not use it). This often results in git finding "false-positive" differences in permissions. The resulting diff might look like this:

diff --git ...
old mode 100644
new mode 100755

We recommend globally disabling the permission check on Windows to avoid the problem:

# 머신에 대해 전역적으로 실행 비트 검사를 비활성화합니다.
git config --global core.fileMode false 

For existing repositories that have this problem caused by a local configuration, additionally:

# 전역 옵션을 적용하려면 이 저장소에 대한 로컬 옵션을 제거합니다.
git config --unset core.filemode

# 모든 하위 모듈에 대한 로컬 옵션 제거
git submodule foreach --recursive git config --unset core.filemode