各位朋友,有谁在uboot 下使用了i2c么?
我首先在menuconfig 打开命令行i2c。
编译却报错:
CC cmd/gpio.o
CC cmd/i2c.o
cmd/i2c.c: In function ‘i2c_get_bus_speed’:
cmd/i2c.c:211:9: error: ‘CONFIG_SYS_I2C_SPEED’ undeclared (first use in this function); did you mean ‘CONFIG_SYS_I2C_SLAVE’?
return CONFIG_SYS_I2C_SPEED;
^~~~~~~~~~~~~~~~~~~~
CONFIG_SYS_I2C_SLAVE
cmd/i2c.c:211:9: note: each undeclared identifier is reported only once for each function it appears in
cmd/i2c.c: In function ‘i2c_set_bus_speed’:
cmd/i2c.c:230:15: error: ‘CONFIG_SYS_I2C_SPEED’ undeclared (first use in this function); did you mean ‘CONFIG_SYS_I2C_SLAVE’?
if (speed != CONFIG_SYS_I2C_SPEED)
^~~~~~~~~~~~~~~~~~~~
CONFIG_SYS_I2C_SLAVE
cmd/i2c.c: In function ‘do_i2c_reset’:
cmd/i2c.c:1925:11: error: ‘CONFIG_SYS_I2C_SPEED’ undeclared (first use in this function); did you mean ‘CONFIG_SYS_I2C_SLAVE’?
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
^~~~~~~~~~~~~~~~~~~~
CONFIG_SYS_I2C_SLAVE
cmd/i2c.c: In function ‘i2c_get_bus_speed’:
cmd/i2c.c:212:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make[1]: *** [cmd/i2c.o] Error 1
make: *** [cmd] Error 2
离线
不是光打开i2c命令就行,要到drivers的路径下,将i2c的驱动等一系列东西启用才行
离线