Skip to main content
DCamp.5
Associate
September 3, 2021
Solved

Having trouble getting the stm vl53lx driver working on RPI

  • September 3, 2021
  • 4 replies
  • 1738 views

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

This topic has been closed for replies.
Best answer by John E KVAM

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

4 replies

John E KVAM
ST Employee
September 7, 2021

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
DCamp.5
DCamp.5Author
Associate
September 7, 2021

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
September 8, 2021

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.

John E KVAM
John E KVAMBest answer
ST Employee
September 20, 2021

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

DCamp.5
DCamp.5Author
Associate
September 20, 2021

Awesome - thanks for the support!