MCU Keil C51优化方法

Keil C51

References

OPTIMIZE Level

目前主要使用Level 9优化级别 + Favor Size进行编译。经过测试,如果勾选上“Linker Code Packing(max. AJMP / ACALL)”,代码大小可以再降低10%

Keil C51 Build Settings

9 Common Block Subroutines:
Recurring instruction sequences are converted into subroutines. This reduces program size but slightly increases execution speed. This optimization is performed on the complete application.

Linker Code Packing (max. AJMP / ACALL)
Instructs the Compiler to include information in the object file for the linker-level program optimizations. When enabled, the LX51 linker/locater performs this optimizations.

优化代码

Memory Model

Pointer

MCU IP (R80515)

Evatronix R80515

1T 8051 Core, Double DPTR, MDU (16 bit Multiplication-division unit)

在这里插入图片描述
在这里插入图片描述

Double DPTR

  • Cx51 - Double DPTR
  • Enable “Use multiple DPTR registers” 之后,C51编译时会应用多DPTR优化,但实际测试结果,仅减少了20B的代码大小

MDU

  • Cx51 - MDU
  • R80515 IP中有个 mdu.v 实现,包含这个文件才会支持MDU
  • MDU的使用方式,是借助SFR来进行的,先把2个16bit数写到SFR(0xE9-0xEE),然后等待几个CPU Clock就完成了运算
  • 详见下图:
    在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值