c – 你好世界,裸机Beagleboard

我试图在我的Beagleboard-xm rev上运行一个“hello world”类型的程序. C,通过从程序集调用C puts函数.

到目前为止,我一直在用这个作为参考:http://wiki.osdev.org/ARM_Beagleboard

这是我到目前为止,但没有输出.

hello.c中

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

boot.asm

.global start
start:
   ldr sp,=stack_bottom
   bl hello
   b .

linker.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 = .;

}

Makefile文件

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/

任何指针?

相关文章

本程序的编译和运行环境如下(如果有运行方面的问题欢迎在评...
水了一学期的院选修,万万没想到期末考试还有比较硬核的编程...
补充一下,先前文章末尾给出的下载链接的完整代码含有部分C&...
思路如标题所说采用模N取余法,难点是这个除法过程如何实现。...
本篇博客有更新!!!更新后效果图如下: 文章末尾的完整代码...
刚开始学习模块化程序设计时,估计大家都被形参和实参搞迷糊...