Hello,
I had the same kind of problem, nearly for the same reasons. If you take
a look at the ARM7 instruction set, you will notice that there is no
division instruction. Only the multiplication is available.
So, when your code contains divisions, like the one you do for computing
the divisor latch value, the compiler calls library functions located,
as you wrote, in the libgcc.a archive. The __divsi3 makes the job with
the help of software emulation.
The message you get comes from the linker. It doesnt find the related
entry because you probably omitted to include libgcc.a in the files
specification for the linker. The linker command line shows that you
have a linker script (lpc2292-rom-v2.ld). Check if libgcc.a appears in
it. Another possibility is what I did.
* In the linker command, add Llibpath lgcc in the option list,
where libpath is the path where the libgcc.a archive resides.
This was helpful for me with GCC 4.0.0 but should also work with
GCC3.4.4.
Let me know
Regards.
Duke
-----Message d'origine-----
De : lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com] De la part
de roelofth
Envoyé : mardi 21 juin 2005 18:28
À : lpc2000@yahoogroups.com
Objet : [lpc2000] looking for _divsi3
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
_____
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/lpc2000/
* To unsubscribe from this group, send an email to:
lpc2000-unsubscribe@yahoogroups.com
<mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]Message
RE : [lpc2000] looking for _divsi3
2005-06-21 by Yannick Hildenbrand
Attachments
- No local attachments were found for this message.