This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with printf and float


Hi Pavel, All,

I found the error. The problem was indeed related to 8 byte stack alignment and I'm happy to say that it was neither a bug in Newlib nor GCC.

I run a FreeRTOS kernel on the target, which failed to allocated an 8 byte aligned stack, which again meant that only the high 4 bytes of the double was read correctly by printf. I'm preparing a patch for FreeRTOS that will correct the issue.

At least I got to learn a lot of stuff about the ARM architecture and AAPCS while debugging :)

Thank you for your help.

Best regards,
Jeppe

On 2010-10-27 19:39, Pavel Pisa wrote:
Hello Jeppe,

I am leaving till Monday. But I would expect,
that there is really problem in with EABI parameters
passing and va_arg .The last thing to check is
that you enter main() with per EABI aligned stack.
Check how your stack is prepared in CRT0.S. Try to move
sp four bytes down before main enter to check the other
alignment case.

If this doesnot help, then problem should be in va_arg
in GCC. Other possibility is problem with bitfields,
their packing rules are in some cases different for EABI.
Not sure, if this is a case. Look for âmabi=apcs-gnu
and related stuff.

Best wishes,

Pavel



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]