Retarget scanf stm32 atollic
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-10-17 9:59 AM
Posted on October 17, 2011 at 18:59
Hi guys,
I am trying to retarget scanf for USART1 of STM32 using Atollic. I think the utilized toolchain makes use of _read_r for the scanf (please verify if possible). So I need a new definition of _read_r. Any ideas?I have looked at IAR's _read for keyboard I/O and tried to modify for Atollic (_read_r redirected to USART1) but no luck until now. Thanks!
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-10-17 11:59 AM
Posted on October 17, 2011 at 20:59
http://mcu.cz/print.php?news.2265
-
int
_read_r
(
void
*reent, uint16_t fd,char
*ptr, uint32_t len)
-
{
-
uint32_t counter = len;
-
USART_TypeDef *Usart;
-
if
(
fd == STDIN_FILENO)
{
// stdin from UARTx
-
Usart = USART1;
-
}
else
{
-
return
len; -
}
-
while
(
counter-- >0
)
{
// Read the character to the buffer from UART
-
while
(
USART_GetFlagStatus(
Usart, USART_FLAG_RXNE)
== RESET)
; -
*ptr = USART_ReceiveData
(
Usart)
; -
ptr++;
-
}
-
return
len; -
}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-10-18 12:59 AM
Posted on October 18, 2011 at 09:59Thanks man!
