简体   繁体   English

在设置 C 环境之前,如何使用汇编在 uboot 中编写控制台(或就像 printf() 函数)?

[英]How to use assembly to write a console(or just like printf() function) in uboot before set up C environment?

I try to use assembly to write a console in uboot flow before setting up c environment.在设置 c 环境之前,我尝试使用程序集在 uboot 流程中编写控制台。 I referenced the chip vendor's UART firmware driver to translate to assembly in the beginning of uboot flow(in reset).我参考了芯片供应商的 UART 固件驱动程序,以在 uboot 流程开始时(重置时)转换为组装。 Question 1: Does the SOC mmio address work in the begging of uboot?ex: #define UART_BASE 0x11000000 in SOC spec, can I use this address to control uart?问题一:SOC的mmio地址在uboot的乞求中是否起作用?ex:#define UART_BASE 0x11000000 in SOC spec,我可以用这个地址来控制uart吗? 2. where are those assembly codes running if using nand to boot? 2. 如果使用 nand 启动,那些汇编代码在哪里运行? Nand SPL UBOOT to ram is not at begging... Nand SPL UBOOT to ram 不是在求...

(those address are from SOC vendor SPEC) (这些地址来自 SOC 供应商 SPEC)

_UART_Init_and_write_a_char:


mov r11, #0x00
ldr r12, =0xf1012004
str r11, [r12]


mov r11, #0x80
ldr r12, =0xf101200c
str r11, [r12]


mov r11, #0x87
ldr r12, =0xf1012000
str r11, [r12]


mov r11, #0x0
ldr r12, =0xf1012004
str r11, [r12]


mov r11, #0x3
ldr r12, =0xf101200c
str r11, [r12]



mov r11, #0x7
ldr r12, =0xf1012008
str r11, [r12]

MMIO is (hardware) memory-mapped I/O, so it already works. MMIO 是(硬件)内存映射 I/O,所以它已经可以工作了。 However, prior than being able of writing characters, you will likely need to properly configure the registers for UART.但是,在能够写入字符之前,您可能需要正确配置 UART 的寄存器。 These typically include UART settings like eg baudrate, flow control, etc. You can refer to the chip reference manual to know values and addresses.这些通常包括 UART 设置,例如波特率、流量控制等。您可以参考芯片参考手册以了解值和地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM