s5pv210的学习之路(2)简单汇编

参见李柏章老师的APCS规范(arm汇编入门)

vi test.S
ldr r5,=0x32000000
str r14,[r5] @暂时保存r14(lr) 到内存0x32000000
ldr r0,=fmt @传参
mov r14,r15 @保存返回地址,这里r15是指向下两条地址(二级流水线)
ldr r15,show @调用 ,注意没用=show,所以是直接得到内容0xc3e1528c
ldr r14,[r5] @取得原先保存的返回地址,放到lr
mov r15,r14 @返回地址放回pc,返回原来调用处
show:
.word 0xc3e1528c @这是从uboot的/arm/samsung-dev-uboot/u-boot.dis 查询而来
fmt:
.asciz “hello!\n”

》arm-none-linux-gnueabi-as test.S -o test.o
》arm-none-linux-gnueabi-ld -Ttext=0x30000000 test.o -o test
// 链接地址 0x30000000
//所以uboot下载时必须下到0x30000000处,
//tftp 30000000 test.bin

》arm-none-linux-gnueabi-objcopy -I elf32-littlearm -O binary test /tftpboot/test.bin

结果:
SMDKV210 jimmy# tftp 30000000 test.bin
dm9000 i/o: 0x88000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:40:5c:26:0a:5b
operating at 100M full duplex mode
TFTP from server 172.16.96.215; our IP address is 172.16.96.253
Filename ‘test.bin’.
Load address: 0x30000000
Loading: T #
done
Bytes transferred = 44 (0x2c)
SMDKV210 jimmy# go 30000000

Starting application at 0x30000000 …

hello!

Application terminated, rc = 0x0

SMDKV210 jimmy#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值