Ethercat HAL driver

More
7 years 9 months ago #124306 by rwistort
Replied by rwistort on topic Ethercat HAL driver
Hello.
I have the same problem as Nico.
When it gets to
Code:
loadrt lcec
it gives
Code:
lcec: dlopen: /home/reid/linuxcnc-dev/rtlib/lcec.so: undefined symbol: ecrt_slave_config_sdo
It seems to need the functions defined in libethercat.so, but the reference is somehow missing.
What do I have to do to account for libethercat.so references when lcec runs?

It seems like there ought to be a -lethercat in the CFLAGS of the RT part of the linuxcnc-ethercat build, but I could not get it to work.

My system is
Linux charles1 4.1.42-rt50 #1 SMP PREEMPT RT Fri Aug 18 00:40:02 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
ec_debianize-master made itself normally.
Master is up and running after a boot, and ethercat command line works fine.
linuxcnc-ethercat seemed to make fine.
linuxcnc-dev is a fork of 2.8

Tantalizingly close is a tough place to be!

Reid

Please Log in or Create an account to join the conversation.

More
7 years 9 months ago #124307 by rwistort
Replied by rwistort on topic Ethercat HAL driver
Forgot to mention that ldd shows that lcec hal module references only a bare-bones set of libs, and libethercat is not among them.
Code:
~/linuxcnc-ethercat/src> ldd lcec.so linux-vdso.so.1 => (0x00007ffe57b91000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdba3114000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdba2d4a000) /lib64/ld-linux-x86-64.so.2 (0x0000559916b70000)
Hoping that helped...
Reid

Please Log in or Create an account to join the conversation.

More
7 years 9 months ago #124494 by rwistort
Replied by rwistort on topic Ethercat HAL driver
No ideas, hmmm?
I'll give you a hint.


I've attached the verbose output of a clean make of linuxcnc-ethernet. It is way too much information, but it shows that it's a uspace build, and the last line is:
Code:
gcc -shared -Bsymbolic -Wl,-rpath,/home/reid/linuxcnc-dev/lib -L/home/reid/linuxcnc-dev/lib -llinuxcnchal -lethercat -Wl,--version-script,lcec.ver -o lcec.so lcec_main.o lcec_class_enc.o lcec_generic.o lcec_ax5200.o lcec_el1xxx.o lcec_el1252.o lcec_el2521.o lcec_el2xxx.o lcec_el2202.o lcec_el31x2.o lcec_el3255.o lcec_el40x1.o lcec_el40x2.o lcec_el41x2.o lcec_el41x4.o lcec_el5101.o lcec_el5151.o lcec_el5152.o lcec_el6900.o lcec_el1904.o lcec_el2904.o lcec_el7041_1000.o lcec_el7211.o lcec_el7342.o lcec_el95xx.o lcec_em7004.o lcec_stmds5k.o lcec_deasda.o -lm
Or, to simplify:
Code:
gcc -shared -o lcec.so -lethercat -L/home/reid/linuxcnc-dev/lib ...etc...
Yes, libethercat.so exists in /home/reid/linuxcnc-dev/lib, and
Code:
~/linuxcnc-ethercat/src> nm -D lcec.so w __cxa_finalize U ecrt_domain_data U ecrt_domain_process U ecrt_domain_queue U ecrt_domain_reg_pdo_entry_list U ecrt_domain_size U ecrt_master_activate U ecrt_master_application_time U ecrt_master_create_domain U ecrt_master_deactivate U ecrt_master_read_idn U ecrt_master_receive U ecrt_master_sdo_upload U ecrt_master_send U ecrt_master_slave_config U ecrt_master_state U ecrt_master_sync_reference_clock U ecrt_master_sync_slave_clocks U ecrt_release_master U ecrt_request_master U ecrt_slave_config_complete_sdo U ecrt_slave_config_dc U ecrt_slave_config_idn U ecrt_slave_config_pdos U ecrt_slave_config_sdo U ecrt_slave_config_sdo8 U ecrt_slave_config_state U ecrt_slave_config_watchdog U free U gettimeofday w __gmon_start__ U hal_exit U hal_export_funct U hal_init U hal_malloc U hal_param_new U hal_pin_new U hal_ready w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable w _Jv_RegisterClasses U malloc U pow 00000000000053cc T rtapi_app_exit 00000000000065a2 T rtapi_app_main U rtapi_get_time 000000000021a6a0 D rtapi_info_author 000000000021a698 D rtapi_info_description 000000000021a6a8 D rtapi_info_license U rtapi_mutex_get U rtapi_mutex_give U rtapi_print_msg U rtapi_shmem_delete U rtapi_shmem_getptr U rtapi_shmem_new U rtapi_snprintf U rtapi_vsnprintf U __stack_chk_fail U strncpy ~/linuxcnc-ethercat/src>
Which confirms that the ecrt_* symbols from libethercat did not get folded into lcec.so.

I'm doing something stupid. How do I get these symbols to resolve when hal gets to loadrt lcec?

Thanks,
Reid

Please Log in or Create an account to join the conversation.

More
7 years 9 months ago #124550 by shameless
Replied by shameless on topic Ethercat HAL driver
@rwistort, I replace the src/realtime.mk with the realtime.mk in the 0.9.1 version which is found on the GitHub. It works, you can see libethercat when you ldd lcec.so. But there are other problems.
Regards!

Please Log in or Create an account to join the conversation.

More
7 years 9 months ago #124611 by Grotius
Replied by Grotius on topic Ethercat HAL driver
@Reid,

linuxcnc-dev is a fork of 2.8

I was thinking. Did you copy lcec.conf to your linuxcnc-dev bin directory?

Please Log in or Create an account to join the conversation.

More
7 years 9 months ago #124625 by rwistort
Replied by rwistort on topic Ethercat HAL driver
@Grotius
I use symbolic links in /bin and /rtlib so the binaries are always up to date. lcec_conf loads OK and its 2 pins show up in hal.

@shameless
I copied (just the) realtime.mk file from 0.9.1, and it cleared up the "undefined symbol: ecrt_slave_config_sdo" problem. Thanks!

It went on to complain about "undefined symbol: rtapi_mutex_get". This problem has shown up in this forum (see Rene 6/6/18, Nico 10/24/18, Nico 10/28/18, Hawkeye 1/10/19 step 6). So I added #include rtapi_mutex.h in lcec_main.c and changed permissions to /dev/EtherCAT0, and now both lcec_conf and lcec load, and hal is full of lcec pins to play with.
Woo hoo!

Sadly, my (one and only) servo drive exploded in a flash of sparks and smoke the other day, and I can't play with my new pins until I get it back from warranty repair. SAD!!

I am one of those people who wonders what make is really doing under all those covers, so I tried to figure out what, in the 0.9.1 config.mk, makes the difference.
When it gets right down to issuing a gcc command, the 091 and the latest gcc command for .c -> .o differs by:
Code:
common: gcc -o lcec_em7004.o -Os -g -I. -I/home/reid/linuxcnc-dev/src/include -DUSPACE -fno-fast-math -mieee-fp -fno-unsafe-math-optimizations -DRTAPI -D_GNU_SOURCE -Drealtime -D__MODULE__ -I/home/reid/linuxcnc-dev/include -DSIM -fPIC -c lcec_em7004.c 091 : -Os new : -Wframe-larger-than=2560
I doubt that this is part of the problem.

The command line for the link step .o -> .so differs by:
Code:
common: gcc -shared -o lcec.so -Wl,-rpath,/home/reid/linuxcnc-dev/lib -L/home/reid/linuxcnc-dev/lib -llinuxcnchal -lethercat [object-name-list] 091 : -lrt new : -lm -Bsymbolic -Wl,--version-script,lcec.ver
I could not figure out where, in all of make's mechanics, the "-Bsymbolic -Wl,--version-script,lcec.ver" comes from.
Their presence, though, seems to cause a 2-step link which I am totally unfamiliar with. Something like:
Code:
ld -d -r -o lcec.tmp [obj-list] objcopy -j .rtapi_export -O binary lcec.tmp lcec.sym (echo '{ global : '; tr -s '\0' < lcec.sym | xargs -r0 printf '%s;\n' | grep .; echo 'local : * ; };') > lcec.ver gcc -shared -Bsymbolic -Wl,-rpath,/home/reid/linuxcnc-dev/lib -L/home/reid/linuxcnc-dev/lib -llinuxcnchal -lethercat -lm -Wl,--version-script,lcec.ver -o lcec.so [obj-list]
Can anybody out there give us a bird's eye view of what make is trying to do here?

Admit it! We're all a little bit confused and a little bit curious!

Thanks
Reid
The following user(s) said Thank You: Nico2017

Please Log in or Create an account to join the conversation.

Time to create page: 0.180 seconds
Powered by Kunena Forum