link error termio_putchar undefined

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

link error termio_putchar undefined

跳至解决方案
1,830 次查看
steph
Contributor I

bonjour,

 

je voudrais utiliser la bibliothèque "stdio.h" pour utiliser la fonction printf mais a la compilation j'ai une erreur de lien L1822 :

symbol TERMIO_Putchar in file C:\Program Files (x86)\Freescale\CWS12v5.1\lib\HC12c\lib\ansixli.lib is undefined


en entete de mon fichier j'ai  bien déclaré : #include <stdio.h>

 

merci de m'indiquer comment résoudre ce probleme

 

Stéphane

标签 (1)
0 项奖励
回复
1 解答
1,382 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello,

I think that this is because you are using printf, scanf, stdin and/or stdout. This happens because functions like printf or scanf need the functions for using the SCI in the microcontroller; this functions are TERMIO_Init for initializing the serial port, the initialization sets a baud rate ;

TERMIO_PutChar for sending a char and TERMIO_GetChar for receiving a byte. This functions are located in a file named Termio.c ; In your project sources add the file Termio.c located under the installation directory in “..\{your CW insall}\lib\hc12c\src”

If you wish to use your own SCI routines with printf, scanf, stdin and/or stdout, you can copy the file named termio.c, and replace the code in each function with your own code, keeping only the names of the functions. Also you need to copy the file termio.h which is located in the lib directory, you can leave this file as it is.

this works on my side. can this also work for you?

=================================================

this answer is for you, if it helps, please click on "Correct Answer " button. thanks!

Best Regards,

Zhang Jun

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,383 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hello,

I think that this is because you are using printf, scanf, stdin and/or stdout. This happens because functions like printf or scanf need the functions for using the SCI in the microcontroller; this functions are TERMIO_Init for initializing the serial port, the initialization sets a baud rate ;

TERMIO_PutChar for sending a char and TERMIO_GetChar for receiving a byte. This functions are located in a file named Termio.c ; In your project sources add the file Termio.c located under the installation directory in “..\{your CW insall}\lib\hc12c\src”

If you wish to use your own SCI routines with printf, scanf, stdin and/or stdout, you can copy the file named termio.c, and replace the code in each function with your own code, keeping only the names of the functions. Also you need to copy the file termio.h which is located in the lib directory, you can leave this file as it is.

this works on my side. can this also work for you?

=================================================

this answer is for you, if it helps, please click on "Correct Answer " button. thanks!

Best Regards,

Zhang Jun

0 项奖励
回复
1,382 次查看
steph
Contributor I

hello,

sorry i'm very late for your answer.

thanks for it . I look the TERMIO file . i see that use "while" instruction, so it doesn't interesting me because i try to not use this instruction with the microcontroleur. usually, when there is a communications problem it blocks the program.

0 项奖励
回复