ユーザ用ツール

サイト用ツール


mas1xx_devel:nuttx_firmware:nuttx_development_detail:prepare_build_env:start

開発環境の構築


NuttX をビルドするための環境を構築します。

Ubuntu Linux のインストール

Linux のほうが便利なので、Linux1) を実機/仮想マシンなどにインストールするか、Windows11 であれば WSL2 で Microsoft Store からインストールするのが手っ取り早いと思います。

Microsoft Store


Install Ubuntu Linux


Ubuntu Linux の起動まで確認できました。


パッケージのインストール

NuttX Getting Started - Installing を参考に、ビルドに必要なパッケージをインストールします。

必須パッケージの追加

user1@G1:~$ sudo apt install \
bison flex gettext texinfo libncurses5-dev libncursesw5-dev xxd \
gperf automake libtool pkg-config build-essential gperf genromfs \
libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils-dev libelf-dev \
libexpat-dev gcc-multilib g++-multilib picocom u-boot-tools util-linux
...
  pkg-config rpcsvc-proto tex-common texinfo u-boot-tools zlib1g-dev
0 upgraded, 153 newly installed, 0 to remove and 0 not upgraded.
Need to get 103 MB of archives.
After this operation, 393 MB of additional disk space will be used.
Do you want to continue? [Y/n]


Kconfig フロントエンドの追加

user1@G1:~$ sudo apt install kconfig-frontends
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
...
  x11proto-dev xorg-sgml-doctools xtrans-dev
0 upgraded, 150 newly installed, 0 to remove and 0 not upgraded.
Need to get 85.1 MB of archives.
After this operation, 394 MB of additional disk space will be used.
Do you want to continue? [Y/n]


ツールチェインの追加

user1@G1:~$ sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libnewlib-arm-none-eabi libnewlib-dev libstdc++-arm-none-eabi-dev
  libstdc++-arm-none-eabi-newlib
Suggested packages:
  libnewlib-doc
The following NEW packages will be installed:
  binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi libnewlib-dev
  libstdc++-arm-none-eabi-dev libstdc++-arm-none-eabi-newlib
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 442 MB of archives.
After this operation, 2575 MB of additional disk space will be used.
Do you want to continue? [Y/n]


zip/unzip の追加

一部、ソースのアーカイブをダウンロード・展開するものもある2)ため、zip/unzip を追加しておきます。

user1@G1:~$ sudo apt install zip unzip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  unzip zip
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 350 kB of archives.
...
Setting up unzip (6.0-26ubuntu3.2) ...
Setting up zip (3.0-12build2) ...
Processing triggers for man-db (2.10.2-1) ...
user1@G1:~$


ccache の追加

ビルド高速化のために ccache を使う設定をデフォルト設定にいれてあるので、ccache を追加しておきます。

user1@G1:~$ sudo apt install ccache
[sudo] password for user1:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libhiredis0.14
Suggested packages:
  distcc | icecc
The following NEW packages will be installed:
...
Updating symlinks in /usr/lib/ccache ...
Processing triggers for libc-bin (2.35-0ubuntu3.6) ...
Processing triggers for man-db (2.10.2-1) ...
user1@G1:~$


Nim compiler の追加(Optional)

Nim 言語 を利用して楽に開発をする場合、Nim Compiler をインストールします。

Install Nim on Unix を参照してインストールしますが、choosenim を使用する方法が楽で良いと思います。

Installation using choosenim


メッセージが出ている通り、~/.bashrc に PATH を通す設定を追加しておきます。
設定を追加して .bashrc を読み込み直すと、nim コマンドが使用できるようになります。

user1@G1:~$ nano -w .bashrc <--- PATH 設定を追加するためにエディタを起動
user1@G1:~$ source .bashrc
user1@G1:~$ nim -v
Nim Compiler Version 2.0.2 [Linux: amd64]
Compiled at 2023-12-15
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: c4c44d10df8a14204a75c34e499def200589cb7c
active boot switches: -d:release
1)
Ubuntu Linux 推奨
2)
ライセンスの都合
mas1xx_devel/nuttx_firmware/nuttx_development_detail/prepare_build_env/start.txt · 最終更新: 2024/04/02 14:34 by admin