How to install zephyr

Embeded : 2019. 8. 21. 11:56
반응형

zephyr 관리하는 툴인 west 를 설치.

 

$ pip3 install --user -U west

 

이렇게 --user 하면 계정 로컬에 설치됨

 

/home/lionelj/.local/bin  에 west 깔림. 그래서 여기를 PATH로 잡아줌.

 

$ west init zephyrproject
$ cd zephyrproject
$ ls
합계 16K
drwxrwxr-x  4 lionelj lionelj 4.0K  8월 21 11:53 .
drwxrwxr-x  3 lionelj lionelj 4.0K  8월 21 11:52 ..
drwxrwxr-x  2 lionelj lionelj 4.0K  8월 21 11:53 .west
drwxrwxr-x 22 lionelj lionelj 4.0K  8월 21 11:53 zephyr

$ west update

 

cmake 가 필요해서 설치해줌.

 

$ sudo apt install cmake

 

zephyr SDK 가 또 있어야 되네.

 

https://github.com/zephyrproject-rtos/sdk-ng 에 가보면 다운로드 방법 있음.

 

RP build 버전은 

https://builds.zephyrproject.org/zephyrproject-rtos/sdk-ng//zephyr-sdk--setup.run

 

정식 릴리즈는 

https://github.com/zephyrproject-rtos/sdk-ng/releases

여기서 받으면 되는 모양.

 

일단. zephyr-sdk-0.10.3-setup.run 를 받는다.

 

$ chmod +x zephyr-sdk-0.10.3-setup.run

$ ./zephyr-sdk-0.10.3-setup.run 
Verifying archive integrity... All good.
Uncompressing SDK for Zephyr  100%  
Enter target directory for SDK (default: /opt/zephyr-sdk/):
Installing SDK to /opt/zephyr-sdk
Creating directory /opt/zephyr-sdk
No permission, please run as 'sudo'

 

sudo 하라고 한다.
$ sudo ./zephyr-sdk-0.10.3-setup.run 

[sudo] lionelj의 암호: 
Verifying archive integrity... All good.
Uncompressing SDK for Zephyr  100%  
Enter target directory for SDK (default: /opt/zephyr-sdk/): 
Installing SDK to /opt/zephyr-sdk
Creating directory /opt/zephyr-sdk
Success
 [*] Installing x86 tools... 
 [*] Installing arm tools... 
 [*] Installing arc tools... 
 [*] Installing iamcu tools... 
 [*] Installing mips tools... 
 [*] Installing nios2 tools... 
 [*] Installing xtensa tools... 
 [*] Installing riscv32 tools... 
 [*] Installing riscv64 tools... 
 [*] Installing x86_64 tools... 
 [*] Installing additional host tools... 
Success installing SDK. SDK is ready to be used.

 

이렇게 하면 sdk 는 설치된다. 

인터넷에 보니까 sdk를 yocto 로 만든거 같다고 하는 사람도 있는데 뒤에 -ng 붙은거보니 crosstool-ng로 만든거 같기도 하고..

아무튼 sdk 를 설치하고 SDK 환경 변수를 맞춰준다.

 

export ZEPHYR_SDK_INSTALL_DIR="/opt/zephyr-sdk/"

 

$ cd zephyrproject/zephyr

$ cmake -B build -GNinja -DBOARD=esp32 samples/hello_world -DESP_IDF_PATH=/home/lionelj/hoho3/esp/esp-idf
Zephyr version: 2.0.0
-- Selected BOARD esp32
-- Found west: /home/lionelj/.local/bin/west (found suitable version "0.6.0", minimum required is "0.6.0")
-- Loading /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/boards/xtensa/esp32/esp32.dts as base
-- Overlaying /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/dts/common/common.dts
Device tree configuration written to /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build/zephyr/include/generated/generated_dts_board.conf
Parsing Kconfig tree in /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build/zephyr/.config'
No change to '/home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build/zephyr/.config'
-- Cache files will be written to: /home/lionelj/.cache/zephyr
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
-- Configuring incomplete, errors occurred!
See also "/home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build/CMakeFiles/CMakeOutput.log".

 

ninja 가 없다.

 

$sudo apt-get install ninja-build

 

깔고 다시 하면 됨.

 

$ cmake -B build -GNinja -DBOARD=esp32 samples/hello_world -DESP_IDF_PATH=/home/lionelj/hoho3/esp/esp-idf
Zephyr version: 2.0.0
-- Selected BOARD esp32
-- Found west: /home/lionelj/.local/bin/west (found suitable version "0.6.0", minimum required is "0.6.0")
-- Loading /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/boards/xtensa/esp32/esp32.dts as base
-- Overlaying /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/dts/common/common.dts
Device tree configuration written to /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build/zephyr/include/generated/generated_dts_board.conf
Parsing Kconfig tree in /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build/zephyr/.config'
No change to '/home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build/zephyr/.config'
-- Cache files will be written to: /home/lionelj/.cache/zephyr
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/lionelj/hoho3/esp/crosstool-NG/builds/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Performing Test toolchain_is_ok
-- Performing Test toolchain_is_ok - Success
Including module: atmel in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/atmel
Including module: civetweb in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/lib/civetweb
Including module: esp-idf in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/esp-idf/zephyr
Including module: fatfs in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/fs/fatfs
Including module: qmsi in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/qmsi
Including module: cypress in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/cypress
Including module: nordic in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/nordic
Including module: openisa in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/openisa
Including module: microchip in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/microchip
Including module: silabs in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/silabs
Including module: st in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/st
Including module: stm32 in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/stm32
Including module: ti in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/ti
Including module: libmetal in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/libmetal
Including module: lvgl in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/lib/gui/lvgl
Including module: mbedtls in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/crypto/mbedtls
Including module: mcumgr in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/lib/mcumgr
Including module: nffs in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/fs/nffs
Including module: nxp in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/hal/nxp
Including module: open-amp in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/lib/open-amp
Including module: openthread in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/lib/openthread
Including module: segger in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/debug/segger
Including module: tinycbor in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/lib/tinycbor
Including module: littlefs in path: /home/lionelj/hoho3/zephyr/zephyrproject/modules/fs/littlefs
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build

 

or 

 

이렇게 해도 됨

$ west build -b esp32 samples/hello_world
-- west build: build configuration:
       source directory: /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/samples/hello_world
       build directory: /home/lionelj/hoho3/zephyr/zephyrproject/zephyr/build
       BOARD: esp32 (origin: CMakeCache.txt)
-- west build: building application
[1/94] Preparing syscall dependency handling

[89/94] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region         Used Size  Region Size  %age Used
     iram0_0_seg:       12690 B       128 KB      9.68%
     iram0_2_seg:          0 GB      3264 KB      0.00%
     dram0_0_seg:        7808 B       320 KB      2.38%
     drom0_0_seg:          0 GB         8 MB      0.00%
    rtc_iram_seg:          0 GB         8 KB      0.00%
    rtc_slow_seg:          0 GB         4 KB      0.00%
        IDT_LIST:          72 B         8 KB      0.88%
[94/94] Linking C executable zephyr/zephyr.elf

 

or

 

export BPOARD=esp32
west -v build

반응형
Posted by Real_G