英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流

 找回密码
 立即注册
搜索
电子烟方案单片机单片机开发深圳单片机开发
单片机方案国产单片机8位单片机电子烟方案开发
查看: 3687|回复: 1
打印 上一主题 下一主题

编译代码长度为什么不一样

[复制链接]
跳转到指定楼层
1#
发表于 2009-4-25 17:16:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
同样的一段C代码,为什么在MPLAB6以上版本编译出的代码长度比MPLAB5.7环境下编译出的代码长度短,而且短代码写入芯片后还不能正常使用,用的是通同一个编译器HT-PICC 8.05PL1。MPLAB6以上版本编译信息:
Clean: Deleting intermediary and output files.
Clean: Deleted file "Irg4pic zf zf.obj".
Clean: Deleted file "Irg4pic zf zf.cce".
Clean: Deleted file "rzf.cof".
Clean: Deleted file "Irg4pic zf zf.mcs".
Clean: Done.
Executing: "C:HT-PICBINPICC.EXE" -C -E"rzf.cce" "rzf.c" -O"rzf.obj" -Zg9 -O -ASMLIST -Q -MPLAB 16F873
Warning[000] Irg4pic zf zf.c 586 : implicit conversion of float to integer
Warning[000] Irg4pic zf zf.c 607 : implicit conversion of float to integer
Warning[000] Irg4pic zf zf.c 611 : implicit conversion of float to integer
Warning[000] Irg4pic zf zf.c 621 : implicit conversion of float to integer
Warning[000] Irg4pic zf zf.c 627 : implicit conversion of float to integer
Warning[000] Irg4pic zf zf.c 631 : implicit conversion of float to integer
Warning[000] Irg4pic zf zf.c 645 : implicit conversion of float to integer
Warning[000] I:Prg4pic zf zf.c 649 : implicit conversion of float to integer
Warning[000] I:Prg4pic zf zf.c 659 : implicit conversion of float to integer
Warning[000] I:Prg4pic zf zf.c 665 : implicit conversion of float to integer
Warning[000] I:Prg4pic zf zf.c 669 : implicit conversion of float to integer
Warning[000] I:Prg4pic zf zf.c 674 : implicit conversion of float to integer
Warning[000] I:Prg4pic zf zf.c 675 : implicit conversion of float to integer
Executing: "C:HT-PICBINPICC.EXE" -E"rzf.lde" "I:Prg4pic zf zf.obj" -M"rzf.map" -O"rzf.cof" -O"rzf.hex" -Q -MPLAB -16F873
Memory Usage Map:
Program ROM   $0000 - $009A  $009B (   155) words
Program ROM   $05F4 - $07FF  $020C (   524) words
Program ROM   $0812 - $0FFF  $07EE (  2030) words
                                                   $0A95 (  2709) words total Program ROM
Bank 0 RAM    $0022 - $006A  $0049 (    73) bytes
Bank 0 RAM    $007F - $007F  $0001 (     1) bytes
                                                 $004A (    74) bytes total Bank 0 RAM  
Bank 1 RAM    $00A0 - $00C2  $0023 (    35) bytes
Bank 1 RAM    $00FF - $00FF  $0001 (     1) bytes
                                                 $0024 (    36) bytes total Bank 1 RAM  
Bank 0 Bits   $0100 - $010B  $000C (    12) bits  total Bank 0 Bits
Program statistics:
Total ROM used                                      2709 words (66.1%)
Total RAM used                                        112 bytes (58.3%)

MPLAB5.7下的编译信息
Memory Usage Map:
Program ROM   $0000 - $00D0  $00D1 (   209) words
Program ROM   $035E - $07FF  $04A2 (  1186) words
Program ROM   $081A - $0FFF  $07E6 (  2022) words
                             $0D59 (  3417) words total Program ROM
Bank 0 RAM    $0022 - $006A  $0049 (    73) bytes
Bank 0 RAM    $007F - $007F  $0001 (     1) bytes
                             $004A (    74) bytes total Bank 0 RAM  
Bank 1 RAM    $00A0 - $00C2  $0023 (    35) bytes
Bank 1 RAM    $00FF - $00FF  $0001 (     1) bytes
                             $0024 (    36) bytes total Bank 1 RAM  
Bank 0 Bits   $0100 - $010B  $000C (    12) bits  total Bank 0 Bits

Program statistics:
Total ROM used     3417 words (83.4%)
Total RAM used      112 bytes (58.3%)

Build completed successfully.
2#
 楼主| 发表于 2009-4-25 17:16:08 | 只看该作者
优化级别不同会导致代码长度不一致,一般说,优化级别越低,甚至是不优化,代码就越冗长,但也越可靠,只要程序空间够大,可以把优化级别调低点。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|公司首页|Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流 ( 粤ICP备09008620号 )

GMT+8, 2024-5-1 04:18 , Processed in 0.056964 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表