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汇编编程概述的更多相关文章

  1. ARM汇编编程概述

    1.为什么需要学些汇编指令 2.ARM汇编指令分类 3.汇编程序框架 4.编程准备 +++++++++++++++++++++++++++++++++++ 1.为什么需要学些汇编指令 bootload ...

  2. [国嵌笔记][024][ARM汇编编程概述]

    汇编程序用途 1.在bootloader与内核初始化时,还没有建立C语言运行环境,需要用到汇编程序 2.在对访问效率要求很高的情况下,需要用到汇编程序 ARM汇编分类 1.ARM标准汇编:适合于Win ...

  3. 《深入浅出嵌入式底层软件开发》—1. ARM汇编编程基础

    1.1 ARM CPU寄存器 ARM的汇编编程,本质上就是针对CPU寄存器的编程,所以要搞清楚ARM有哪些寄存器:ARM寄存器分为两类:普通寄存器和状态寄存器:普通寄存器一共有16个,分别为R0——R ...

  4. ARM汇编编程基础之一 —— 寄存器

    ARM的汇编编程,本质上就是针对CPU寄存器的编程,所以我们首先要弄清楚ARM有哪些寄存器?这些寄存器都是如何使用的? ARM寄存器分为2类,普通寄存器和状态寄存器 寄存器类别 寄存器在汇编中的名称 ...

  5. Part3_lesson1---ARM汇编编程概述

    bootloader以及内核需要使用汇编语言,特别是在初始化的时候!以及在效率要求很高的地方会使用. 汇编程序框架: 其入口在_start处,这个入口需要用一个关键字为.global来声明它是一个全局 ...

  6. ARM汇编

    ARM汇编 ISA ISA即指指令集架构(Instruction Set Architecture)是与程序设计有关的计算机架构的一部分,包括本地数据类型.指令.寄存器.地址模式.内存架构.中断和意外 ...

  7. 九、ARM 汇编与 C 的混合编程

    9.1 ARM 汇编与 C 的混合编程 9.1.1 内嵌汇编 __asm __asm("指令")例如关闭/打开总中断开关 CPSR __asm //使用 C 中变量名代替寄存器 { ...

  8. GNU ARM 汇编基础

    ARM GNU汇编基础 0 前言 全文补充提醒: 笔者在阅读ARM官方文档及查阅实际的u-boot源码中的汇编代码后,发现了一些不同于ARM官方文档中的汇编语法,查阅相关资料后,才发现主要由于汇编器的 ...

  9. ARM NEON 编程系列2 - 基本指令集

    ARM NEON 编程系列2 - 基本指令集 前言 本系列博文用于介绍ARM CPU下NEON指令优化. 博文github地址:github 相关代码github地址:github NEON指令集 主 ...

随机推荐

  1. Timberwolves forward Kevin Garnett to retire _洛杉矶时报

    Timerwolves:森林狼队,forward:前锋; kevin Garnett,the best player in Minnesota Timberwolves history,is expe ...

  2. EnglishLeaning

    今天看了些hadoop官方reference感觉自己词汇量和语法真是又回到解放前了.于是,痛下决心要好好学习英语.找到了一些学习的方法,自己记录下来,也和大家一起借鉴 努力目标: 掌握大量的计算机英语 ...

  3. python之购物车的编写(熬夜撸代码中。。。)

    购物车的编写对于我这种不是很精通函数的小白来说,简直太难了.各种坑,各种无奈啊!不过总算也是写出来了! 不多说,直接上代码! #!/usr/bin/env python#用户名 sanjiang#密码 ...

  4. Ubuntu学习——第一篇

    一. Ubuntu简介 Ubuntu(乌班图)是一个基于Debian的以桌面应用为主的Linux操作系统,据说其名称来自非洲南部祖鲁语或科萨语的“ubuntu”一词,意思是“人性”.“我的存在是因为大 ...

  5. (转) The major advancements in Deep Learning in 2016

    The major advancements in Deep Learning in 2016 Pablo Tue, Dec 6, 2016 in MACHINE LEARNING DEEP LEAR ...

  6. linux 并发 RCU

    What is RCU, Fundamentally? https://lwn.net/Articles/262464/ If you can fill the unforgiving secondw ...

  7. SSL安全证书-概念解析

    一.关于证书 数字证书是一种认证机制.简单点说,它代表了一种由权威机构颁发授权的安全标志. 由来 在以前,传统网站采用HTTP协议进行数据传输,所有的数据几乎都用的明文,很容易发生隐私泄露.为了解决安 ...

  8. JSP的基本语法:

    JSP文件有5类元素:注释,模版,脚本,指令,行为 下面我就和大家分别唠唠,这5个玩意到底是啥玩意! 一.注释(我feel有三种): html注释:<!--……-->  显式注释,即客户端 ...

  9. 【linux】之相关命令

    防火墙 ) 重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off ) 即时生效,重启后失效 开启: service iptables s ...

  10. coderforces 731c

    题目大意:给出m组数据,每组数据包括两个数Li与Ri,分别表示左右袜子的索引(下标),表示这一天要穿的袜子:而我们要使得每天穿的这两只袜子的颜色相同,所以可以改变袜子的颜色,每次只能改变一只袜子的颜色 ...