chprintf - %ld

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

chprintf - %ld

Post by pito »

I cannot get chprintf print a %ld (or %LD), I am getting an int. Any hint how to print an int64_t?

Code: Select all

    uxtms = 999888777666L;
    chprintf(chp, "%d   %ld\r\n", uxt, uxtms);
..
1380670167   433985367

Interestingly, when the uxt (int32_t) increments, the uxtms (int64_t) increments as well..

Code: Select all

1380670542   433985742
1380670559   433985759
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: chprintf - %ld

Post by Giovanni »

Hi,

64 bits are not supported currently, %ld refers to a 32 bits word. It is printing the lower half, this explains that increment too.

Giovanni
pito
Posts: 199
Joined: Sun Nov 06, 2011 3:54 pm

Re: chprintf - %ld

Post by pito »

The uxtms gets a constant number, why it increments then? :)
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: chprintf - %ld

Post by Giovanni »

Probably it is matter of parameters passing in registers.

Giovanni
Post Reply