xil_printf and XUartLite_SendByte

雨燕双飞 提交于 2019-12-23 10:01:05

问题


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;
}

回答1:


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.



来源:https://stackoverflow.com/questions/22973127/xil-printf-and-xuartlite-sendbyte

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!