Strange Compile Problem....
2004-10-06 by Pete
Hi,
Wondering if anyone can shed some light on this...
using Keil and the GNU compiler for LPC2114.
I have a function that it to output a value to the terminal and
converts it to a decimal in ASCII Characters, and the length of this
can be determined by the function call.
Anyway, the following compile error results:
"
.\flash\terminal_fncs.o(.text+0xe38): In function `Print_DEC':
: undefined reference to `__udivsi3'
.\flash\terminal_fncs.o(.text+0xe6c): In function `Print_DEC':
: undefined reference to `__umodsi3'
collect2: ld returned 1 exit status
Target not created
"
I have commented out line by line and found 3 culprit lines they are
marked with comments indicating they are a problem,. and the entire
function can be seen here:
void Print_DEC(unsigned int value,unsigned int order)
{
unsigned char trailing_spaces; // how many spaces to pad at end
unsigned char digit_flag; // set when first digit is hit
unsigned char calculate_value;
trailing_spaces = 0;
digit_flag = FALSE;
while (order > 0)
{
// must show last digit if it is zero
if (order == 1)
{
digit_flag = TRUE;
}
// determine if digit is present
if (value >= order)
{
calculate_value= (value / order)+48;
Term_Tx(calculate_value); //WHY DOES THIS NOT WORK????
digit_flag = TRUE;
}
else
{
// no leading zeros, only in body of number
if (digit_flag)
{
Term_Tx('0');
}
else
{
trailing_spaces++;
}
}
value %= order; //WHY DO THIS NOT WORK?????
order /= 10; //WHY DO THIS NOT WORK?????
}
// now pad spaces to overwrite previous number which may have had
more digits
while (trailing_spaces > 0)
{
Term_Tx(' ');
trailing_spaces--;
}
}
the function Term_TX simply transmits an unsigned char to the com
port.
Any ideas what these compiler errors mean, and what is causing the
problem????
Thanks in advance
kind regards
pete