CAD CAM EDM DRO - Yahoo Group Archive

Re: Linux vs. DOS

Posted by Jon Elson
on 1999-05-31 22:58:57 UTC
Tim Goldstein wrote:

> Next I switch to /usr/local/nist/emc and enter the command ./run.mystepper
> This seems to start out fine and I see starting emc and then installing
> motion module. Then I get the following error message:
> segmentation fault
> rmmod: steppermod: devise or resource busy
> rmmod: rtl_sched is in use
> And that is where it leaves me.
>
> If I then enter lsmod I see steppermod and rtl_sched in the list with the
> previous 2 entries. steppermod is marked as [uninitialized]. If I try rmmod
> manually, I get the error noted above.

Ok, there are a few things that will become clearer after I explain the
behavior. then I'll tell you what is the most likely cause.

kernel modules need to execute some sort of initialization code before
they are accepted by the system as functional. Wow, that Linus and
his team are sure smart! That prevents that seg fault from becoming
a system crash! The kernel module here is having some sort of
problem, and does not complete it's own initialization, thus the
[uninitialized] state. Due to that, nobody can use the module.
A side effect, is that the module can't be removed, either.
the only way to get rid of it is to reboot. You can, however,
rename the .o file for the module, and then insmod that, once
you figure out the problem. but, that is a mess.

What is the most likely cause of the problem is that the command
line parameter specifying the starting location of the shared memory
area does not match any memory area left unused by Linux.
You have to make a special kernel boot entry in LILO to
boot your real-time kernel with a limit on the memory it is to
use. generally, if you have 32MB on your system, you would
tell LILO to boot the kernel with only 31MB, leaving the
top MB unused by Linux. This is explained in one of the
readme files.
the entry in /etc/lilo.conf would look like this :
image=/boot/rtlinuz
label=rtlinux
root=/dev/hda3
append="mem=31m"

then run lilo to update the boot info.

Then, you specify in the command line that installs the module,
the hex address of the start of the shared mem area.
note where the following text appears :
SHMEM_BASE_ADDRESS=0x1F00000


***** Here is my run.xemc file *****
#!/bin/csh -f

# Script for running Elson base controller and xemc
# on 32 MB Linux/RT-Linux system for NIST minimill
# with STG board strapped to 0x300

# name of lock file
set lockfile = /tmp/emc.lock

# 'started' is flag that's set only if we create lock file, so
# if we get ^C we won't delete a previous lock file
set started = 0

onintr EXIT

# check for lock file
if (-f $lockfile) then
echo -n "emc is running-- restart it? [y/n] "
set input = $<
if ($input == y || $input == Y) then
echo cleaning up old emc...
else
echo not starting new emc
exit 0
endif
else
echo starting emc...
endif

# create the lock file
touch $lockfile

# and mark that we created it
set started = 1

# kill any xemcs lying around
set pids = `ps ac | awk '$5 == "xemc" {print $1}'`
foreach pid ($pids)
kill -INT $pid >& /dev/null
end

# kill any mmtasks lying around
set pids = `ps ac | awk '$5 == "shvtask" {print $1}'`
foreach pid ($pids)
kill -INT $pid >& /dev/null
end

# kill any mmios lying around
set pids = `ps ac | awk '$5 == "shvio" {print $1}'`
foreach pid ($pids)
kill -INT $pid >& /dev/null
end

# kill motion controller
rmmod shavermod >& /dev/null

# wait a bit for old emc to go away
sleep 3

# install motion module in kernel
echo "installing motion module..."
insmod -f plat/rtlinux_09J/lib/shavermod.o SHMEM_BASE_ADDRESS=0x1F00000
if ($status != 0) goto EXIT
sleep 3
echo "...done"

# run mmio in background
echo "spawning mmio..."
plat/linux_2_0_36/bin/shvio -ini elsonmills.ini &
sleep 6
echo "...done"

# run mmtask in background
echo "spawning mmtask..."
plat/linux_2_0_36/bin/shvtask -ini elsonmills.ini &
sleep 6
echo "...done"

# run xemc in foreground
plat/linux_2_0_36/bin/xemc -ini elsonmills.ini

EXIT:

# stop mmtask
set pids = `ps ac | awk '$5 == "shvtask" {print $1}'`
foreach pid ($pids)
kill -INT $pid
end

# stop mmio
set pids = `ps ac | awk '$5 == "shvio" {print $1}'`
foreach pid ($pids)
kill -INT $pid
end

# now remove kernel module
rmmod shavermod

# remove the lock file, if we create it
if ($started == 1) then
\rm -f $lockfile
endif

exit 0

***** end of run.xemc file *****


Note that the SHMEM_BASE_ADDRESS is also set in the .ini
file, so that the programs that run in the Linux environment can
read them from this file.

***** elsonmills.ini file *****

; EMC controller parameters for Shaver Bridgeport
; Differences include:
; PARPORT_IO_ADDRESS = 0x378, for builtin parallel port
; SHMEM_BASE_ADDRESS = 0x3F00000, for 63 MB base address
; PROGRAM_PREFIX = programs/, for usual case
; HOME_SWITCH_POLARITY = 1, so they float closed

[EMC]
VERSION = $Revision: 1.5 $
MACHINE = Elson Bridgeport fast traj, 1KHz
NML_FILE = emc.nml
PARPORT_IO_ADDRESS = 0x378

[EMCMOT]
; SHMEM_KEY and SHMEM_BASE_ADDRESS can't be read by emcmot, so if you change
; them here from their compile defaults in emcmotcfg.h, change the scripts
; to pass them as command line arguments, e.g.,
;
; 'insmod emcmotmod.o SHMEM_KEY=101 SHMEM_BASE_ADDRESS=0xF00000
;
; or
;
; 'emcmotsim SHMEM_KEY=101 SHMEM_BASE_ADDRESS=0xF00000'
;
; Note that changing SHMEM_BASE_ADDRESS will also require setting up shared
; memory by editing /etc/lilo.conf and re-running /sbin/lilo
SHMEM_KEY = 100
SHMEM_BASE_ADDRESS = 0x1F00000

; these are not used by emcmot and thus need only be changed here
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010

[RS274NGC]
VARIABLE_FILE = rs274ngc.var

[DISPLAY]
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL

[TASK]
CYCLE_TIME = 0.020
PROGRAM_PREFIX = /usr/elson/nmlwrite/

[TRAJ]
AXES = 3
LINEAR_UNITS = 0.03937007874016
ANGULAR_UNITS = 1.0
CYCLE_TIME = 0.005
DEFAULT_VELOCITY = 3.0
DEFAULT_ACCELERATION = 2.0
MAX_VELOCITY = 3.0
MAX_ACCELERATION = 2.0

[AXIS_0]
TYPE = LINEAR
UNITS = 0.03937007874016
P = 100.000
I = 0.250
D = 0.150
FF0 = 0.000
FF1 = 5.000
FF2 = 0.000
BACKLASH = 0.000
BIAS = 0.000
MAX_ERROR = 50.000
CYCLE_TIME = 0.001
; note-- changed input scale from -10000 to 10000, for motor test stand
INPUT_SCALE = 20000 0
OUTPUT_SCALE = 1.000 0.000
MIN_LIMIT = -36
MAX_LIMIT = 36
MIN_OUTPUT = -10
MAX_OUTPUT = 10
HOMING_VEL = 0.1
FERROR = 0.075
ENABLE_POLARITY = 1
MIN_LIMIT_SWITCH_POLARITY = 1
MAX_LIMIT_SWITCH_POLARITY = 1
HOME_SWITCH_POLARITY = 1
HOMING_POLARITY = 1
FAULT_POLARITY = 0

[AXIS_1]
TYPE = LINEAR
UNITS = 0.03937007874016
P = 100.000
I = 0.250
D = 0.150
FF0 = 0.000
FF1 = 5.000
FF2 = 0.000
BACKLASH = 0.000
BIAS = 0.000
MAX_ERROR = 50.000
CYCLE_TIME = 0.001
INPUT_SCALE = 20000 0
OUTPUT_SCALE = 1.000 0.000
MIN_LIMIT = -36
MAX_LIMIT = 36
MIN_OUTPUT = -10
MAX_OUTPUT = 10
HOMING_VEL = 0.1
FERROR = 0.075
ENABLE_POLARITY = 1
MIN_LIMIT_SWITCH_POLARITY = 1
MAX_LIMIT_SWITCH_POLARITY = 1
HOME_SWITCH_POLARITY = 1
HOMING_POLARITY = 1
FAULT_POLARITY = 0

[AXIS_2]
TYPE = LINEAR
UNITS = 0.03937007874016
P = 100.000
I = 0.050
D = 0.050
FF0 = 0.000
FF1 = 3.750
FF2 = 0.000
BACKLASH = 0.000
BIAS = 0.000
MAX_ERROR = 50.000
CYCLE_TIME = 0.001
INPUT_SCALE = 40000 0
OUTPUT_SCALE = 1.000 0.000
MIN_LIMIT = -8
MAX_LIMIT = 8
MIN_OUTPUT = -10
MAX_OUTPUT = 10
HOMING_VEL = 0.1
FERROR = 0.050
ENABLE_POLARITY = 1
MIN_LIMIT_SWITCH_POLARITY = 1
MAX_LIMIT_SWITCH_POLARITY = 1
HOME_SWITCH_POLARITY = 1
HOMING_POLARITY = 1
FAULT_POLARITY = 0

[EMCIO]
; section for main IO controller parameters

; cycle time, in seconds
CYCLE_TIME = 0.100

; tool controller
TOOL_TABLE = tool.tbl

; wait times in seconds for spindle brake, release

SPINDLE_OFF_WAIT = 1.0
SPINDLE_ON_WAIT = 1.5

; external digital inputs, outputs are always 0 for 0V, 1 for 5/24V

; digital in bits

ESTOP_SENSE_INDEX = 1
LUBE_SENSE_INDEX = 2

; digital in polarity, 0 is inverted, 1 is normal
; controller compares with polarity, equal means on, not equal means off

ESTOP_SENSE_POLARITY = 1
LUBE_SENSE_POLARITY = 1

; digital out bits

SPINDLE_FORWARD_INDEX = 1
SPINDLE_REVERSE_INDEX = 0
MIST_COOLANT_INDEX = 6
FLOOD_COOLANT_INDEX = 7
SPINDLE_DECREASE_INDEX = 8
SPINDLE_INCREASE_INDEX = 9
ESTOP_WRITE_INDEX = 10
SPINDLE_BRAKE_INDEX = 11

; digital out polarity, 0 is inverted, 1 is normal
; controller writes the polarity to turn on, opposite of polarity to turn off

SPINDLE_FORWARD_POLARITY = 0
SPINDLE_REVERSE_POLARITY = 0
MIST_COOLANT_POLARITY = 0
FLOOD_COOLANT_POLARITY = 0
SPINDLE_DECREASE_POLARITY = 1
SPINDLE_INCREASE_POLARITY = 1
ESTOP_WRITE_POLARITY = 1
SPINDLE_BRAKE_POLARITY = 0

***** end of emc.ini file *****

I hope some of this info clears up your most recent problem.
(Then, we can work on the next ones! But, actually, you are
REAL close, now, to getting it all working!)

Jon

Discussion Thread

Andrew Werby 1999-05-29 04:16:11 UTC Linux vs. DOS john@x... 1999-05-29 15:07:09 UTC Re: Linux vs. DOS Jon Elson 1999-05-29 21:21:47 UTC Re: Linux vs. DOS Matt Shaver 1999-05-29 21:29:06 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-29 22:27:47 UTC Re: Linux vs. DOS Matt Shaver 1999-05-30 00:12:13 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-30 15:39:08 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-30 20:37:55 UTC Re: Linux vs. DOS Matt Shaver 1999-05-30 20:35:33 UTC Re: Linux vs. DOS Matt Shaver 1999-05-30 20:48:44 UTC Re: Linux vs. DOS Jon Elson 1999-05-30 23:19:07 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-31 11:54:03 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-31 11:54:07 UTC Re: Linux vs. DOS Matt Shaver 1999-05-31 12:12:57 UTC Re: Linux vs. DOS Matt Shaver 1999-05-31 12:17:39 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-31 13:30:23 UTC Re: Linux vs. DOS Matt Shaver 1999-05-31 14:13:26 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-31 16:00:38 UTC Re: Linux vs. DOS Matt Shaver 1999-05-31 16:00:51 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-31 17:32:03 UTC Re: Linux vs. DOS Matt Shaver 1999-05-31 17:33:17 UTC Re: Linux vs. DOS Matt Shaver 1999-05-31 17:43:39 UTC Re: Linux vs. DOS Dan Falck 1999-05-31 19:55:12 UTC Re: Linux vs. DOS Matt Shaver 1999-05-31 22:48:46 UTC Re: Linux vs. DOS Jon Elson 1999-05-31 22:58:57 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-31 23:32:27 UTC Re: Linux vs. DOS Tim Goldstein 1999-05-31 23:32:29 UTC Re: Linux vs. DOS Matt Shaver 1999-05-31 23:32:50 UTC Re: Linux vs. DOS Matt Shaver 1999-06-01 00:38:11 UTC Re: Linux vs. DOS Dan Mauch 1999-06-01 06:32:41 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-01 09:45:52 UTC Re: Linux vs. DOS Jon Elson 1999-06-01 12:16:50 UTC Re: Linux vs. DOS Ian W. Wright 1999-06-01 12:37:43 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-01 17:03:26 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-01 22:05:54 UTC Re: Linux vs. DOS Dan Mauch 1999-06-02 06:30:25 UTC Re: Linux vs. DOS Dan Mauch 1999-06-02 06:42:14 UTC Re: Linux vs. DOS Buchanan, James (Jim) 1999-06-02 13:01:09 UTC Re: Linux vs. DOS Jon Elson 1999-06-02 13:33:07 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-02 14:26:20 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-02 14:45:01 UTC Re: Linux vs. DOS Matt Shaver 1999-06-02 15:01:17 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-02 23:19:44 UTC Re: Linux vs. DOS Matt Shaver 1999-06-03 00:26:35 UTC Re: Linux vs. DOS Ian W. Wright 1999-06-04 13:47:19 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-05 16:54:15 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-05 17:34:22 UTC Re: Linux vs. DOS Jon Elson 1999-06-05 23:39:08 UTC Re: Linux vs. DOS Jon Elson 1999-06-05 23:41:51 UTC Re: Linux vs. DOS Matt Shaver 1999-06-05 23:42:39 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-06 00:03:27 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-06 00:30:52 UTC Re: Linux vs. DOS Matt Shaver 1999-06-06 01:00:46 UTC Re: Linux vs. DOS Matt Shaver 1999-06-06 01:37:57 UTC Re: Linux vs. DOS Dan Falck 1999-06-06 05:51:38 UTC Re: Linux vs. DOS Jon Elson 1999-06-06 17:16:33 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-06 21:05:20 UTC Re: Linux vs. DOS Matt Shaver 1999-06-06 22:06:24 UTC Re: Linux vs. DOS Matt Shaver 1999-06-06 22:30:17 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-06 22:57:18 UTC Re: Linux vs. DOS Matt Shaver 1999-06-06 23:16:03 UTC Re: Linux vs. DOS Jon Elson 1999-06-06 23:29:41 UTC Re: Linux vs. DOS Jon Elson 1999-06-06 23:46:32 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-07 21:59:53 UTC Re: Linux vs. DOS Tim Goldstein 1999-06-08 22:07:54 UTC Re: Linux vs. DOS Dan Mauch 1999-06-09 06:18:23 UTC Re: Linux vs. DOS