我试图按照此处的说明进行操作:
Device tree compiler not recognizes C syntax for include files
我能够构建预处理文件,但是当我尝试使用dtc将此文件编译为dtb时,出现此错误:
pi@raspberrypi:~ $ sudo dtc -I dts -O dtb test2.dts.preprocessed -o test2.dtb
Error: /usr/include/stdint.h:36.1-8 syntax error
FATAL ERROR: Unable to parse input tree
我以这种方式编译了预处理文件:
cpp -nostdinc -I /usr/include -I /usr/include/linux -I /usr/include/linux/bcm2835-1.58/src -I /usr/include/arm-linux-gnueabihf/gnu -I/usr/include/arm-linux-gnueabihf -I arch -I -undef -x assembler-with-cpp test2.dts test2.dts.preprocessed
默认的dts文件如下:
// Definitions for HiFiBerry DAC
// Definitions for audiosense add on soundcard
/dts-v1/;
/plugin/;
#include "stubs-hard.h"
#include "stubs.h"
#include "bcm2835.h"
#include "gpio.h"
/ {
compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target = <&sound>;
__overlay__ {
compatible = "hifiberry,hifiberry-dac", "as,audiosense-pi";
i2s-controller = <&i2s>;
status = "okay";
};
};
fragment@1 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target-path = "/";
__overlay__ {
pcm5102a-codec {
#sound-dai-cells = <0>;
compatible = "ti,pcm5102a";
status = "okay";
};
codec_reg_1v8: codec-reg-1v8 {
compatible = "regulator-fixed";
regulator-name = "tlv320aic3204_1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
};
};
fragment@3 {
target = <&gpio>;
__overlay__ {
codec_rst: codec-rst {
brcm,pins = <26>;
brcm,function = <BCM2835_FSEL_GPIO_OUT>;
};
};
};
fragment@4 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
/* audio external oscillator */
codec_osc: codec_osc {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <12000000>; /* 12 MHz */
};
codec: tlv320aic32x4@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic32x4";
reg = <0x18>;
clocks = <&codec_osc>;
clock-names = "mclk";
iov-supply = <&vdd_3v3_reg>;
ldoin-supply = <&vdd_3v3_reg>;
gpio-controller;
#gpio-cells = <2>;
reset-gpios = <&gpio 26 GPIO_ACTIVE_HIGH>;
status = "okay";
};
};
};
};
那我在哪里做过mmistake?