compiling my component

More
30 Nov 2013 05:56 #41231 by rwistort
I'm writing a hal component in c, and I used stepgen.c as a template for how to structure it.
Call it "vision.c".
It compiles fine with 'comp --install vision.c' and shows up in rtlib/vision.ko.

When I enable it in my hal file with
loadrt vision eye_type=f,f
I get:
work.hal:171: child did not exit normally
work.hal:171: insmod failed, returned -1

When I try to start emc again, I'm told that the module is already loaded.

Re-booting my machine returns me from 'already loaded' to 'did not exit normally.'
Removing 'loadrt vision' from my hal file (and rebooting) gives me a working system, but without my component.

rmmod vision produces:
ERROR: Module vision is in use

lsmod | grep hal produces:
hal_lib                30517  1 vision
rtapi                  30079  2 vision,hal_lib
rtai_hal              186236  4 rtapi,rtai_sem,rtai_fifos,rtai_sched

dmesg | grep hal gives:
[ 1060.520594] Modules linked in: vision(+) hal_parport stepgen motmod trivkins hal_lib rtapi rtai_math rtai_sem 
rtai_fifos rtai_sched rtai_hal binfmt_misc snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss 
snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi fbcon tileblit font bitblit snd_rawmidi softcursor 
snd_seq_midi_event vga16fb vgastate snd_seq snd_timer nouveau snd_seq_device ttm drm_kms_helper ppdev snd 
psmouse drm usblp serio_raw agpgart soundcore parport_pc i2c_algo_bit snd_page_alloc lp i2c_nforce2 parport usbhid 
[b][/b]hid usb_storage ahci r8169 mii pata_amd [last unloaded: rtai_hal]

Even though vision.c is waaay less complicated than stepgen, I note that the .ko file sizes are:
stepgen: 12777
vision: 96889

I'm on Lucid 10.04 and would appreciate anyone's advice.
Thanks,
Reid

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

More
30 Nov 2013 08:48 #41235 by andypugh
Replied by andypugh on topic compiling my component

work.hal:171: child did not exit normally
work.hal:171: insmod failed, returned -1
When I try to start emc again, I'm told that the module is already loaded.

Sadly that is normal. Crashing HAL components tend to leave the system in a state that can only be fixed by a reboot. This is partly because they are kernel modules.

Even though vision.c is waaay less complicated than stepgen, I note that the .ko file sizes are:
stepgen: 12777
vision: 96889


That is strange, but could be explained if you have the -g debugging flag set. Quite how that could happen with comp I am not entirely sure, but perhaps it is the default in comp?

It is hard to guess at the source of the problem, but it is imperative that the component name and the file name match, or problems like this happen. it is certainly the first thing to check.
The following user(s) said Thank You: rwistort

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

More
02 Dec 2013 12:57 #41290 by rwistort
Replied by rwistort on topic compiling my component
Naturally, it turned out that I had the usual null pointers and such. My code is in much better shape now that I understand better how to work within the constraints of a component.
It's good to know someone's got my back.
Thanks,
Reid

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

Time to create page: 0.106 seconds
Powered by Kunena Forum