Hi all,
I'm in triuble with printf. I'm trying to use the printf standard funcion, but each time I want to use it the linker give me errors. It tells me that it cannot find UART function. I think that this is a problem of the console support, but I have not idea how to disable it.
How I can tell toi the linker to not use UART functions?
Thanks in advance
Macro using fprintf() function can be used as a simple workaround.
Switching stdout from UART console to another device is OS-specific. For example, well-known uC/OS uses i/O library function ReplaceStdio().
Sorry,
my problem is to use the pritf as stadard output. In other words I need to modify the stdout->write_proc to a my proprietary procedure.
What is happening to me is that I include stdio.h an when I use printf the sistem calls WriteUARTN funztion instead of my procedure.
I think that the problem is that the library wants to send to UART the output instead of stdout file structure.
What I can do to solve my problem??
Probably I found out the problem.
I debugged my firmware and I saw that when the istruction
stdout->write_proc = Write_Display;
is executed the stdout->write_proc value doesn't change and still at value 0.
The stdout structure is allocated in RAM.
What can cause this strange behaviour?
Thanks in advance for you support.
Some others news to stress you men.
If I watch at the address of stdout->write_proc using view-global variables codewarrior function the value is 0x200006E4.
In my code, if I read the address using instruction
__io_proc *Pippo = &stdout->write_proc;
the address is totally different. The address that I read is 8 byte more high instead of the real one:
0x200006EC.
Than when I the firmware executes the istruction
stdout->write_proc = Write_Display;
it modify another part of stdout structure.
This means that the software is compiling something different instead of stdout file structure.
Have you got any idea to make me able to run the printf correctly????
I'm back to stress you.
At the end I found the problem of FILE structure. In ansi_prefix_CF.size.h was defined no tiny library, but for MCF52221 is mandatory to use C_4i_CF_SZ library that is a small size one.
Now the write_proc is set correctly, but my write function isn't colled.
Is the tiny library able to make me use printf???