With only a string, printf goes to puts. So it sounds like the printf with arguments is broken. There is a slew of code hiding underneath the printf interface, and tiny problems in register ABI and memory layout easily render printf broken. I would start by modifying hello world to print a formatted string, so that you isolate from any problems due to timers / interrupts. You can then step in printf and see what the register arguments are, and that they correspond to what you might expect. Stepping through printf is a painful, tedious exercise, but hopefully you can find where things are going wrong. You might also try to binary search through the call trace, by generating the stack trace and then checking along it to see what the function arguments are, and how they track back to the high-level printf() call.
-Gedare On Thu, Dec 4, 2014 at 12:46 PM, Hesham Moustafa <heshamelmat...@gmail.com> wrote: > Hi, > > I have a problem with getting printf working correctly. printf is > working totally fine with just one string argument (hello world for > example), however when printf is passed some variable arguments, it > totally prints some garbage strings. Printing time function (in > ticker) is an example for this, even a simple printf("x = %d", x); > where x is defined before to an arbitrary value, output a wrong value > for x, although it output the "x =" string right. I made sure that the > address of x (or time structure content in case of ticker) is not > overwritten, and from GDB, breaking at this and printing x or > time->seconds for example gets me the right expected values. I think > the problem is with var arg list, any ideas? > > Thanks, > Hesham > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel