printf At CodeWarrior HC12

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

printf At CodeWarrior HC12

ソリューションへジャンプ
4,583件の閲覧回数
codewarrier
Contributor I
I tried to use printf function  The compilation succed but the Linking at debug stage fail.
Does anyone has  working example ?
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,873件の閲覧回数
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 件の賞賛
返信
3 返答(返信)
1,873件の閲覧回数
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 件の賞賛
返信
1,874件の閲覧回数
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 件の賞賛
返信
1,873件の閲覧回数
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 件の賞賛
返信