run helloworld on s3c2410 using skyeye without OS

终于将s3c2410在skyeye上跑起来了,没有操作系统的底层支持,实现的是直接向端口写数据。

hello.c

/*

 * hello.c

 * just a function used to output "helloworld" to uart 

 * 

 * author: SU Hang

 * date:   2004-08-28

 */

void hello(void)

{

unsigned long n = 0;

int i;

char * hellostr="helloworld";

long* paddr=(long*)0x50000020;

// for timer delay

while (n++ < 0xffff);

for(i=0;i<10;i++)

{

* paddr=hellostr[i];

}

return;

}

hello.lds
/*
 * hello.lds
 * ld script for helloforSkyeye
 * 
 * author: SU Hang
 * Date:   2004-08-28
 */
OUTPUT_ARCH(arm)
ENTRY(begin)
SECTIONS
{
. = 0x33f00000;
.text : 
{
*(.text) 
*(.rodata)
}
. = ALIGN(8192);
.data : {*(.data)}
.bss : {*(.bss)}
        /* Stabs debugging sections.    */
        .stab 0 : { *(.stab) }
        .stabstr 0 : { *(.stabstr) }
        .stab.excl 0 : { *(.stab.excl) }
        .stab.exclstr 0 : { *(.stab.exclstr) }
        .stab.index 0 : { *(.stab.index) }
        .stab.indexstr 0 : { *(.stab.indexstr) }
        .comment 0 : { *(.comment) }
        .debug_abbrev 0 : { *(.debug_abbrev) }
        .debug_info 0 : { *(.debug_info) }
        .debug_line 0 : { *(.debug_line) }
        .debug_pubnames 0 : { *(.debug_pubnames) }
        .debug_aranges 0 : { *(.debug_aranges) }
}
skyeye.conf
#skyeye config file sample
cpu: arm920t
arch: arm
mach: s3c2410x
mem_bank: map=M, type=RW, addr=0x33f00000, size=0x01000000
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
#log: logon=0, logfile=./sk1.log, start=0, end=200000
# for UART
uart: mod=term
start.S
/*
 *  start.S 
 *  very simple code for ARM 7TDMI 
 *
 *  author: SU Hang 
 *  date:   2004-08-28 
 */
 
.text
.align 4
.global begin
.type begin, function
begin:
@set up irq stack
mov r0, #0xd2                @ make irq mode with all irqs disabled
msr cpsr, r0
ldr sp, =irq_stack           @ set sp_irq = irq_stack
bl hello
b begin
.data
.align  4
irq_stack:
.space 4096
将上面的几个文件放置在同一个文件夹下面,然后依次执行下面的命令:
make clean
make
skyeye -e hello -c skyeye.conf
于是helloworld开始在s3c2410上跑了起来。
xuqiang@ubuntu:~/Desktop/Hello4Skyeye$ skyeye -e hello -c skyeye.conf
SkyEye is an Open Source project under GPL. All rights of different parts or 
modules are reserved by their author. Any modification or redistributions of
SkyEye should note remove or modify the annoucement of SkyEye copyright. 
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list. 
 (skyeye)start
cpu info: armv4, arm920t, 41009200, ff00fff0, 2 
arch: arm
In do_mach_option, mach info: name s3c2410x, mach_init addr 0x17c970
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
exec file "hello"'s format is elf32-i386.
load section .text: addr = 0x33f00000  size = 0x00000077.
load section .glue_7t: addr = 0x33f00078  size = 0x00000000.
load section .glue_7: addr = 0x33f00078  size = 0x00000000.
load section .data: addr = 0x33f02000  size = 0x00001000.
not load section .bss: addr = 0x33f03000  size = 0x00000000 .
not load section .debug_abbrev: addr = 0x00000000  size = 0x0000004e .
not load section .debug_info: addr = 0x00000000  size = 0x00000172 .
not load section .debug_line: addr = 0x00000000  size = 0x00000087 .
not load section .debug_pubnames: addr = 0x00000000  size = 0x0000001c .
not load section .debug_aranges: addr = 0x00000000  size = 0x00000020 .
In SIM_start, Set PC to the address 0x33f00000
(skyeye)(running)helloworldhelloworldhelloworldhelloworldhelloworldhelloworld
熟悉的helloworld,呵呵。。。
posted @   qiang.xu  阅读(552)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
点击右上角即可分享
微信分享提示