我正在尝试在我的 Beagleboard-xm rev 上运行一个“hello world”类型的程序。C,通过从程序集中调用 Cputs
函数。
到目前为止,我一直将其用作参考:http ://wiki.osdev.org/ARM_Beagleboard
这是我到目前为止所拥有的,但没有输出。
你好ç
volatile unsigned int * const UART3DR = (unsigned int *)0x49020000;
void puts(const char *s) {
while(*s != '\0') {
*UART3DR = (unsigned int)(*s);
s++;
}
}
void hello() {
puts("Hello, Beagleboard!\n");
}
引导程序
.global start
start:
ldr sp, =stack_bottom
bl hello
b .
链接器.ld
ENTRY(start)
MEMORY
{
ram : ORIGIN = 0x80200000, LENGTH = 0x10000
}
SECTIONS
{
.hello : { hello.o(.text) } > ram
.text : { *(.text) } > ram
.data : { *(.data) } > ram
.bss : { *(.bss) } > ram
. = . + 0x5000; /* 4kB of stack memory */
stack_bottom = .;
}
生成文件
ARMGNU = arm-linux-gnueabi
AOPS = --warn --fatal-warnings
COPS = -Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding
boot.bin: boot.asm
$(ARMGNU)-as boot.asm -o boot.o
$(ARMGNU)-gcc-4.6 -c $(COPS) hello.c -o hello.o
$(ARMGNU)-ld -T linker.ld hello.o boot.o -o boot.elf
$(ARMGNU)-objdump -D boot.elf > boot.list
$(ARMGNU)-objcopy boot.elf -O srec boot.srec
$(ARMGNU)-objcopy boot.elf -O binary boot.bin
像这样只使用 asm 文件。
.equ UART3.BASE, 0x49020000
start:
ldr r0,=UART3.BASE
mov r1,#'c'
以下是一些 Beagleboard/minicom 相关信息:http ://paste.ubuntu.com/829072/
任何指针?:)
我也试过
void hello() {
*UART3DR = 'c';
}
我正在使用 minicom 并通过 ymodem 发送文件,然后我尝试使用以下命令运行它:
go 0x80200000
minicom 中的硬件和软件控制流程已关闭。