micro-ROS / nuttx_apps

Other
10 stars 13 forks source link

Telemetry compilation fails #2

Closed iluetkeb closed 5 years ago

iluetkeb commented 6 years ago

When I enable the telemetry app, compilation fails with the following error:

make[2]: Entering directory '/home/lui3si/src/ros2_ws/src/apps/examples/telemetry'
CC:  telemetry_main.c
telemetry_main.c: In function ‘telemetry_main’:
telemetry_main.c:134:14: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
    fd_sensor = open("/dev/ina219", O_RDWR);
              ^
telemetry_main.c:149:37: error: invalid application of ‘sizeof’ to incomplete type ‘struct ina219_s’
      read(fd_sensor, &sample, sizeof(sample));
                                     ^
telemetry_main.c:149:11: warning: passing argument 1 of ‘read’ makes integer from pointer without a cast [-Wint-conversion]
      read(fd_sensor, &sample, sizeof(sample));
           ^
In file included from /home/lui3si/src/ros2_ws/src/NuttX/include/pthread.h:51:0,
                 from /home/lui3si/src/ros2_ws/src/NuttX/include/nuttx/sched.h:50,
                 from /home/lui3si/src/ros2_ws/src/NuttX/include/sched.h:48,
                 from /home/lui3si/src/ros2_ws/src/NuttX/include/stdio.h:47,
                 from telemetry_main.c:41:
/home/lui3si/src/ros2_ws/src/NuttX/include/unistd.h:163:9: note: expected ‘int’ but argument is of type ‘FILE * {aka struct file_struct *}’
 ssize_t read(int fd, FAR void *buf, size_t nbytes);
         ^
telemetry_main.c:172:6: error: invalid use of undefined type ‘struct ina219_s’
      sample.voltage,sample.current,cpuload_buf,i);
      ^
telemetry_main.c:172:6: error: invalid use of undefined type ‘struct ina219_s’
telemetry_main.c:196:10: warning: passing argument 1 of ‘close’ makes integer from pointer without a cast [-Wint-conversion]
    close(fd_sensor);
          ^
In file included from /home/lui3si/src/ros2_ws/src/NuttX/include/pthread.h:51:0,
                 from /home/lui3si/src/ros2_ws/src/NuttX/include/nuttx/sched.h:50,
                 from /home/lui3si/src/ros2_ws/src/NuttX/include/sched.h:48,
                 from /home/lui3si/src/ros2_ws/src/NuttX/include/stdio.h:47,
                 from telemetry_main.c:41:
/home/lui3si/src/ros2_ws/src/NuttX/include/unistd.h:158:5: note: expected ‘int’ but argument is of type ‘FILE * {aka struct file_struct *}’
 int     close(int fd);
     ^
/home/lui3si/src/ros2_ws/src/apps/Application.mk:89: recipe for target 'telemetry_main.o' failed
make[2]: *** [telemetry_main.o] Error 1
make[2]: Leaving directory '/home/lui3si/src/ros2_ws/src/apps/examples/telemetry'
Makefile:93: recipe for target 'examples/telemetry_all' failed
make[1]: *** [examples/telemetry_all] Error 2
make[1]: Leaving directory '/home/lui3si/src/ros2_ws/src/apps'
LibTargets.mk:174: recipe for target '../apps/libapps.a' failed
make: *** [../apps/libapps.a] Error 2
jfm92 commented 6 years ago

Hi Ingo,

Maybe it's a problem of configuration, please use the telemetry config profile to make sure that you're using the right config.

If you're using the docker container you should type the next command to configure it:

Thanks.

iluetkeb commented 6 years ago

Ah, I've been trying to compile for simulation.

I think you're meant to use "depends" statements in the config for your app to declare requirements on particular devices. This will then disable the option to compile your app if the device is not also selected.

jfm92 commented 6 years ago

Hi, I think that in the simulator you can't use drivers that use peripheral, so I recommend you to use a board, because the simulator have very little functionality. Thank you for the suggestion, the app is still in a early stage of development.

imuguruza commented 5 years ago

Old, we have changed the app. Closing