looking for _divsi3
2005-06-21 by roelofth
Hi all,
As a new member I would like to ask you a question.
I'm getting these error's from arm-elf-ld :
div_error.o: In function `foo':
div_error.c:(.text+0x18): undefined reference to `__divsi3'
Now I know that these functions are in libgcc.a
and apparently the compiler includes that :
roelofh@compraq:~/$ arm-elf-gcc -print-libgcc-file-name
/usr/local/arm/lib/gcc/arm-elf/3.4.4/libgcc.a
So it knows where the library is.
But the following still generates error's :
#include "lpc2292.h"
#define true 1
#define false 0
#define xtal 12000
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
void foo(uint16_t baudrate)
{
uint16_t temp16;
uint32_t temp32;
union bitrate_divisor
{
uint16_t divisor_word;
uint8_t divisor_byte[2];
} bdrate;
uint8_t multiplier;
uint8_t vpbdivider;
multiplier=5;
vpbdivider=2;
temp32=(uint32_t)(multiplier*xtal*1000);
temp32=temp32/vpbdivider;
temp16=temp32/(16*baudrate);
// temp16 should hold the value 195
bdrate.divisor_word=temp16;
u0dll=bdrate.divisor_byte[0];
u0dlm=bdrate.divisor_byte[1];
}
int main(void)
{
foo(9600);
while(true)
{
}
}
This is what I use to compile and link :
arm-elf-gcc -mcpu=arm7tdmi -DROM_RUN -Os -std=gnu99 -I. -c
-mapcs-frame -Wall div_error.c -o div_error.o
arm-elf-ld -Tlpc2292-rom-v2.ld -Map=div_error.map div_error.o crt0.o
--output div_error.elf
Including math.h did not work.
I downloaded and compiled the sources, with newlib 1.13,
from rod.info.
Any and all comments, remarks and suggetions will be
very much appreciated.
Thank you.
roelof