ARM Technical Support Knowledge Articles

REPLACING LIBRARY FUNCTIONS

Applies to: CARM C Compiler

Answer


Information in this article applies to:


QUESTION

I have defined my own putchar function. In THUMB mode everything runs fine, but when I switch to ARM mode I receive the following linker error:

*** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL:  putchar?T
    ADDRESS: 0000040AH

or:

*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL:  putchar?A

Is it possible to re-define a library function? Do I need to modify the run-time library?

ANSWER

You don't have to modify the compiler run-time library when you need a specially-configured version of the putchar function.

For example:

#pragma INTERWORK

#include <LPC21XX.H>          /* LPC21xx definitions */

#define CR     0x0D

int putchar (int ch)  {         /* Write to Serial Port */

  if (ch == '
')  {
    while (!(U1LSR & 0x20));
    U1THR = CR;                 /* output CR */
  }
  while (!(U1LSR & 0x20));
  return (U1THR = ch);
}

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-08-09 10:59:34

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential