[riot-devel] printing uint64_t

Ralph Droms (rdroms) rdroms at cisco.com
Mon Mar 9 13:30:37 CET 2015


I'm testing three different boards and native mode RIOT.  It seems I may have a problem with printing 64 bit ints (for example, an EUI-64 address).  Here's the code fragment (modified from examples/hello-world.c):

   uint64_t longnum = 0x1234567812345678;

   puts("Hello World!");

   printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD);
   printf("This board features a(n) %s MCU.\n", RIOT_MCU);

   printf("longnum %016"PRIx64" %016llx\n", longnum, longnum);

Here's a summary of the output from the 4 devices:

  cc2538dk:	    longnum 1234567820001350 1234567812345678
  samr21-xpro:	    longnum 000000000000000lx 000000000000000lx
  redbee-econotag: longnum 1234567812345678 1234567812345678
  native:	    longnum 1234567812345678 1234567812345678

and the compilers I'm using for each:

  cc2538dk:        gcc version 4.3.2 (Sourcery G++ Lite 2008q3-66)  
  samr21-xpro:     gcc version 4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278] (GNU Tools for ARM Embedded Processors) 
  redbee-econotag: gcc version 4.3.2 (Sourcery G++ Lite 2008q3-66) 
  native:          gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)


Is there something I'm doing that's obviously wrong?

- Ralph



More information about the devel mailing list