Why does xil_printf cause a stack overflow and XUartLite_SendByte does not? Can anyone explain this? The commented section(XUartLite_SendByte) works fine, but eventually i would like to call a function on i and return the result using xil_printf.
The code is shown below.
microblaze using xilinx sdk
#include <stdio.h>
/*#include "xparameters.h" */
#include "xil_cache.h"
/*#include "uartlite_header.h"
#include "xbasic_types.h"
#include "xgpio.h"
#include "gpio_header.h"
#include "xspi.h"
#include "spi_header.h"*/
#include "xparameters.h"
#include "xutil.h"
#include "xuartlite_i.h"
#define UART_ADDR 0x40600000
int main()
{
Xil_ICacheEnable();
Xil_DCacheEnable();
print("---Entering main---\n\r");
Xuint16 i;
while(1==1)
{
while(XUartLite_IsReceiveEmpty(UART_ADDR));
i = XUartLite_RecvByte(UART_ADDR);
xil_printf("%c ", i);
/*while(XUartLite_IsTransmitFull(UART_ADDR));*/
/*XUartLite_SendByte(UART_ADDR, i);*/
//}
}
print("---Exiting main---\n\r");
Xil_DCacheDisable();
Xil_ICacheDisable();
return 0;
}
You posted the same question on Xilinx forum. Xilinx responded it :
XUartLite_RecvByte() returns a u8 (or unsigned char). Not a Xuint16. And xil_printf %c will not expect Xuint16.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With