Re: Latest EMC version


Jon et al,

If you are using the latest version of the EMC code, for Red Hat Linux
5.2/kernel 2.0.36, you need to change your scripts from what you used
for Red Hat Linux 5.0/kernel 2.0.32. Jon wrote:

> The big problem is the directory tree changed,
> and I had to find all the places where the right versions of things were
> now located.  Mostly /usr/local/emc/plat/linux_2_0_36... and plat/rtlinux_09J
> were different.

There are now two platform pairs:

emc/plat/linux
emc/plat/rtlinux

for Red Hat 5.0, with Real-Time Linux 0.6, and

emc/plat/linux_2_0_36
emc/plat/rtlinux_09J

for Red Hat 5.2, with Real-Time Linux 0.9J.

The first pair is the "original." I could have renamed these
linux_2_0_32 and rtlinux_06, respectively, but I thought it would really
screw things up.

If you have upgraded to 5.2, or installed from scratch, you need to
modify the scripts, so that plat/rtlinux becomes plat/rtlinux_09J, and
plat/linux becomes plat/linux_2_0_36. At the end of this message is a
sample script for running Matt's Bridgeport with the new platform names.
In this script I'm running my minimill stuff (minimod.o, mmio, mmtask);
the compiled code suitable for Bridgeports/Wells Index machines is
shavermod.o, shvio, and shvtask, respectively.

Jon also wrote:

> One other thing that threw me for a while is that if
> the address of the ServoToGo card is explicitly set for shavermod.o,
> it doesn't work, with a big explosion.  Apparently, this interferes with
> correctly setting the location of the shared memory region.

Note that the emc.ini file contains the base address for the physical
shared memory set aside at boot time to be shared by the RT Linux EMC
motion software (e.g., shavermod.o, minimod.o) and the user-level Linux
EMC task software (e.g., shvtask, mmtask). This is:

[EMCMOT]
SHMEM_BASE_ADDRESS =	0x3F00000

The value shown above is for memory at the 63 MB boundary, suitable for
1 MB of memory in a 64 MB system like I have. You can use:

[EMCMOT]
SHMEM_BASE_ADDRESS =	0x1F00000

for memory starting at 31 MB in a 32 MB system.

HOWEVER, this only tells the LINUX processes (e.g., shvtask) where to
find the RT Linux process. RT Linux processes can't read ini files since
they don't have access to the file system. They need to be provided with
this on the 'insmod' command line, e.g., 

insmod -f plat/rtlinux_09J/lib/shavermod.o SHMEM_BASE_ADDRESS=0x3F00000

If you omit the SHMEM_BASE_ADDRESS setting, the default of 0x1F00000 (31
MB) is used. The -f means ignore kernel version mismatches.

So, both the ini file line for SHMEM_BASE_ADDRESS and the script file
insmod argument for SHMEM_BASE_ADDRESS need to have the same value.

Note also that you can set the base address for the Servo To Go card in
the script, via another argument to insmod, e.g.,

insmod -f plat/rtlinux_09J/lib/minimod.o STG_BASE_ADDRESS=0x300

The board's default is 0x200, so if you omit it this value will be used.
Note that the ini file doesn't have an entry for this since it's only
used by RT Linux.

--Fred

-----------new script----------
!/bin/csh -f

# Script for running base controller and xemc
# on 64 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 == "mmtask" {print $1}'`
foreach pid ($pids)
  kill -INT $pid >& /dev/null
end

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

# kill motion controller
rmmod minimod >& /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/minimod.o SHMEM_BASE_ADDRESS=0x3F00000
STG_BASE_ADDRESS=0x300
if ($status != 0) goto EXIT
sleep 3
echo "...done"

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

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

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

EXIT:

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

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

# now remove kernel module
rmmod minimod

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

exit 0



Date Index | Thread Index | Back to archive index | Back to Mailing List Page

Problems or questions? Contact