当前位置:网站首页>Arm assembly foundation of SOC
Arm assembly foundation of SOC
2022-07-26 01:54:00 【guangod】
arm assembly
On the whole , For this kind of soc The chip project is still unable to be completed quickly , But I study computer myself , There are other things about yourself OS And stm32 Project development experience , Whether you run the operating system or not , I have actually completed many projects , It should be thinking and capable .
Own operating system , Know everything about architecture , And I'm still from hardware , I am also familiar with SCM , Starting from these is enough , Why from what ubuntu Starting with , Ladies' , There are many problems , In a fog , Start with what you are familiar with , No matter what others do !
Compilation seems to be learning linux Embedded development cannot be bypassed , Why? ? Because after the chip starts , It doesn't run directly c Code , It needs to be configured first c Running environment , In the process of configuration , It can only be realized by assembly .
Basic knowledge
I was going to make up with this knowledge at last , But I found the bare metal development behind , Still use this , This content is not much , Let's make it up !
GUN Assembly syntax
Because in linux The next thing to use is gcc Cross compilation of , So the compilation also follows GUN Standards for .
The basic syntax format is :
label:instruction @comment//@ Followed by notes ; The instruction part cannot be mixed with uppercase and lowercase , Only use uppercase or lowercase .
Definition of program segment
use .section Pseudo operation to define . Such as .section [email protected] Define a testsection paragraph . Commonly used predefined segment names :
.text Represents a code snippet .
.data Initialized data segment .
.bss Uninitialized data segment .
.rodata Read only data segment .
Function definition
The format is :
Function name :
The body of the function
[ Return statement ]@ It's not necessary
Common assembly instructions
Data transfer instructions
| Instructions | Purpose | Source | describe |
|---|---|---|---|
| MOV | R0 | R1 | take R1 The data in it is copied to R0 in . |
| MRS | R0 | CPSR | The special register CPSR The data in it is copied to R0 in . |
| MSR | CPSR | R1 | take R1 The data inside is copied to a special register CPSR Li Zhong |
Memory access instructions
ARM Memory cannot be accessed directly , such as RAM Data in . There should be registers between them .
| Instructions | describe | |
|---|---|---|
| LDR Rd, [Rn , #offset] | From memory Rn+offset The read data is stored in Rd In the register | |
| STR Rd, [Rn, #offset] | take Rd Data written to memory Rn+offset Location |
#: Or is it an immediate number
LDR:load, load , Is to read data from memory .
STR:store, send out , Write data to memory .
Stack pressing instruction
It will be used when writing the interrupt scene .
| Instructions | describe |
|---|---|
| PUSH | Store the register list on the stack . |
| POP | Recover the register list from the stack |
Another way of writing is :STMFD and LDMFD, You can operate on vectors . This is with STR And LDM The difference between .
Jump instruction
| Instructions | describe |
|---|---|
| B | Jump to label, If the jump range exceeds +/-2KB, You can specify B.W |
| BL | Jump to label address , And save the return address in LR in . |
LR: Link register .
Arithmetic operations
| Instructions | Calculation formula | remarks |
|---|---|---|
| ADD Rd, Rn, Rm | Rd = Rn + Rm | Addition operation , Instructions for ADD |
| SUB Rd, Rn, Rm | Rd = Rn – Rm | Subtraction |
| ADC Rd, Rn, Rm | Rd = Rn + Rm + carry | Addition with carry |
| SBC Rd, Rn ,Rm | Rd = Rn – Rm – Borrow position | subtraction with carry |
Logical operation instructions
AND Bitwise AND
ORR Press bit or
BIC Clear by position Such as :BIC Rd, Rn @Rd = Rd & (~Rn)
ORN Bitwise or not Such as :ORN Rd, Rn, Rm @Rd = Rn | (Rm)
EOR Bitwise XOR
summary
frequently-used ARM Assembly command , That's all , When you encounter it later, please add it slowly .
Expanding knowledge
Several useful tools
qemu
It's actually a virtual machine , You can simulate a computer or arm function , transfer bootload use . stay linux Used more on . Compared with hardware, the simulation mode is jlink.
basybox
do linux Of the root file system .
scaratchbox
Cross compiling platform
uboot
The famous open source bootload
UEFI and Tranocore
Unified extensible component interface .
Standards for operating system and hardware adaptation , In this way, this standard is simulated by software , So you can go around , It can be installed to the corresponding win or linux On .
Tool chain
The self-contained tool chain has been installed in front , This is just from ARM The official website requires , Go through the process again , Nothing else . In words , Use the tool chain installed before .
Two tool chains :GNU contain gcc and ARM(armcc),GNU It's open source. .
For tool chains , You can see arm Tool chain recommended by official documents , No need to press soc Made by the manufacturer .
ubuntu Install the standard tool chain
sudo apt-get install gcc g++ gcc-doc
ubuntu Install the cross tool chain
sudo apt-get install gcc-arm-linux-gnueabi
e:Embedded The embedded
a:app application
b:bina Binary system
i:interface Interface
Theoretical knowledge , You can take your time to add , These are all references , It's okay not to look first , I believe I still have a foundation , So skip directly to hardware programming . Later, I have time to add slowly .
— 2022 year 7 month 4 Japan
Supplement completed —2022 year 7 month 22 Japan
边栏推荐
- FFT用于估计插值后的图像重采样因子
- 劳驾问一下各位老师 oracle 到pg cdc oracle 那边字段大写 pg 这边小写 同
- dataframe 修改某行某列位置的值
- proto转换Dart | 项目使用Protobuf | flutter 使用grpc
- D. Permutation restoration (greedy + double pointer)
- BGP知识点总结
- AUTOCAD——计算面积的方法
- MySQL locking table problem
- When everything can be metauniverse, the development of metauniverse seems to have entered a new stage of development
- "Weilai Cup" 2022 Niuke summer multi school training camp 2 h.[take the elevator] maintenance section
猜你喜欢

Worthington木瓜蛋白酶丨从纯化的蛋白聚糖生产糖肽(附文献)

Go operation excel library excel use
SQL injection tutorial: learn through examples

【Verilog数字系统设计(夏宇闻)4-----Verilog语法的基本概念2】

What is a test case? How to design?

2022 love analysis ― bank digitalization practice report

pt-onnx-ncnn转换的问题记录(接yolov5训练)

CPU的三种模式

# Dest0g3 520迎新赛(更新中)

What is cross site scripting (XSS)?
随机推荐
Republishing foundation and configuration
AUTOCAD——计算面积的方法
"Wei Lai Cup" 2022 Niuke summer multi school training camp 2 d.[link with game glitch] two point answer +spfa ring
[untitled]
In spark SQL, date is used to display the day of the week according to the year, month and day_ format(date,‘u‘)
BGP知识点总结
餐饮连锁门店重塑增长背后的数字化转型
Niuke - bm39 serialized binary tree [hard]
学习笔记:原码, 反码, 补码
QTreeWidget虚线设置
登堂入室soc之arm汇编基础
销量连连夺冠,五菱的成功秘诀只有低价吗?
E. OpenStreetMap (2D monotone queue)
Maximum side length of elements and squares less than or equal to the threshold (source: leetcode)
Redis6.x配置参数详解
01. MySQL transaction isolation level and concurrent database access
Dataframe modifies the value of a row or column position
【深入浅出玩转FPGA学习11----Testbench书写技巧1】
PHP Alipay transfer to Alipay account
Excuse me, sir. Oracle to PG CDC Oracle, the upper case of the field is the same as that of PG