cancel
Showing results for 
Search instead for 
Did you mean: 

Having trouble getting the stm vl53lx driver working on RPI

DCamp.5
Associate II

Hi - I can't seem to get the driver to compile on a RPi 3+..

Grateful for any assistance !!

This is the error message I get:

pi@raspberrypi:~/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx $ make VL53LX_FULL_KERNEL=1

CONFIG_STMVL53LX=m make -C /lib/modules/`uname -r`/build M=$PWD

make[1]: Entering directory '/usr/src/linux-headers-5.10.17-v7+'

 CC [M] /home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.o

In file included from /home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c:49:

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx.h:208:17: error: field ‘start_tv’ has incomplete type

 struct timeval start_tv;/*!< stream start time */

         ^~~~~~~~

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx.h:240:18: error: field ‘start_tv’ has incomplete type

  struct timeval start_tv;

         ^~~~~~~~

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx.h:241:18: error: field ‘comp_tv’ has incomplete type

  struct timeval comp_tv;

         ^~~~~~~

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c: In function ‘st_gettimeofday’:

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c:103:4: error: dereferencing pointer to incomplete type ‘struct timeval’

 tv->tv_sec = now.tv_sec;

  ^~

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c: In function ‘stmvl53lx_intr_process’:

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c:2414:17: error: storage size of ‘tv_now’ isn’t known

 struct timeval tv_now;

         ^~~~~~

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c:2414:17: warning: unused variable ‘tv_now’ [-Wunused-variable]

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c: In function ‘stmvl53lx_input_push_data_multiobject’:

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c:2508:17: error: storage size of ‘tv’ isn’t known

 struct timeval tv;

         ^~

/home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.c:2508:17: warning: unused variable ‘tv’ [-Wunused-variable]

make[2]: *** [scripts/Makefile.build:279: /home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx/stmvl53lx_module.o] Error 1

make[1]: *** [Makefile:1804: /home/pi/VL53L3CX_LinuxDriver_1.0.5_bare_1.2.4/driver/vl53Lx] Error 2

make[1]: Leaving directory '/usr/src/linux-headers-5.10.17-v7+'

make: *** [Makefile:8: default] Error 2

1 ACCEPTED SOLUTION

Accepted Solutions
John E KVAM
ST Employee

Well it sure looks like you were right.

And it took my team a bit to solve it.

They had to rework a bit the deprecated timeval structure to make it work in both old kernel and 5.10.X

I2c_new_device function has been deprecated too, the modified files use i2c_new_client_device

Future releases will include these changes


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

View solution in original post

5 REPLIES 5
John E KVAM
ST Employee

Something is really odd. I downloaded a fresh copy of STSW_IMG0021 and looked for start_tv.

it's not in there. Nor are there any instances of "_tv".

So I'm very confused.

I might consider starting over with a fresh download.

  • john

If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
DCamp.5
Associate II

Hi John, thanks I did as you suggested but still have the same error. As per the error messages - most of these reference can be found in stmvl53l.h

John E KVAM
ST Employee

0693W00000DmaMQQAZ.pngSeems there is a known problem compiling struct timeval with 5.x kernels:

https://github.com/draios/sysdig/issues/1609

I'm going to investigate what to do about it. I have not run across this before.


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
John E KVAM
ST Employee

Well it sure looks like you were right.

And it took my team a bit to solve it.

They had to rework a bit the deprecated timeval structure to make it work in both old kernel and 5.10.X

I2c_new_device function has been deprecated too, the modified files use i2c_new_client_device

Future releases will include these changes


If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.

Awesome - thanks for the support!