GCC RX231 Printf problem

Hello,
I have problems using printf on the RX debug console using the GCC Renesas compiler.

When I get to printf the debugger gets lost doing _vprintf_r () and resets some ideas?
Can anyone use printf on the command console with the Renesas GCC RX?

Thank you,
Simone

 

I use e2 studio 7.4.0 with GCC 4.8.4.201803


/ ************************************************* **********************
*
* FILE: DebugPrintf.c
* DATES: 2019-07-28
* DESCRIPTION: Main Program
*
* NOTE: THIS IS A TYPICAL EXAMPLE.
*
************************************************** ********************* /
#include "r_smc_entry.h"

#include <stdint.h>
#include <stdio.h>

void main (void);

void main (void)
{
printf ( "Hello");
}

  • Hello, simone.

    You could implement console I/O via charput( ) function in lowlvl.c.

    The file lowlvl.c is provided with lowsrc.c somewhere in r_bsp folder in your project.
    If there were no such files, please find them from BSP source code:
    https://www.renesas.com/us/en/software/D4800086.html

    Please note that printf function in standard library calls write(), not charput().
    (I hope this issue will be solved in the future toolchain version.)
    So, you also need to make your own "puts" like function to work with sprintf.

    CC-RX projects are much more easy because lowlvl.c is designed to work with CC-RX library.

  • In reply to Okra:

    Thanks for your help,
    I found the putchar and getchar functions in the lowlvl.c file.

    To use the printf of the GCC library it is therefore sufficient that I declare and write the "write()" function using the putchar? Is it possible to link it with the library printf?

    Simone
  • In reply to simone:

    > sufficient that I declare and write the "write()" function using the putchar?

    It should be the like, but unfortunately not.
    (The library has own write function. That's not fancy.)
    Therefore I suggested to make your own function to do the same as puts( ).

  • In reply to simone:

    Hi Simone,

    Did you get all the answers that you needed?

    JB
    RenesasRulz Forum Moderator

    https://renesasrulz.com/
    https://academy.renesas.com/
    https://en-us.knowledgebase.renesas.com/

  • This thread will be archived due to inactivity.

    Mike Clements
    RenesasRulz Moderator