Page 3 of 3

Re: Trigonometry Causing PWM to stop

Posted: Sat Mar 31, 2012 7:39 pm
by myles
Microman, did you ever figure this out? I have the same problem, and don't know enough to quite figure it out. Although, I'm pretty sure it has something to do with my toolchain. In this case it's atan2(), but the same thing happens with sqrt(). When I stop the debugger, here's what I get:

Code: Select all

Program received signal SIGTRAP, Trace/breakpoint trap.
0x080003a0 in __ieee754_atan2 (y=0, x=0) at ../../../../../gcc-linaro-4.5-2011.02-0/newlib/libm/math/e_atan2.c:115
115   ../../../../../gcc-linaro-4.5-2011.02-0/newlib/libm/math/e_atan2.c: No such file or directory.
   in ../../../../../gcc-linaro-4.5-2011.02-0/newlib/libm/math/e_atan2.c
(gdb) back
#0  0x080003a0 in __ieee754_atan2 (y=0, x=0) at ../../../../../gcc-linaro-4.5-2011.02-0/newlib/libm/math/e_atan2.c:115
#1  0x55555554 in ?? ()
#2  0x55555554 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)


I'm using this toolchain on OS X: https://github.com/esden/summon-arm-toolchain

I'll be putting together a very simple project that illustrates the problem for me, but I'm sure it has nothing to do with chibios, and everything to do with my toolchain/makefile settings. In the meantime, if the error is obvious to anyone, I'd love to hear about it.

Re: Trigonometry Causing PWM to stop

Posted: Sat Mar 31, 2012 7:54 pm
by Giovanni
There is a single issue regarding ChibiOS+GCC+FPU, the compiler can insert FPU instruction before chSysInit() is invoked so the FPU is not initialized. I don't know if this is possibly related to your problem, the workaround is to not use float math in the main function(), it will be fixed in next releases.

If this is not your problem then a simple test project would be helpful.

Giovanni

Re: Trigonometry Causing PWM to stop

Posted: Sat Mar 31, 2012 8:08 pm
by myles
Giovanni,

That sounds like it might be it, for sure. Although now I'm having trouble duplicating it in my test project.

That's *good*, though, as it should allow me to narrow down the problem.