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]

ARM CM3 printf() problem


Hello,

I'm working on an ARM CM3 platform trying to get newlib's printf to
perform as expected.  It almost works, but I get a hard_fault when I
try to execute the following:

{
    int i;
    i = 10;
    printf( "Hello, world. %d\n", i );
}

What is odd, is -9 through 9 work just fine, but for some reason when
the value is double digit, I get a hard_fault when line
vfprintf.c:1450 executes.  I would be surprised if this isn't my
fault, but I'm a bit stumped.  I stepped through the code and it
appears the __aeabi_uldivmod is causing the problem, but I'm not sure
why.


#0  _vfprintf_r (data=data@entry=0x20000c14 <impure_data>,
fp=0x2000126c, fmt0=0x800f620 "\n",
    fmt0@entry=0x0, ap=..., ap@entry=...)
    at ../../../../../../gcc-4.7.2/newlib/libc/stdio/vfprintf.c:1450
1450                          *--cp = to_char (_uquad % 10);
=> 0x08008d7e <+2926>:    adds    r7, r3, #0
   0x08008d80 <+2928>:    adds    r0, r4, #0
   0x08008d82 <+2930>:    adds    r1, r5, #0
   0x08008d84 <+2932>:    movs    r2, #10
   0x08008d86 <+2934>:    movs    r3, #0
   0x08008d88 <+2936>:    blx    0x800dbdc <__aeabi_uldivmod>   <---
Hard fault appears to happen here
   0x08008d8c <+2940>:    adds    r2, #48    ; 0x30
   0x08008d8e <+2942>:    strb    r2, [r7, #0]

I'm using GCC 4.7.2 + newlib 2.0.0.  Any suggestions are welcome.

Thanks,
Wes


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