3.1 ARM汇编编程概述
1. 汇编编程
为什么要学习汇编
1). Bootloader初始化
2). Linux kernel
3). 高效
2. ARM汇编分类
1. ARM标准汇编:ARM公司得汇编器适合在Windows平台下使用
2. GNU汇编:适用于GNU交叉编译工具链中的汇编器,适合Linux开发平台
3. 汇编程序框架
.section .data
<初始化的数据>
.setction .bss
<未初始化的数据>
.setction .text
.gobal _start
_start
<汇编代码>
程序入口在_start
.text
.gobal _start
__start:
建立汇编程序环境
[root@cfm880 ~]# cd /home/S3-ARM/
[root@cfm880 S3-ARM]# makdir Part3
-bash: makdir: command not found
[root@cfm880 S3-ARM]# mkdir Part3
[root@cfm880 S3-ARM]# cd Part3
[root@cfm880 Part3]# mkdir lesson1
[root@cfm880 Part3]# chmod 777 ./
[root@cfm880 Part3]# cd lesson1/
[root@cfm880 lesson1]# chmod 777 ./
[root@cfm880 lesson1]# ls
[root@cfm880 lesson1]# vim start.S
.text
.global _start
_start:
mov r1, #1
mov r2, #2
mov r3, #3
[root@cfm880 lesson1]# vim Makefile
all:start.o
arm-linux-ld -Ttext 0x50008000 -o start.elf $^
%.o:%.S
arm-linux-gcc -g -o $@ $^ -c
clean:
rm *.o *.elft
链接地址为什么是0x50008000而不是0x50000000
双击
# tiny6410_config
# connect to the J-Link gdb server
target remote localhost:2331
# Set JTAG speed to 30 kHz
monitor endian little
monitor speed 30
# Reset the target
monitor reset
monitor sleep 10
#
# CPU core initialization (to be done by user)
#
# Set the processor mode
monitor reg cpsr = 0xd3
#config MMU
#flush v3/v4 cache
monitor cp15 7, 7, 0, 0 = 0x0
#/* flush v4 TLB */
monitor cp15 8, 7, 0, 0 = 0x0
#disable MMU stuff and caches
monitor cp15 1, 0, 0, 0 =0x1002
#Peri port setup
monitor cp15 15, 2, 0, 4 = 0x70000013
#disable watchdog
monitor MemU32 0x7e004000 = 0x00000000
monitor sleep 10
#disable interrupt
monitor MemU32 0x71200014 = 0x00000000
monitor MemU32 0x71300014 = 0x00000000
monitor MemU32 0x7120000C = 0x00000000
monitor MemU32 0x7130000C = 0x00000000
monitor MemU32 0x71200F00 = 0x00000000
monitor MemU32 0x71300F00 = 0x00000000
#set clock
monitor MemU32 0x7e00f900 = 0x0000801e
monitor MemU32 0x7e00f000 = 0x0000ffff
monitor MemU32 0x7e00f004 = 0x0000ffff
monitor MemU32 0x7e00f020 = 0x01043310
monitor MemU32 0x7e00f00C = 0xc2150601
monitor MemU32 0x7e00f010 = 0xc2150601
monitor MemU32 0x7e00f024 = 0x00000003
monitor MemU32 0x7e00f014 = 0x00200102
monitor MemU32 0x7e00f018 = 0x00000000
monitor MemU32 0x7e00f01C = 0x14000007
#config sdram
monitor MemU32 0x7e00f120 = 0x00000008
monitor MemU32 0x7e001004 = 0x00000004
monitor MemU32 0x7e001010 = 0x0000040f
monitor MemU32 0x7e001014 = 0x00000006
monitor MemU32 0x7e001018 = 0x00000001
monitor MemU32 0x7e00101c = 0x00000002
monitor MemU32 0x7e001020 = 0x00000006
monitor MemU32 0x7e001024 = 0x0000000a
monitor MemU32 0x7e001028 = 0x0000000c
monitor MemU32 0x7e00102c = 0x0000018f
monitor MemU32 0x7e001030 = 0x0000000c
monitor MemU32 0x7e001034 = 0x00000002
monitor MemU32 0x7e001038 = 0x00000002
monitor MemU32 0x7e00103c = 0x00000002
monitor MemU32 0x7e001040 = 0x00000002
monitor MemU32 0x7e001044 = 0x00000013
monitor MemU32 0x7e001048 = 0x00000013
monitor MemU32 0x7e00100C = 0x00010012
monitor MemU32 0x7e00104C = 0x00000b45
monitor MemU32 0x7e001200 = 0x000150f8
monitor MemU32 0x7e001304 = 0x00000000
monitor MemU32 0x7e001008 = 0x000c0000
monitor MemU32 0x7e001008 = 0x00000000
monitor MemU32 0x7e001008 = 0x00040000
monitor MemU32 0x7e001008 = 0x00040000
monitor MemU32 0x7e001008 = 0x000a0000
monitor MemU32 0x7e001008 = 0x00080032
monitor MemU32 0x7e001004 = 0x00000000
# Setup GDB for faster downloads
#set remote memory-write-packet-size 1024
set remote memory-write-packet-size 4096
set remote memory-write-packet-size fixed
monitor speed 12000
break _start
load
点击Debug
3.1 ARM汇编编程概述的更多相关文章
- ARM汇编编程概述
1.为什么需要学些汇编指令 2.ARM汇编指令分类 3.汇编程序框架 4.编程准备 +++++++++++++++++++++++++++++++++++ 1.为什么需要学些汇编指令 bootload ...
- [国嵌笔记][024][ARM汇编编程概述]
汇编程序用途 1.在bootloader与内核初始化时,还没有建立C语言运行环境,需要用到汇编程序 2.在对访问效率要求很高的情况下,需要用到汇编程序 ARM汇编分类 1.ARM标准汇编:适合于Win ...
- 《深入浅出嵌入式底层软件开发》—1. ARM汇编编程基础
1.1 ARM CPU寄存器 ARM的汇编编程,本质上就是针对CPU寄存器的编程,所以要搞清楚ARM有哪些寄存器:ARM寄存器分为两类:普通寄存器和状态寄存器:普通寄存器一共有16个,分别为R0——R ...
- ARM汇编编程基础之一 —— 寄存器
ARM的汇编编程,本质上就是针对CPU寄存器的编程,所以我们首先要弄清楚ARM有哪些寄存器?这些寄存器都是如何使用的? ARM寄存器分为2类,普通寄存器和状态寄存器 寄存器类别 寄存器在汇编中的名称 ...
- Part3_lesson1---ARM汇编编程概述
bootloader以及内核需要使用汇编语言,特别是在初始化的时候!以及在效率要求很高的地方会使用. 汇编程序框架: 其入口在_start处,这个入口需要用一个关键字为.global来声明它是一个全局 ...
- ARM汇编
ARM汇编 ISA ISA即指指令集架构(Instruction Set Architecture)是与程序设计有关的计算机架构的一部分,包括本地数据类型.指令.寄存器.地址模式.内存架构.中断和意外 ...
- 九、ARM 汇编与 C 的混合编程
9.1 ARM 汇编与 C 的混合编程 9.1.1 内嵌汇编 __asm __asm("指令")例如关闭/打开总中断开关 CPSR __asm //使用 C 中变量名代替寄存器 { ...
- GNU ARM 汇编基础
ARM GNU汇编基础 0 前言 全文补充提醒: 笔者在阅读ARM官方文档及查阅实际的u-boot源码中的汇编代码后,发现了一些不同于ARM官方文档中的汇编语法,查阅相关资料后,才发现主要由于汇编器的 ...
- ARM NEON 编程系列2 - 基本指令集
ARM NEON 编程系列2 - 基本指令集 前言 本系列博文用于介绍ARM CPU下NEON指令优化. 博文github地址:github 相关代码github地址:github NEON指令集 主 ...
随机推荐
- const指针
const指针这个问题,复习了好多次,每次看书的时候明白,但是过了一段时间之后没用,总会再次被搞糊涂. 那么今天就把这个问题先用代码实现,把自己理解的写下来.代码在下面: ; ; const int* ...
- php 函数strpos()
strpos() 函数查找字符串在另一字符串中第一次出现的位置. strpos(string,find,start) 返回 从string中的start位置开始找find第一次出现的位置 注意: s ...
- 【jq】c#零基础学习之路(2)循环和分支
一.循环语句 1).do { //循环体,先运行一次. } while (true); 2). while (true) { //循环体 } 3). for (int i = 0; i < le ...
- CocoaPods创建私有pods
由于项目需求,需要把项目的不同模块拆分出来即 组件化 ,一开始想做成多target模式,后来换成私有pods CocoaPods的安装和使用,网上很多,自行搜索即可. 听说可以基于svn创建pod私有 ...
- 第一个Struts2程序之HelloWorld
1.Struts2 简介 Struts 2是Struts的下一代产品,是在 struts 1和WebWork的技术基础上进行了合并的全新的Struts 2框架.其全新的Struts 2的体系结构与St ...
- 跟我学Windows Azure 三 使用vs2013创建windows azure web site
首先我们需要登陆我们的windows azure上,然后访问 https://manage.windowsazure.cn/publishsettings/index 他会让我们下载我们的订阅证书文件 ...
- Sql server 2008 R2 实现远程异地备份
1. 环境: a)两台同样的Sql Server 2008 R2 服务器 b)操作系统都是windows 2008 c)需要将102.108.0.1数据库MSGC远程备份到112.118.0.2的服务 ...
- 基于 Annotation 拦截的 Spring AOP 权限验证方法
基于 Annotation 拦截的 Spring AOP 权限验证方法 转自:http://www.ibm.com/developerworks/cn/java/j-lo-springaopfilte ...
- jquery筛选器
1.过滤 eq(index|-index) 获取当前链式操作中第N个jquery对象,正数从0开始,负数从-1开始. first 获取当前链式操作中第1个jquery对象 last 获取当前链式 ...
- 图像分割实验:FCN数据集制作,网络模型定义,网络训练(提供数据集和模型文件,以供参考)
论文:<Fully Convolutional Networks for Semantic Segmentation> 代码:FCN的Caffe 实现 数据集:PascalVOC 一 数据 ...