cancel
Showing results for 
Search instead for 
Did you mean: 

Redefinition of putch in arm-none-eabi

zamek42
Associate II
Posted on October 27, 2016 at 19:01

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 #arm-none-eabi
2 REPLIES 2
zamek42
Associate II
Posted on October 27, 2016 at 22:00

thx a lot, I found the _write(int f, char *buffer, int len) function  and it works well.

Zamek