한국어
Embedded
 

운영체제 디바이스 트리(Device Tree, DT)

makersweb 2020.01.12 15:53 조회 수 : 5600

디바이스트리는 시스템의 장치를 설명하는 노드가있는 트리 구조의 데이터다. 장치들에 관한 세부 사항을 운영체제에 하드코딩하지 않고 부팅시 운영체제로 전달되는 데이터로 설명 할 수 있다. 예를들어 부트로더는 디바이스트리를 메모리에 로드하고 디바이스트리에 대한 포인터를 커널에 전달한다. 커널은 CPU, 메모리, 버스 및 주변 장치를 포함하여 이러한 구성 요소를 조금 더 유연하게 사용하고 관리 할 수 있다.

 

임베디드 시스템의 리눅스커널에서도 전면적으로 디바이스트리 구조를 도입함으로써 데이터 기반 플랫폼 설정으로 인해 코드 중복이 줄어들고 단일 커널 이미지로 광범위한 하드웨어를 보다 쉽게 지원할 수 있게 됐다.

 

일반적으로 디바이스트리는 커널이 동적으로 감지 할 수 없는 시스템의 장치 정보를 설명한다. 예를 들어 PCI 구조는 커널이 언제든 연결된 장치를 검사하고 감지 할 수 있으므로 PCI 장치를 설명하는 장치 트리 노드가 필요하지 않을 수 있다. 반면 프로빙으로 감지 할 수없는 경우 시스템에서 PCI 호스트 브리지 장치를 설명해야한다.

 

디바이스트리 노드에는 장치의 특성을 설명하는 property 가 있다. property 는 값이 비어 있거나 임의의 바이트 스트림을 포함 할 수있는 key-value 쌍이다. 그리고 각 노드에는 부모가없는 루트 노드를 제외하고 정확히 하나의 부모가 있다. 

 

다음은 .dts 형식의 엔비디아 테그라 보드에 대한 디바이스트리의 일부이다.

/{
        compatible = "nvidia,harmony", "nvidia,tegra20";
        #address-cells = <1>;
        #size-cells = <1>;
        interrupt-parent = <&intc>;

        chosen { };
        aliases { };

        memory {
                device_type = "memory";
                reg = <0x00000000 0x40000000>;
        };

        soc {
                compatible = "nvidia,tegra20-soc", "simple-bus";
                #address-cells = <1>;
                #size-cells = <1>;
                ranges;


                intc: interrupt-controller@50041000 {
                        compatible = "nvidia,tegra20-gic";
                        interrupt-controller;
                        #interrupt-cells = <1>;
                        reg = <0x50041000 0x1000>, < 0x50040100 0x0100 >;
                };

                serial@70006300 {
                        compatible = "nvidia,tegra20-uart";
                        reg = <0x70006300 0x100>;
                        interrupts = <122>;
                };

                i2s1: i2s@70002800 {
                        compatible = "nvidia,tegra20-i2s";
                        reg = <0x70002800 0x100>;
                        interrupts = <77>;
                        codec = <&wm8903>;
                };

                i2c@7000c000 {
                        compatible = "nvidia,tegra20-i2c";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        reg = <0x7000c000 0x100>;
                        interrupts = <70>;

                        wm8903: codec@1a {
                                compatible = "wlf,wm8903";
                                reg = <0x1a>;
                                interrupts = <347>;
                        };
                };
        }

        sound {
                compatible = "nvidia,harmony-sound";
                i2s-controller = <&i2s1>;
                i2s-codec = <&wm8903>;
        };
};

 

노드의 이름은 정확한 장치모델이 아니라 장치의 기능을 반영하여 다소 일반적이어야한다.

• adc

• accelerometer

• atm

• audio-codec

• audio-controller

• backlight

• bluetooth

• bus

• cache-controller

• camera

• can

• charger

• clock

• clock-controller

• compact-flash

• cpu

• cpus

• crypto

• disk

• display

• dma-controller

• dsi

• dsp

• eeprom

• efuse

• endpoint

• ethernet

• ethernet-phy

• fdc

• flash

• gnss

• gpio

• gpu

• gyrometer

• hdmi

• hwlock

• i2c

• i2c-mux

• ide

• interrupt-controller

• iommu

• isa

• keyboard

• key

• keys

• lcd-controller

• led

• leds

• led-controller

 

• light-sensor

• magnetometer

• mailbox

• mdio

• memory

• memory-controller

• mmc

• mmc-slot

• mouse

• nand-controller

• nvram

• oscillator

• parallel

• pc-card

• pci

• pcie

• phy

• pinctrl

• pmic

• pmu

• port

• ports

• power-monitor

• pwm

• regulator

• reset-controller

• rng

• rtc

• sata

• scsi

• serial

• sound

• spi

• sram-controller

• ssi-controller

• syscon

• temperature-sensor

• timer

• touchscreen

• tpm

• usb

• usb-hub

• usb-phy

• video-codec

• vme

• watchdog

• wifi

 

이미 많이 알려진 디바이스트리는 arch/arm/boot/dts/ 에 위치하고 있으며 두 개의 확장자로 존재한다.

*.dtsi 파일은 여러 플랫폼에 공통적인 하드웨어를 설명한다. 일반적으로 *.dts 파일에서 이러한 파일을 포함한다.

*.dts 파일은 디바이스트리 소스 파일로써 하나의 특정 플랫폼을 설명한다. 이 파일은 dtc(Device tree compiler)로 컴파일 하게된다.

 

번호 제목 글쓴이 날짜 조회 수
32 STM32 & LibOpenCM3, printf함수사용 file makersweb 2019.08.08 3126
31 STM32(Cortex-M3) 개발 - Firmware Flashing file makersweb 2019.07.23 3165
30 임베디드 시스템에서 베어메탈(Bare metal) 이란? makersweb 2019.12.11 3340
29 ESP32 블루투스 스피커(A2DP Sink) file makersweb 2019.10.29 3505
28 임베디드 시스템 개발 환경 선택 makersweb 2014.03.05 3528
27 STM32(Cortex-M3) 개발환경구축 with Eclipse file makersweb 2018.11.08 3588
26 부트로더의 start.S 분석 file makersweb 2014.03.23 3613
25 yocto의 몇가지 중요한 용어 및 개념 makersweb 2019.06.21 3982
24 플랫폼 디바이스 및 디바이스 트리 makersweb 2021.03.20 4010
23 STM32(Cortex-M3) 개발환경구축 with PlatformIO file makersweb 2019.07.26 4017
22 JFlashARM으로 MCU에 bin(바이너리)다운로드 file makersweb 2015.06.07 4297
21 시리얼 인터페이스 커넥터를 위한 핀아웃 file pjk 2014.10.10 4798
20 AVR(AT90USB162)을 USB to Serial 로 이용하기 file makersweb 2015.02.14 4821
19 블루투스(Bluetooth) 기초 file makersweb 2019.08.02 4925
18 printk() makersweb 2014.02.27 5153
17 STM32와 CAN(Controller Area Network) Loop Back file makersweb 2017.01.23 5411
» 디바이스 트리(Device Tree, DT) makersweb 2020.01.12 5600
15 HelloWorld 커널 모듈과 yocto 레시피 추가 방법 file makersweb 2019.12.09 5643
14 실시간 운영 체제 또는 RTOS(Real Time Operating System) pjk 2014.12.02 5847
13 폴링(Polling), 인터럽트(Interrupt), DMA(Direct Memory Access) file pjk 2014.10.24 6012