作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
为什么 xil_printf 会导致堆栈溢出而 XUartLite_SendByte 不会?谁能解释一下?注释部分 (XUartLite_SendByte) 工作正常,但最终我想调用 i 上的函数并使用 xil_printf 返回结果。
代码如下所示。
使用赛灵思 SDK 的 microblaze
#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;
}
最佳答案
您在 Xilinx forum 上发布了相同的问题.赛灵思回应:
XUartLite_RecvByte() returns a u8 (or unsigned char). Not a Xuint16. And xil_printf %c will not expect Xuint16.
关于c - xil_printf 和 XUartLite_SendByte,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22973127/
为什么 xil_printf 会导致堆栈溢出而 XUartLite_SendByte 不会?谁能解释一下?注释部分 (XUartLite_SendByte) 工作正常,但最终我想调用 i 上的函数并使
我是一名优秀的程序员,十分优秀!