link error termio_putchar undefined

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

link error termio_putchar undefined

Jump to solution
1,471 Views
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

Labels (1)
0 Kudos
1 Solution
1,023 Views
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

View solution in original post

0 Kudos
2 Replies
1,024 Views
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 Kudos
1,023 Views
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 Kudos