printf At CodeWarrior HC12

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

printf At CodeWarrior HC12

Jump to solution
3,693 Views
codewarrier
Contributor I
I tried to use printf function  The compilation succed but the Linking at debug stage fail.
Does anyone has  working example ?
Labels (1)
Tags (1)
0 Kudos
1 Solution
983 Views
vectorio
Contributor II
Of course printf() is useful indeed in microcontroller systems, and you surely don't need a file system for it. I use it a lot for terminal output to a serial port on SCI0. To make it work, it's necessary to implement a function called "void TERMIO_PutChar(char ch)" (must not be declared static, of course). Have a look at the file embedded.c (provided by Codewarrior).

Furthermore, if you use printf in banked memory model, be sure you allocate the STRINGS in non banked ROM, it won't work otherwise.

Let me know if you have problems.

View solution in original post

0 Kudos
3 Replies
983 Views
CrasyCat
Specialist III

Hello

In fact we do not deliver implementation of file management function in our CodeWarrior for HC12 tool.

Extract from the Compiler manual:

"In microcontroller applications however, one usually does not need file I/O. In the few cases where one would need it, the implementation depends on the actual setup of the target system.
It is therefore impossible for Freescale to provide an implementation for these features that the user has to specifically implement."

Basically usage of file I/O functions would require a file system to be available on the target system. Not sure this is ever possible on a HC12 CPU.

Why do you want to use file I/O?

CrasyCat

0 Kudos
984 Views
vectorio
Contributor II
Of course printf() is useful indeed in microcontroller systems, and you surely don't need a file system for it. I use it a lot for terminal output to a serial port on SCI0. To make it work, it's necessary to implement a function called "void TERMIO_PutChar(char ch)" (must not be declared static, of course). Have a look at the file embedded.c (provided by Codewarrior).

Furthermore, if you use printf in banked memory model, be sure you allocate the STRINGS in non banked ROM, it won't work otherwise.

Let me know if you have problems.
0 Kudos
983 Views
CrasyCat
Specialist III
Oups
apologies guy. I did read fprintf instead of printf in the original post.
 
Was probable not really woken up :smileysad:
 
vectorio is completely right here.
 
CrasyCat
0 Kudos