Trigonometry Causing PWM to stop

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

myles
Posts: 2
Joined: Sun Jan 08, 2012 12:32 am

Re: Trigonometry Causing PWM to stop

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Trigonometry Causing PWM to stop

Post 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
myles
Posts: 2
Joined: Sun Jan 08, 2012 12:32 am

Re: Trigonometry Causing PWM to stop

Post 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.
Post Reply