当前位置:网站首页>ARM处理器与51单片机程序编写的区别
ARM处理器与51单片机程序编写的区别
2022-06-23 08:59:00 【七月流星.】
(1)int变量
在51单片机中占2个字节;在ARM处理器中占4个字节。
(2)结构体对齐
在51单片机中按照一个字节对齐;在ARM中按照结构体默认对齐规则对齐。
(3)字节在内存的排列顺序
在51单片机中是大端;在ARM中,大多数是小端,部分可以大小端选择。
大端堆栈和小端堆栈的区别:
大端堆栈往上生长,小端堆栈往下生长;
大端初始化的SP往往在地址低端,小端初始化的SP往往在地址高端。
(4)局部变量
在51单片机中存放在数据段中;在ARM中存放于堆栈中;
(5)指令长度
在51单片机中指令长度一般是1~3个字节;在ARM处理器中指令长度一般是一个字(32位)。
(6)编址方法
在51单片机中是空间独立编址;在ARM中是空间统一编址。
(7)ARM中没有bool变量;在51单片机中可采用bit变量
使用typedef enum(false,true)bool;
赋初值的ROM变量定位方法:
ARM方法:
const u8 bootsoftver __at(0x8001000)=BOOT32_SOFTVER;
MCS51方法:
首先,建立一个bootver.c文件:
unsigned char code
version=BOOTVERSION; //BOOT固件版本
然后,在BL51 Locate--?CO?BOOTVER(0x0FD00)
(8)主函数和中断调用同一函数
在51单片机中显示告警信息WARNING 15(MULTIPLE CALL TO SEGMENT);函数不可重入
在ARM中编译后不显示告警;函数可重入
边栏推荐
- Vue3表单页面利用keep-alive缓存数据的一种思路
- Click Add drop-down box
- (resolved) difference between leftmost prefix and overlay index
- Can portals be the next decentraland?
- When easynvr service is started, video cannot be played due to anti-virus software interception. How to deal with it?
- Combination sum of leetcode topic analysis
- Happy number of leetcode topic analysis
- Leetcode topic analysis group anagrams
- 线性表(LinkList)的链式表示和实现----线性结构
- MQTT+Flink实现实时消息的订阅与发布
猜你喜欢

"Coach, I want to play basketball" -- AI Learning Series booklet for students who are making systems

JSP入门总结

Testing -- automated testing selenium (about API)

173. Binary Search Tree Iterator

披萨订购设计----简单工厂模式

Linux MySQL installation

986. Interval List Intersections

GeoServer adding mongodb data source

瞄准海外宠物市场,「Grasphand 」做了一款独立于手机的智能追踪产品 | 早期项目

三层架构与SSM之间的对应关系
随机推荐
Summary of Arthas vmtool command
Flink error --caused by: org apache. calcite. sql. parser. SqlParseException: Encountered “time“
The fourth online workshop review
Subsets II of leetcode topic analysis
Geoserver添加mongoDB数据源
523. Continuous Subarray Sum
Flink错误--Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered “time“
In June, China database industry analysis report was released! Smart wind, train storage and regeneration
Map (set) operation in go language
2022-06-22:golang选择题,以下golang代码输出什么?A:3;B:1;C:4;D:编译失败。
Utilisation du cookie du module de demande de noeud
297. Serialize and Deserialize Binary Tree
【学习资源】理解数学和热爱数学
Basic process of code scanning login
Implementing an open source app store with swiftui
1、 Software architecture evaluation
力扣之滑动窗口《循序渐进》(209.长度最小的子数组、904. 水果成篮)
Which is better, semrush or ahrefs? Which is more suitable for GoogleSEO keyword analysis
简易学生管理
Fraction to recursing decimal