I am trying to set up some USART redirection (no ASF). I have created a _write() function that works fine with printf(). However, for some reason it doesn't work with puts().
int _write(int file, char *data, int len) { for (int i = 0; i < len; i++) { while (!STDIO_SERCOM->USART.INTFLAG.bit.DRE); STDIO_SERCOM->USART.DATA.reg = *data++; } return len; } void func(void) { setvbuf(stdout, NULL, _IONBF, 0); setbuf(stdout, NULL); printf("abcdef\r\n"); puts("why doesn't this work"); }
All I see on the output is "abcdef\r\n". The "why doesn't this work" string is not output. I am using nosys.specs. MCU is a SAM D21, I am using Atmel Studio 7 and the supplied GCC compiler.