小结(6)

来源:互联网 发布:手机强刷软件 编辑:程序博客网 时间:2024/05/17 03:10

s3c6410环境搭建:

1.烧写SD

2.SD卡启动

3.u-boot-nand.bin  tftp到内存,然后写入nand

4.nand flash 启动

5.配制tftp /etc/xinetd.d/tftp 

   service xinetd restart

6.通过tftpuImage下入到内存

7.bootm +地址,从u-boot跳到内存中uImage处执行

8.配制nfs文件,/etc/exports =>/mynfsroot *(rw,sync)

service nfs restart

9.配制u-bootset bootargs console=tyySAC0 root=/dev/nfs nfsroot=192.168.1.10:/home/kernel ip=192.168.1.20:::=>当内核执行完后就去主机ip192.168.1.10:/home/kernel去找根文件系统

 

10.bootcmd=tftp 50008000 uImage;bootm =>启动u-boot后自动启动下载uImage.....

其它的一些杂项:

1.交叉编译:

tar xf arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2 -C /

vim /etc/profile:

export PAHT=$PAHT:/usr/local/arm-none-linux-gnueabi/bin

soruce /etc/profile

2.arm汇编:

 

__asm__(

"mov %0,#5"//"mov r0,#5\n" //每一条指令后\n结束

"mov r0,r1\n"

: "=r"(i) //输出部分

//: //输入部分

//: //破坏部分,保护部分

);

 

__asm__(

"mov %0,%1\n"

:"=r"(i)//从输出开始记数:一般用"+r"(i)"=&r"(i)

:"r"(j)

);


 cpsr

__asm__(

"cmp %1,%2\n"//比较指令

"movgt %0,%1 \n"

"movle %0,%2\n"

);

 

#if 0

#else

#endif

mov add sub mul cmp b(掌握这几个指令)

ldr与内存打交道的

str

 

ldm 批量与内存打交道 ldm %0,{r0,r1,r2}

stm      stm %1,{r0,r1,r2}

ldmia

stmia


 例子:

int i=5;

int*p=10;

__asm__(

mov r0,#10

str r0,[%0]

:

:"r"(p)

:"r0"

);

注意:

x86 Byte(1) word(2)   doubleword(4)

arm Byte(1) halfword(2)  word(4)

 

字符串:

.ascii 在这个字符串的最后不加\0

.asciz 在这一个字符最会加一个\0

.align 2 2次方对齐,在这里是以4字节对齐

 

ldr %0,=string

adr %0,string(与上面的那一条指令基本上等价)

string :

.asciz \"hello uplooking\"

.align

data0:

.word 0x11223344

.short 0x1122

.byte 0x11

# mov lr,pc 

# b printf

bl printf(与上面两条等价)