L2310 (E) Undefined external symbol "_write" referenced in "_flshbuf"

Hi ,

I am a new user of e2 Studio. When I try to build a simple program with a single printf statement in the main function, I am getting the error as - "L2310 (E) Undefined external symbol "_write" referenced in "_flshbuf".

How to remove this error in e2 Studio?

 

 

Regards

Ali

  • Hi,

    it looks like you need implement corresponding wrapper sending printf's output to some communication interface you want to use. For GCC RX toolchain that may look as following. Note that in dependency of standard library you are using the wrapper function signature may differ. Replace "e1_charput" call to routine sending byte to preferred communication interface. By the way - if you are using newlib calling unimplemented wrappers - those are throwing AFAIR interrupt vector 255 - so it is a good idea to define dummy handler for the vector and populate it with breakpoint. That should simplify debugging. Good luck.


    #ifndef __NEWLIB__

    // [...]

    int _write(int file, char *ptr, int len)
    {
    if (file != 1 && file != 2) // Standard output, standard error
    return -1;

    int count = 0;
    for (count = 0; count < len; count++)
    e1_charput(*ptr++);

    return count;
    }

    // [...]

    #else // defined __NEWLIB__

    // [...]

    int write(int file, char *ptr, int len)
    {
    if (file != 1 && file != 2) // Standard output, standard error
    return -1;

    int count = 0;
    for (count = 0; count < len; count++)
    e1_charput(*ptr++);

    return count;
    }

    // [...]

    #endif // __NEWLIB__
  • Hi Ali,

    Did Siarzhuk answered your question?

    JB
    RenesasRulz Forum Moderator
  • This is no problem of e2 studio but of the compiler being used and it settings.
    Which processor and which compiler do you use?
    What do you want to use printf for?
  • In reply to JB:

    Hi JB,

    I need some more clarification.

    Regards
    Ali
  • In reply to FrankL:

    Hi Frank,

    I am using SH72531 and SHC_v9.04.03 toolchain.
    I am using printf just to get started with e2 studio.

    Regards
    Ali
  • In reply to Ali:

    You need to implement the write function yourself. The standard library does not know where you want to output the traces. Perhaps look at other projects that have implemented it to a serial port. Or to the debug output of e2s.

  • In reply to Ali:

    This thread will be archived due to inactivity.

    Mike Clements
    RenesasRulz Moderator.