Problem with ARM port and pow() function

Nick Clifton nickc@redhat.com
Tue Oct 16 23:37:00 GMT 2007


Hi Fau,

> Here is the ledswitch.c file source:

> #include "lpc210x_gnuarm.h"

Unfortunately this header is needed as well...

> There is also an assembler file for the vector initializaton. If you want I 
> can post it, too.

Yes please.

> Or if you need the .ld linker script, I can email you.

Yes to that as well please. :-)

In fact maybe you can create a stripped, compressed binary that I could try 
running directly to see if I can make the problem occur for me too.

>> Please include the command line(s) you use to compile the test case, and, 
> 
> I've tried with the makefile of the template project, which is long and 
> complex:
> arm-none-eabi-gcc -mthumb -mcpu=arm7tdmi-s -mthumb-interwork -I. -gdwarf-2 -DROM_RUN 
> -D NO_MATH_INLINES -D GCC_ARM7 -D__WinARM__  
> -O2 -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=build/crt0.lst 
> -fomit-frame-pointer -mcpu=arm7tdmi-s -msoft-float -march=armv4t -Wcast-qual -MD -MP -MF .dep/ledswitch.elf.d 
> build/crt0.o   ledswitch.o --output 
> ledswitch.elf -nostartfiles -Wl,-Map=ledswitch.map,--cref -lc -lm -lc -lgcc -T./build/LPC2106-ROM.ld

Hmm - well I made myself a fake lpc210x_gnuarm.h header file and built the test 
code with that - and it works.  (Well it goes into an infinite loop, which is 
what you would expect.  It does not seg-fault).  I suspect that there must be 
some other problem here.

I do note that you are invoking pow() inside a function called "delay()".  Is 
the sole purpose of this loop to waste time ?  If so then there are better ways 
of doing this than calling math functions.

> But I tried to compile also with only:
> arm-none-eabi-gcc -march=armv4t 
> ledswitch.c -lm -T./build/LPC2106-ROM.ld build/crt0.o --output ledswitch.elf

I built the test this way and it still worked for me.  Note however I am using 
a simulator to run both versions of the test, not actually having any ARM 
hardware.  Maybe you are running into an illegal instruction trap ?  Would you 
have any way of detecting this ?

> Then I tried to compile my own arm-elf toolchain with the following 
> configuration:

Did the problem still occur with this home built arm-elf toolchain ?

Cheers
   Nick



More information about the Newlib mailing list