To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1639
1638  |  1640
Subject: 
Re: undefined reference to `___ucmpsi2'
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Thu, 18 Jan 2001 20:02:09 GMT
Viewed: 
1476 times
  
Hi,

The problem is that wakeup_t is an unsigned long, and in order to save space,
the switch statement is optimized to call a library comparator, ucmpsi2.  Since
the argument to ds_scale is an unsigned int, the argument to LIGHT should also
be an unsigned int.  If you specify the argument prototype to light_found as an
unsigned int, all works fine.  You should also specify the return type of
light_found as an unsigned int too.  Another option is to add the comparator
function into lib/mint.

Pat

In lugnet.robotics.rcx.legos, Ross Crawford writes:
I get this error when linking if I have the following in my source code in a
wait_event function:

#define THRESHOLD (unsigned short)50

static wakeup_t light_found(wakeup_t sens_num) {
switch (sens_num) {
case 2:
   return (LIGHT(SENSOR_2) > THRESHOLD);
   break;
case 3:
   return (LIGHT(SENSOR_3) > THRESHOLD);
   break;
}
return 0;
}

The following works fine:

static wakeup_t light_found(wakeup_t sens_num) {
if (sens_num == 2)
   return (LIGHT(SENSOR_2) > THRESHOLD);
if (sens_num == 3)
   return (LIGHT(SENSOR_3) > THRESHOLD);
return 0;
}

Anyone know why?

Thanks

ROSCO



Message has 2 Replies:
  Re: undefined reference to `___ucmpsi2'
 
(...) Another choice may be a cast in the switch statement, like this: static wakeup_t light_found(wakeup_t sens_num) { switch ((unsigned int)sens_num) { case 2: return (LIGHT(SENSOR_2) > THRESHOLD); break; case 3: return (LIGHT(SENSOR_3) > (...) (24 years ago, 18-Jan-01, to lugnet.robotics.rcx.legos)
  Re: undefined reference to `___ucmpsi2'
 
(...) With regards to this, it appears that Markus left out two necessary functions in lib/mint. Specifically, cmpsi2 and ucmpsi2. These are a part of librcx but apparently they were omitted from LegOS when Markus included support for the other (...) (24 years ago, 19-Jan-01, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  undefined reference to `___ucmpsi2'
 
I get this error when linking if I have the following in my source code in a wait_event function: #define THRESHOLD (unsigned short)50 static wakeup_t light_found(wakeup_t sens_num) { switch (sens_num) { case 2: return (LIGHT(SENSOR_2) > THRESHOLD); (...) (24 years ago, 18-Jan-01, to lugnet.robotics.rcx.legos)

4 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR