2016-10-27 10:01 AM
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
2016-10-27 12:15 PM
The former is Keil specific
Isn't GNU/GCC looking for __io_putchar() when using the small printf library? And I've demonstrated it with a file2016-10-27 01:00 PM
thx a lot, I found the _write(int f, char *buffer, int len) function and it works well.
Zamek