Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xil_printf and XUartLite_SendByte

Tags:

c

microblaze

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;
}
like image 570
user3446990 Avatar asked Nov 01 '22 02:11

user3446990


1 Answers

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.

like image 80
FabienM Avatar answered Nov 08 '22 12:11

FabienM