Problem with printf and float

Jeppe Ledet-Pedersen jledet@space.aau.dk
Thu Oct 28 12:33:00 GMT 2010


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
>


--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list