Subject:
|
Re: undefined reference to `___ucmpsi2'
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Fri, 19 Jan 2001 18:14:42 GMT
|
Viewed:
|
1577 times
|
| |
| |
Pat Welch <legos@mousebrains.com> wrote:
> Another option is to add the comparator function into lib/mint.
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 integer math ops. Or maybe I hadn't implemented them
yet when Markus included integer math op support.
I have appended both files below. They should be added to lib/mint and the
appropriate Makefiles.
-Kekoa
--- cmpsi2.c ---
/*
* cmpsi2.c
*
* Implementation of cmpsi2, a 32-bit signed compare: r0r1 <=> r2r3
* Returns -1, 0, or 1, which might not be correct.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Librcx code, released February 9, 1999.
*
* The Initial Developer of the Original Code is Kekoa Proudfoot.
* Portions created by Kekoa Proudfoot are Copyright (C) 1999
* Kekoa Proudfoot. All Rights Reserved.
*
* Contributor(s): Kekoa Proudfoot <kekoa@graphics.stanford.edu>
*/
__asm__ ("
.section .text
.global ___cmpsi2
___cmpsi2:
sub.w r3,r1
subx.b r2l,r0l
subx.b r2h,r0h
blt else_0
beq else_1
; First operand greater than second operand
mov.w #1,r0
rts
else_1:
; First operand equal to second operand
sub.w r0,r0
rts
endif_1:
else_0:
; First operand less than second operand
mov.w #-1,r0
rts
endif_0:
; Not reached
");
--- end ---
--- ucmpsi2.c ---
/*
* ucmpsi2.c
*
* Implementation of ucmpsi2, a 32-bit unsigned compare: r0r1 <=> r2r3
* Returns -1, 0, or 1, which might not be correct.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Librcx code, released February 9, 1999.
*
* The Initial Developer of the Original Code is Kekoa Proudfoot.
* Portions created by Kekoa Proudfoot are Copyright (C) 1999
* Kekoa Proudfoot. All Rights Reserved.
*
* Contributor(s): Kekoa Proudfoot <kekoa@graphics.stanford.edu>
*/
__asm__ ("
.section .text
.global ___ucmpsi2
___ucmpsi2:
sub.w r3,r1
subx.b r2l,r0l
subx.b r2h,r0h
blo else_0
beq else_1
; First operand greater than second operand
mov.w #1,r0
rts
else_1:
; First operand equal to second operand
sub.w r0,r0
rts
endif_1:
else_0:
; First operand less than second operand
mov.w #-1,r0
rts
endif_0:
; Not reached
");
--- end ---
|
|
Message is in Reply To:
| | Re: undefined reference to `___ucmpsi2'
|
| 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 (...) (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
|
|
|
|