codewarrior使用指南

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

TMTransitionTitleCodewarrior使用指南TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide2内容•利用向导创建一个新工程项目•在新项目中加入或删除文件•编译•调试•启动程序•PRM文件设置•如何对IO及寄存器进行操作•如何写中断程序•如何使用汇编和C语言混合编程•嵌入式编程注意事项•如何使用ProcessorExpertFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.TM•利用向导创建一个新工程项目•在新项目中加入或删除文件•编译•调试•启动程序•PRM文件设置•如何对IO及寄存器进行操作•如何写中断程序•如何使用汇编和C语言混合编程•嵌入式编程注意事项•如何使用ProcessorExpertTMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide4创建新工程11、创建新工程3、输入工程名2、选择HCS12NewProjectWizardTMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide5创建新工程24、选择MCU类型5、选择语言类型TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide6创建新工程36、选择是否采用ProcessorExpert7、选择是否使用PC-lint如果用ProcessorExpert,选择YesTMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide7创建新工程48、选择是否用浮点运算9、选择存储器类型TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide8创建新工程510、选择调试器类型TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide9源程序文件夹Startup文件夹Prm文件夹Map文件夹库文件夹代码长度变量长度是否被包含在Target中是否产生调试信息列出相关文件编译调试TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide10参考文献™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.TM•利用向导创建一个新工程项目•在新项目中加入或删除文件•编译•调试•启动程序•PRM文件设置•如何对IO及寄存器进行操作•如何写中断程序•如何使用汇编和C语言混合编程•嵌入式编程注意事项•如何使用ProcessorExpertTMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide12在新项目中加入或删除文件点击右键,加入或从此工程中删除文件新建一文件,并保存到原文件夹中如果编译时,出现没有调试信息警告,请点击这里Freescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.TM•利用向导创建一个新工程项目•在新项目中加入或删除文件•编译•调试•启动程序•PRM文件设置•如何对IO及寄存器进行操作•如何写中断程序•如何使用汇编和C语言混合编程•嵌入式编程注意事项•如何使用ProcessorExpertTMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide14无限循环(1)While(1);(2)For(;;);(3)Loop:gotoLoop;对嵌入式系统来说:-循环是必须要用到的.-上述3种方式,第2种更好一些-为什么?因为它不会产生警告信息“alwaystruewarning”TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide15编译器优化•CodeWarrior编译器提供了几种从C源代码产生实际汇编代码的优化方法,这些代码被下载到微控制器中•全局优化设置面板设定编译器怎样优化目标代码。所有优化程序重新组织目标代码,不影响其逻辑执行顺序。TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide16编译器优化–强度减弱•“StrengthReduction”(强度减弱)是一种优化,力争用开销小的操作代替开销大的操作,所要付出的代价是执行时间或代码大小。•在循环内,用加法指令代替乘法指令。•下列例子将演示编译器,根据具体应用,来决定哪一种操作用昀少代价达到同样结果。TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide17这个变量乘以3TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide18用乘法来实现TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide19变量乘以4TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide20用2次左移位来实现.用H:X作为指针来指向我们想要乘的值TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©FreescaleSemiconductor,Inc.2005.Slide21这句话等同于VarA=VarA*4;TMFreescale™andtheFreescalelogoaretrademarksofFreescaleSemiconductor,Inc.Allotherproductorservicenamesarethepropertyoftheirrespectiveowners.©Fr

1 / 214
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功