arm - 通过 LM3S811 Qemu Simulation 中的中断在 UART 中回显数据
问题描述
我正在尝试使用 Qemu Simulation 通过 LM3S811 中的中断在 UART 中传输和接收字符。我在此https://www.electronicwings.com/arm7/lpc2148-uart0的帮助下编写了此代码。我不确定它是否正确并且它不起作用。有人可以建议如何完成任务。
启动代码:
.thumb
.global start
start:
.word 0x20001000
.word main
闪存.ld
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000
SRAM (rxw) : ORIGIN = 0x20000000, LENGTH = 0x00002000
}
SECTIONS
{
.text : {
*(.vectors);
*(.text);
etext = .;
} > FLASH
.rodata : {
*(.rodata);
} > FLASH
.data : {
sdata = .;
*(.data);
edata = .;
} > SRAM AT > FLASH
.bss: {
sbss = .;
*(.bss);
ebss = .;
} > SRAM
}
主程序
#define UARTDR (*((volatile unsigned int *) 0x4000C000)) // Data register for UART...
#define UARTIFLS (*((volatile unsigned int *) 0x40000034)) // Interrupt identification register...
#define UARTFR (*((volatile unsigned int *) 0x4000C018)) // Register which holds the status of the FIFO...
char rx;
_irq void UART0_Inerrupt(void)
{
int iir_value;
iir_value = UARTIFLS // Interrupt Identification register...
if (iir_value & 0x00) { // If interrupt is received, i.e data is present...
rx = UARTDR;
}
UARTDR = rx; // Write to data register for writing to transmit FIFO...
while ( (UARTFR & 0x20) == 1) continue;
}
int main(void)
{
NVICVectAddr0 = (unsigned) UART0_Inerrupt;
while(1);
}
``
解决方案
推荐阅读
- c# - 使用激活库模式注册 .NET DLL
- javascript - css 动画跨屏并返回
- sql - 将 varchar "dd/mm/yyyy hh:mm:ss" 转换为 datetime2
- c++ - 无法使用 OpenGL 核心配置文件并创建和 OpenGL 4.x 上下文
- javascript - 如何在同一个文件夹中安装 Angular 和 Nodejs
- java - 如何正确让多个线程访问共享缓冲区
- php - 在 Doctrine Repository 中处理未映射的属性
- css - 如何渲染多行文本组件,行间有白色间隙
- python - Having multiple correct answers in a user defined dictionary
- vba - 如何检测单元格是否由“=IF()”公式而不是用户更改