1. arm word 为32,intel word为16
2. Real view tools(RVMDK)
3. arm七种处理器模式,用户程序一般在User态,这个是基础,根本。
4. 一般工作在super和user模式,FIQ和IRQ是中断模式,MMU缺页用abort模式
5. arm7,37个寄存器,也不是很多呀
6.R13为堆栈指针,每种模式都有单独的堆栈。R14用来存放返回地址。CPSR是当前状态,SPSR是跳转前的CPSR值。
2013.7.7
7. 汇编语言中的sp指针与C中的堆栈如何对应起来?汇编中的栈指的是函数调用时,需要压入的参数!而C中队和栈与这个不一样!
8. Vector table 就是一组功能与地址对应的表,例如中断了,去调用相应地址处的代码!那中断控制器呢?
9. Cortex-M只有两种模式用户模式+特权模式(特权模式只有一种), 与以前设计完全不一样!
10. 当执行了undefined instruction时,进入特权模式,PC应该是指到vector table中所指的地址0x00000004吧?
11. thumb1是16bit指令,thumb2由16bit和32bit指令组成。
Some cores, such as the Cortex-M3 and M4, only execute Thumb-2 instructions—there are no ARM instructions at all.
12.
汇编语法 { symbol } { instruction | directive | pseudo-instruction } {; comment }
Instruction mnemonics, pseudo-instructions, directives, and symbolic register names 等大写就一直大写,小写就一直小写
空白行可以随便加
symbol前不能加空格!
In assembly source files, literals can be expressed as:
• decimal numbers, for example 123
• hexadecimal numbers, for example 0x7B
• numbers in any base from 2 to 9 , for example 5_204 is a number in base 5
• floating point numbers, for example 123.4
• boolean values {TRUE} or {FALSE}
• single character values enclosed by single quotes, for example ‘w’
• strings enclosed in double quotes, for example "This is a string
13. 每个汇编程序由多个code sections和多个data section组成。
AREA关键字代表一个段的开始,名字不要有特殊字符!
14. 每个ARM汇编都包含以下字段
The constituent parts of this example are:
• ELF sections (defined by the AREA directive)
• application entry (defined by the ENTRY directive)
• application execution
• application termination
• program end (defined by the END directive).
AREA ARMex, CODE, READONLY
; Name this block of code ARMex
ENTRY ; Mark first instruction to execute
start
MOV r0, #10 ; Set up parameters
MOV r1, #3
ADD r0, r0, r1 ; r0 = r0 + r1
stop
MOV r0, #0x18 ; angel_SWIreason_ReportException
LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit
SVC #0x123456 ; ARM semihosting (formerly SWI)
END ; Mark end of file
第4章 汇编语言终于入门了,多少年了?以前汇编实在不入门,从本科时的微机原理开始,一直就没有汇编入门,后来看的书多了,才慢慢明白C与汇编的关系,其实汇编要掌握的和C差不多,基本操作:赋值,+-等,循环,分支等搞明白就可以写程序了,当然一些汇编特殊的东西如section等东西还是不一样的!
真高兴,现在终于入门了!2017.7.16
指令和数据,是分开的, 咋分开的? 啥是数据,啥是指令?ldr/str是数据,而别的都是指令?(数据就是数据,有的指令需要取数据时就访问数据总线!)
汇编中有数据段和代码段,cpu中有D-cahce和I-Cache, 能对应吗? 就是对应的!
2017.7.17
keil中汇编器和链接器分别是armasm and armlink 2017.7.22
ARM的汇编语言为啥最后改为了Unified Assembler Language(UAL),因为原来的ARM与Thumb很不一样,现在统一在UAL下面了!
汇编中常用字段:
AREA .sect Defines a block of code or data
RN .asg Can be used to associate a register with a name
EQU .equ Equates a symbol to a numeric constant
ENTRY Declares an entry point to your program
DCB, DCW, DCD .byte, .half, .word Allocates memory and specifies initial runtime contents
ALIGN .align Aligns data or code to a particular memory boundary
SPACE .space Reserves a zeroed block of memory of a particular size
LTORG Assigns the starting point of a literal pool
END .end Designates the end of a source file
2017.7.22
第5章 ldr signed 和unsigned 处理是不一样的! 这有点奇怪!
!代表更改寄存器的值
单bit可访问内存BIT-BANDED MEMOR
第7章
ADDS等算数运算指令的S代表update flags;
cpsr中的N代表两个数运算结果为负数; overflow时,用V标志表示;Z代表运算结果为0;BNE xx(判断Z标志是否为0,如果不为0,则跳转到xx)
汇编中没有signed 和unsigned 的区别,都是补码表示的数!32位表示的范围为-2^31到(2^31-1)
C标志代表运算值超过2^32, 这怎么算出来的?与上面那个overflow搞糊涂了, 书上有两个64位数做运算的例子用到了C标志位,我不太明白!
MRS/MSR访问PSR
Bool运算为AND,ORR,EOR,BIC
移位运算 LSL,LSR,ASR,ROR,RRX
有符号和无符号乘法!这个怎么分为无符号和有符号运算?
处理器中除法很复杂,且用的很少,所有m4才有,arm7tdmi中没有
2017.7.30
第8章 没啥 2017.7.30
第12章 talbes and List
第18章 C与汇编
书差不多看完了,但是仿佛当初的那些目标没有实现,也仿佛失去了看书的意义,必须要在工作中实际用到才能印象深刻!
2017.8.20