Custom component - addf failed

More
3 years 2 months ago #277313 by beefy
I tried to start my Qtplasmac config from the command line but it terminated after the following 2 lines:

HAL: ERROR: function 'MY_DEMUX_6_64.0' not found
./MY_NEXTION_PENDANT.hal:27: addf failed

As I'm also wondering if I've written anything incorrectly in my hal file, lines 26 and 27 in my hal file are:

loadrt           MY_DEMUX_6_64
addf             MY_DEMUX_6_64.0         servo-thread

MY_DEMUX_6_64.comp is my custom component and I compiled it with Halcompile on my office PC.
I copied the compiled file MY_DEMUX_6_64.so and saved it to a USB stick so I could paste it into the same directory on my plasma table PC, together with all the other .so file hal components.

Is it OK to do simply that, or should I be using Halcompile on the plasma table PC and compiling my MY_DEMUX_6_64.comp file locally ??

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

More
3 years 2 months ago #277322 by tommylight
Not sure if this is the issue, but copying files to FAT32 and EXTFAT USB sticks changes file permissions, so check permissions of that file and compare to another file in that same folder.
Or, copy the component to USB and compile it on the running PC.
Or, zip the .so file and copy to usb, this usually keeps permissions.

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

More
3 years 2 months ago #277325 by gaston48
Maybe:  ?
loadrt   MY_DEMUX_6_64  count=1

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

More
3 years 2 months ago #277328 by zdenek
What's the name of your function (entry point)? Why is the ".0" there?

I personally think the loadrt syntax is very unfortunate in doing stuff behind your back. I can suspect that the idea was to "help" folks that don't know anything about software, or worse to aid a lazy programmer. The end result is that the loadrt line makes no sense, the dynamic library contains funky function names, and there is no easy way to tell what's going on.
I would really like to see this stuff cleaned up -- I noticed the problem the first time I attempted writing a custom HAL function, but didn't want to raise it until someone else struggles as I observed that cleaning stuff in LinuxCNC is not something that is done often.

Anyone interested in discussing the topic?

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

More
3 years 2 months ago - 3 years 2 months ago #277343 by chris@cnc
I'm not sure why you're so unhappy.
If you program in FUB or with Ladder you must also load and name your functions. It would not be good to load all functions in real time by default. So you choose what you need.
For understanding, i take and function.
loadrt and2 count=2  "load realtime function 2 times"
important information in my eyes.

addf and2.0 servo thread "add the function named and2.0 to the servo thread"
addf and2.1 servo thread "add the function named and2.1 to the servo thread"

they could also be named and2.spindle and and2.cyclestart. The loadrt and addf lines should then be like this
Code:
loadrt and2 names=and2.spindle,and2.cyclestart addf and2.spindle       servo thread addf and2.cyclestart   servo-thread
 
I think it's really cool and leaves a lot of options open.

more information is here
linuxcnc.org/docs/stable/html/hal/intro.html
linuxcnc.org/docs/stable/html/hal/basic-hal.html#_loadrt
linuxcnc.org/docs/stable/html/hal/rtcomps.html
linuxcnc.org/docs/stable/html/hal/tutorial.html
or the complete guide in the LinuxCNC Documentation, Chapter 5
file:///usr/share/doc/linuxcnc/LinuxCNC_Documentation.pdf
 
Last edit: 3 years 2 months ago by chris@cnc.

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

More
3 years 2 months ago #277347 by chris@cnc

I tried to start my Qtplasmac config from the command line but it terminated after the following 2 lines:


Is it OK to do simply that, or should I be using Halcompile on the plasma table PC and compiling my MY_DEMUX_6_64.comp file locally ??

Yes, it could be a problem of user rights, but it should not be a big deal to try.
sudo halcompile --install MY_DEMUX_6_64.comp

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

Time to create page: 0.151 seconds
Powered by Kunena Forum