AnsweredAssumed Answered

Redefinition of putch in arm-none-eabi

Question asked by Zamek on Oct 27, 2016
Latest reply on Oct 27, 2016 by Zamek
Hi All,

I would like to use printf in my CubeMX generated project.
I use Debian Linux and my gcc version is:
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496]

I tried a lot of code like this in my main.c:
#pragma import(__use_no_semihosting)
struct __FILE {
    int handle;
} __stdout;
 
int fputc( int ch, FILE *f )
{
    return ch;
}
I can compile it, but the breakpoint of return ch is never reached.

another try:
int __attribute__((__weak__, __section__(".libc"))) fputc(int ch, FILE *f) {
    return ch;
}

I can compile it, but doesn't reach return ch.

Is there any trick to force redefinition of fputc in arm-none-eabi environment?

thx,
Zamek

Outcomes