Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RT-Thread latest version 下编译报错 #28

Open
IcyFeather233 opened this issue Jun 12, 2023 · 3 comments
Open

RT-Thread latest version 下编译报错 #28

IcyFeather233 opened this issue Jun 12, 2023 · 3 comments

Comments

@IcyFeather233
Copy link

../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function '_mpu6xxx_set_range':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:28:30: error: 'RT_SENSOR_CLASS_ACCE' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_ACCE'?
   28 |     if (sensor->info.type == RT_SENSOR_CLASS_ACCE)
      |                              ^~~~~~~~~~~~~~~~~~~~
      |                              RT_SENSOR_TYPE_ACCE
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:28:30: note: each undeclared identifier is reported only once for each function it appears in
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:45:35: error: 'RT_SENSOR_CLASS_GYRO' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_GYRO'?
   45 |     else if (sensor->info.type == RT_SENSOR_CLASS_GYRO)
      |                                   ^~~~~~~~~~~~~~~~~~~~
      |                                   RT_SENSOR_TYPE_GYRO
arm-none-eabi-gcc "../libraries/drivers/drv_sdio.c"
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function '_mpu6xxx_acc_set_mode':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:67:17: error: 'RT_SENSOR_MODE_POLLING' undeclared (first use in this function); did you mean 'RT_SENSOR_MODE_FETCH_POLLING'?
   67 |     if (mode == RT_SENSOR_MODE_POLLING)
      |                 ^~~~~~~~~~~~~~~~~~~~~~
      |                 RT_SENSOR_MODE_FETCH_POLLING
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function '_mpu6xxx_set_power':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:83:18: error: 'RT_SENSOR_POWER_DOWN' undeclared (first use in this function); did you mean 'RT_SENSOR_MODE_POWER_DOWN'?
   83 |     if (power == RT_SENSOR_POWER_DOWN)
      |                  ^~~~~~~~~~~~~~~~~~~~
      |                  RT_SENSOR_MODE_POWER_DOWN
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:96:23: error: 'RT_SENSOR_POWER_NORMAL' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_MAG'?
   96 |     else if (power == RT_SENSOR_POWER_NORMAL)
      |                       ^~~~~~~~~~~~~~~~~~~~~~
      |                       RT_SENSOR_TYPE_MAG
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function '_mpu6xxx_polling_get_data':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:111:30: error: 'RT_SENSOR_CLASS_ACCE' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_ACCE'?
  111 |     if (sensor->info.type == RT_SENSOR_CLASS_ACCE)
      |                              ^~~~~~~~~~~~~~~~~~~~
      |                              RT_SENSOR_TYPE_ACCE
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:125:35: error: 'RT_SENSOR_CLASS_GYRO' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_GYRO'?
  125 |     else if (sensor->info.type == RT_SENSOR_CLASS_GYRO)
      |                                   ^~~~~~~~~~~~~~~~~~~~
      |                                   RT_SENSOR_TYPE_GYRO
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:140:35: error: 'RT_SENSOR_CLASS_MAG' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_MAG'?
  140 |     else if (sensor->info.type == RT_SENSOR_CLASS_MAG)
      |                                   ^~~~~~~~~~~~~~~~~~~
      |                                   RT_SENSOR_TYPE_MAG
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function 'mpu6xxx_fetch_data':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:162:23: error: 'struct rt_sensor_config' has no member named 'mode'
  162 |     if (sensor->config.mode == RT_SENSOR_MODE_POLLING)
      |                       ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:162:32: error: 'RT_SENSOR_MODE_POLLING' undeclared (first use in this function); did you mean 'RT_SENSOR_MODE_FETCH_POLLING'?
  162 |     if (sensor->config.mode == RT_SENSOR_MODE_POLLING)
      |                                ^~~~~~~~~~~~~~~~~~~~~~
      |                                RT_SENSOR_MODE_FETCH_POLLING
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function 'mpu6xxx_control':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:181:10: error: 'RT_SENSOR_CTRL_SET_RANGE' undeclared (first use in this function); did you mean 'RT_SENSOR_CTRL_SOFT_RESET'?
  181 |     case RT_SENSOR_CTRL_SET_RANGE:
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
      |          RT_SENSOR_CTRL_SOFT_RESET
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:184:10: error: 'RT_SENSOR_CTRL_SET_MODE' undeclared (first use in this function); did you mean 'RT_SENSOR_CTRL_GET_ID'?
  184 |     case RT_SENSOR_CTRL_SET_MODE:
      |          ^~~~~~~~~~~~~~~~~~~~~~~
      |          RT_SENSOR_CTRL_GET_ID
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:187:10: error: 'RT_SENSOR_CTRL_SET_POWER' undeclared (first use in this function); did you mean 'RT_SENSOR_MODE_SET_POWER'?
  187 |     case RT_SENSOR_CTRL_SET_POWER:
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
      |          RT_SENSOR_MODE_SET_POWER
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:191:10: error: 'RT_SENSOR_CTRL_SET_ODR' undeclared (first use in this function); did you mean 'RT_SENSOR_CTRL_GET_ID'?
  191 |     case RT_SENSOR_CTRL_SET_ODR:
      |          ^~~~~~~~~~~~~~~~~~~~~~
      |          RT_SENSOR_CTRL_GET_ID
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function 'rt_hw_mpu6xxx_init':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:224:40: error: 'RT_SENSOR_CLASS_ACCE' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_ACCE'?
  224 |         sensor_acce->info.type       = RT_SENSOR_CLASS_ACCE;
      |                                        ^~~~~~~~~~~~~~~~~~~~
      |                                        RT_SENSOR_TYPE_ACCE
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:226:27: error: 'struct rt_sensor_info' has no member named 'model'; did you mean 'mode'?
  226 |         sensor_acce->info.model      = "mpu6xxx_acc";
      |                           ^~~~~
      |                           mode
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:229:26: error: 'struct rt_sensor_info' has no member named 'range_max'
  229 |         sensor_acce->info.range_max  = 16000;
      |                          ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:230:26: error: 'struct rt_sensor_info' has no member named 'range_min'
  230 |         sensor_acce->info.range_min  = 2000;
      |                          ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:231:26: error: 'struct rt_sensor_info' has no member named 'period_min'
  231 |         sensor_acce->info.period_min = 5;
      |                          ^
arm-none-eabi-gcc "../libraries/drivers/drv_sdram.c"
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:251:40: error: 'RT_SENSOR_CLASS_GYRO' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_GYRO'?
  251 |         sensor_gyro->info.type       = RT_SENSOR_CLASS_GYRO;
      |                                        ^~~~~~~~~~~~~~~~~~~~
      |                                        RT_SENSOR_TYPE_GYRO
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:253:27: error: 'struct rt_sensor_info' has no member named 'model'; did you mean 'mode'?
  253 |         sensor_gyro->info.model      = "mpu6xxx_gyro";
      |                           ^~~~~
      |                           mode
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:256:26: error: 'struct rt_sensor_info' has no member named 'range_max'
  256 |         sensor_gyro->info.range_max  = 2000000;
      |                          ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:257:26: error: 'struct rt_sensor_info' has no member named 'range_min'
  257 |         sensor_gyro->info.range_min  = 250000;
      |                          ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:258:26: error: 'struct rt_sensor_info' has no member named 'period_min'
  258 |         sensor_gyro->info.period_min = 5;
      |                          ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:279:39: error: 'RT_SENSOR_CLASS_MAG' undeclared (first use in this function); did you mean 'RT_SENSOR_TYPE_MAG'?
  279 |         sensor_mag->info.type       = RT_SENSOR_CLASS_MAG;
      |                                       ^~~~~~~~~~~~~~~~~~~
      |                                       RT_SENSOR_TYPE_MAG
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:281:26: error: 'struct rt_sensor_info' has no member named 'model'; did you mean 'mode'?
  281 |         sensor_mag->info.model      = "mpu6xxx_mag";
      |                          ^~~~~
      |                          mode
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:284:25: error: 'struct rt_sensor_info' has no member named 'range_max'
  284 |         sensor_mag->info.range_max  = 49120;
      |                         ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:285:25: error: 'struct rt_sensor_info' has no member named 'range_min'
  285 |         sensor_mag->info.range_min  = -49120;
      |                         ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:286:25: error: 'struct rt_sensor_info' has no member named 'period_min'
  286 |         sensor_mag->info.period_min = 100;
      |                         ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function '_mpu6xxx_set_power':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:107:1: warning: control reaches end of non-void function [-Wreturn-type]
  107 | }
      | ^
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c: In function 'mpu6xxx_fetch_data':
../packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.c:170:1: warning: control reaches end of non-void function [-Wreturn-type]
  170 | }
      | ^
arm-none-eabi-gcc "../libraries/drivers/drv_spi.c"
arm-none-eabi-gcc "../libraries/drivers/drv_usart.c"
arm-none-eabi-gcc "../libraries/drivers/drv_wlan.c"
make: *** [packages/mpu6xxx-latest/src/subdir.mk:21: packages/mpu6xxx-latest/src/sensor_inven_mpu6xxx.o] Error 1
make: *** Waiting for unfinished jobs....
../libraries/drivers/drv_common.c:16:13: warning: 'reboot' defined but not used [-Wunused-function]
   16 | static void reboot(uint8_t argc, char **argv)
      |             ^~~~~~
../libraries/drivers/drv_gpio.c:411:5: warning: initialization of 'void (*)(struct rt_device *, rt_base_t,  rt_uint8_t)' {aka 'void (*)(struct rt_device *, long int,  unsigned char)'} from incompatible pointer type 'void (*)(struct rt_device *, rt_base_t,  rt_base_t)' {aka 'void (*)(struct rt_device *, long int,  long int)'} [-Wincompatible-pointer-types]
  411 |     stm32_pin_mode,
      |     ^~~~~~~~~~~~~~
../libraries/drivers/drv_gpio.c:411:5: note: (near initialization for '_stm32_pin_ops.pin_mode')
../libraries/drivers/drv_gpio.c:412:5: warning: initialization of 'void (*)(struct rt_device *, rt_base_t,  rt_uint8_t)' {aka 'void (*)(struct rt_device *, long int,  unsigned char)'} from incompatible pointer type 'void (*)(struct rt_device *, rt_base_t,  rt_base_t)' {aka 'void (*)(struct rt_device *, long int,  long int)'} [-Wincompatible-pointer-types]
  412 |     stm32_pin_write,
      |     ^~~~~~~~~~~~~~~
../libraries/drivers/drv_gpio.c:412:5: note: (near initialization for '_stm32_pin_ops.pin_write')
../libraries/drivers/drv_gpio.c:413:5: warning: initialization of 'rt_int8_t (*)(struct rt_device *, rt_base_t)' {aka 'signed char (*)(struct rt_device *, long int)'} from incompatible pointer type 'int (*)(struct rt_device *, rt_base_t)' {aka 'int (*)(struct rt_device *, long int)'} [-Wincompatible-pointer-types]
  413 |     stm32_pin_read,
      |     ^~~~~~~~~~~~~~
../libraries/drivers/drv_gpio.c:413:5: note: (near initialization for '_stm32_pin_ops.pin_read')
../libraries/drivers/drv_gpio.c:414:5: warning: initialization of 'rt_err_t (*)(struct rt_device *, rt_base_t,  rt_uint8_t,  void (*)(void *), void *)' {aka 'long int (*)(struct rt_device *, long int,  unsigned char,  void (*)(void *), void *)'} from incompatible pointer type 'rt_err_t (*)(struct rt_device *, rt_int32_t,  rt_uint32_t,  void (*)(void *), void *)' {aka 'long int (*)(struct rt_device *, long int,  long unsigned int,  void (*)(void *), void *)'} [-Wincompatible-pointer-types]
  414 |     stm32_pin_attach_irq,
      |     ^~~~~~~~~~~~~~~~~~~~
../libraries/drivers/drv_gpio.c:414:5: note: (near initialization for '_stm32_pin_ops.pin_attach_irq')
../libraries/drivers/drv_gpio.c:416:5: warning: initialization of 'rt_err_t (*)(struct rt_device *, rt_base_t,  rt_uint8_t)' {aka 'long int (*)(struct rt_device *, long int,  unsigned char)'} from incompatible pointer type 'rt_err_t (*)(struct rt_device *, rt_base_t,  rt_uint32_t)' {aka 'long int (*)(struct rt_device *, long int,  long unsigned int)'} [-Wincompatible-pointer-types]
  416 |     stm32_pin_irq_enable,
      |     ^~~~~~~~~~~~~~~~~~~~
../libraries/drivers/drv_gpio.c:416:5: note: (near initialization for '_stm32_pin_ops.pin_irq_enable')
../libraries/drivers/drv_usart.c:643:21: warning: initialization of 'rt_ssize_t (*)(struct rt_serial_device *, rt_uint8_t *, rt_size_t,  int)' {aka 'int (*)(struct rt_serial_device *, unsigned char *, unsigned int,  int)'} from incompatible pointer type 'rt_size_t (*)(struct rt_serial_device *, rt_uint8_t *, rt_size_t,  int)' {aka 'unsigned int (*)(struct rt_serial_device *, unsigned char *, unsigned int,  int)'} [-Wincompatible-pointer-types]
  643 |     .dma_transmit = stm32_dma_transmit
      |                     ^~~~~~~~~~~~~~~~~~
../libraries/drivers/drv_usart.c:643:21: note: (near initialization for 'stm32_uart_ops.dma_transmit')
"make -j12 all" terminated with exit code 2. Build might be incomplete.

21:01:04 Build Failed. 31 errors, 9 warnings. (took 3s.933ms)

应该是因为 Sensor 库更新了,导致项目不再兼容最新版本

@mysterywolf
Copy link
Member

这个问题会在5.0.1发布之前解决掉

@spencergotowork
Copy link

这个问题会在5.0.1发布之前解决掉

有试用版本吗

@fishcooler
Copy link

使用rt-thread4.0.3版本可以用,注意rtconfig.h中使能I2C并定义传感器相关宏
/* On-chip Peripheral Drivers /
#define BSP_USING_GPIO
#define BSP_USING_UART
#define BSP_USING_UART1
#define BSP_USING_I2C1
/
Board extended module Drivers /
#define RT_USING_UART1
#define RT_USING_I2C
#define RT_USING_I2C_BITOPS
/
peripheral libraries and drivers */
#define PKG_USING_SENSORS_DRIVERS
#define PKG_USING_MPU6XXX_MAG
#define PKG_USING_MPU6XXX_GYRO
#define PKG_USING_MPU6XXX_ACCE
#define PKG_USING_MPU6XXX_GYRO

再将sensor_inven_mpu6xxx.c第22行改为 rt_uint8_t i2c_addr = (rt_uint32_t)(intf->type) & 0xff;
再将sensor_inven_mpu6xxx.c第158行改为static rt_size_t mpu6xxx_fetch_data(struct rt_sensor_device *sensor, void *buf, rt_size_t len);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants