AnsweredAssumed Answered

printf compiles into something bizarre

Question asked by Sean Donohue on Jan 31, 2014
Latest reply on Jan 31, 2014 by Sean Donohue

I'm trying to add printf functionality on LINFlex_1 on an MPC5675K. I have written the stub functions InitializeUART, ReadUARTN, and WriteUARTN, but these are never called. No warnings or errors either. When I look at what is compiled from the EWL C library, it makes no sense to me. This is the program flow after calling printf("rbInit"):

 

printformat.c

line 114     __pformatter

line 95     {

line 113     va_start

line 114      __pformatter

line 113     va_start

line 114     __pformatter

line 113     va_start

line 114     __pformatter

line 1906     {

 

runtime.c

__create_frame_and_save_gpr_21

 

printformat.c

line 2138     num_chars = ...

line 1932      chars_written = 0

line 2377     *buff_ptr = '%'

line 1934     while(*format_ptr) {

line 2479     return (chars_written)

 

runtime.c

__restore_gpr_21_exit

 

And finally back to main. num_chars is never updated, buffers seem to be filled with all 0's, and many lines of code are just never executed or compiled. What is going on here?

Outcomes