Xil_printf and XUartLite_SendByte

Why does xil_printf cause a stack overflow, but does XUartLite_SendByte not? Can someone explain this? The commented section (XUartLite_SendByte) works fine, but in the end I would like to call the function on me 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;
}
+4
source share
1 answer

You sent the same question to the Xilinx forum . Xilinx answered this:

XUartLite_RecvByte () returns u8 (or unsigned char). Not Xuint16. And xil_printf% c does not expect Xuint16.

+1
source

Source: https://habr.com/ru/post/1535815/


All Articles