加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 你好世界,裸机Beagleboard

发布时间:2020-12-16 05:36:58 所属栏目:百科 来源:网络整理
导读:我试图在我的Beagleboard-xm rev上运行一个“hello world”类型的程序. C,通过从程序集调用C puts函数. 到目前为止,我一直在用这个作为参考:http://wiki.osdev.org/ARM_Beagleboard 这是我到目前为止,但没有输出. hello.c中 volatile unsigned int * const
我试图在我的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 != '') { 
    *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/

任何指针?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读