当前位置:网站首页>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
边栏推荐
- Add an interceptor to resttemplate to record the request response, and you also need to solve the problem that the flow is read only once
- Make and makefile summary II
- 保护系统日志服务器和设备
- 登堂入室soc之编程基础环境变量设置
- Cross Site Request Forgery (CSRF): impact, examples, and Prevention
- How to modify Oracle functions?
- Shell summary (1)
- Protect syslog servers and devices
- ABC find 4-cycle (pigeon nest theorem)
- The SQL script generated by powerdispatcher model runs incorrectly
猜你喜欢

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

推荐系统-协同过滤在Spark中的实现

BGP知识点总结

Why does the debugger display the wrong function

图像批处理高斯滤波降噪+峰值信噪比计算

The SQL script generated by powerdispatcher model runs incorrectly

Zhinai buys melons (DP backpack)

PHP Alipay transfer to Alipay account

Worthington产气荚膜梭菌神经氨酸酶的特征及测定

IP address of the network
随机推荐
Republishing foundation and configuration
Travel (split points and layers)
Zhinai buys melons (DP backpack)
DialogRPT-Dialog Ranking Pretrained Transformers
Make and makefile summary I
Installing and using R in Anaconda
在Anaconda 中安装和使用R
Speech comprehension - structural analysis exercise of fragment reading
Recommend a super good UI automation tool: uiautomator2!
【深入浅出玩转FPGA学习11----Testbench书写技巧1】
The sales volume has won the championship repeatedly. Is the secret of Wuling's success only low price?
Analysis of zeromq
Y77. Chapter IV Prometheus' monitoring system and practice -- Prometheus' service discovery mechanism (VIII)
图像批处理高斯滤波降噪+峰值信噪比计算
Qtreewidget dotted line setting
SVN版本控制分支、合并功能使用
Software group verification
Alibaba cloud redis development specification
Pt onnx ncnn conversion problem record (followed by yolov5 training)
NFT market also began to diversify