LINKER error

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

LINKER error

1,684 Views
Halom
Contributor I
Hi ,
I am a newbie on micrcontroller. I am implementing a function (in C)  that reads in messages received at the SCI input.
The function reads characters in using the GetSci( ) function, storing the characters into the inData array.

 The function returns a message giving the actual length of the message via the hyperterminal (by which I am supposed to dialog with the PC) . the length has a max value of 100, but can be shorter . this is why the function displays the actual size of the message.

when I compile with code warrior, I have the linker error L 1822 TERMIO_PUTCHAR undefined.
reading other posts about it, it seems to be the printf function but I did not understood the proposed fixes. I am using the MC9S12C32 processor.
Here my function:
Code:
int MsgIn(char inData[], unsigned int length){    int size=0;    char character=0;    character =GetSci();  // reading character from SCI       while(size<length){        inData[size]=character;        size++;      if(character==LF)
      {        inData[size]=0;// stor a 0 at the end of the message        break;}      }// end while    
    return printf("The length is %d \n",size);}

 



Can I have some suggestions about how to fix it?
Thankx
Labels (1)
0 Kudos
2 Replies

243 Views
CompilerGuru
NXP Employee
NXP Employee
Search for TERMIO_PutChar with the search box below in this forum.
I had 26 hits and some of them did answer your question.
Apart from this issue, your function looks a bit suspicious to me
as it for some inputs returns a non nul terminated string, and for some it writes up to length+1 bytes in the passed in buffer. I would make sure to always 0 terminate string buffers, and to never write more than the passed in length (of course the caller could allocate one byte more for the 0 byte already, but that is not the common way buffer sizes are done).

Daniel
0 Kudos

243 Views
Halom
Contributor I
Thankx ,
I got an answer!
0 Kudos