codewarrior使用指南

更新时间:2023-08-30 05:49:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Transition Title

Codewarrior使用指南

TM

内容 利用向导创建一个新工程项目 在新项目中加入或删除文件 编译 调试 启动程序 PRM文件设置 如何对IO及寄存器进行操作 如何写中断程序 如何使用汇编和C语言混合编程 嵌入式编程注意事项 如何使用Processor ExpertSlide 2TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

利用向导创建一个新工程项目 在新项目中加入或删除文件 编译 调试 启动程序 PRM文件设置 如何对IO及寄存器进行操作 如何写中断程序 如何使用汇编和C语言混合编程 嵌入式编程注意事项 如何使用Processor Expert

TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

创建新工程 1

1、创建新工程 2、选择HCS12 New Project Wizard 3、输入工程名

Slide 4TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

创建新工程 24、选择MCU类型 5、选择语言类型

Slide 5TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

创建新工程 36、选择是否采用Processor Expert 7、选择是否使用PC-lint

如果用Processor Expert,选择 YesSlide 6TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

创建新工程 48、选择是否用浮点运算 9、选择存储器类型

Slide 7TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

创建新工程 510、选择调试器类型

Slide 8TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

编译

调试

是否产生调试信息源程序文件夹 Start up文件夹 Prm文件夹 Map文件夹库文件夹列出相关文件代码长度TM

变量长度Slide 9

是否被包含在Target中

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semico

nductor, Inc. 2005.

参考文献

http://www.77cn.com.cn Slide 10 Codewarrior manuals/pdf/IED_Users_Guide.pdfTM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

利用向导创建一个新工程项目 在新项目中加入或删除文件 编译 调试 启动程序 PRM文件设置 如何对IO及寄存器进行操作 如何写中断程序 如何使用汇编和C语言混合编程 嵌入式编程注意事项 如何使用Processor Expert

TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

在新项目中加入或删除文件

如果编译时,出现没有调试信息警告,请点击这里

新建一文件,并保存到原文件夹中点击右键,加入或从此工程中删除文件

Slide 12TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

利用向导创建一个新工程项目 在新项目中加入或删除文件 编译 调试 启动程序 PRM文件设置 如何对IO及寄存器进行操作 如何写中断程序 如何使用汇编和C语言混合编程 嵌入式编程注意事项 如何使用Processor Expert

TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

无限循环 (1) While (1); (2) For (;;); (3) Loop:

goto Loop;

对嵌入式系统来说: -循环是必须要用到的. -上述3种方式,第2种更好一些 -为什么?

因为它不会产生警告信息“always true warning”Slide 14TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

编译器优化 CodeWarrior编译器提供了几种从C源代码产生实际汇编代码的优化方法,这些代码被下载到微控制器中

全局优化设置面板设定编译器怎样优化目标代码。所有优化程序重新组织目标代码,不影响其逻辑执行顺序。

Slide 15TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

编译器优化–强度减弱

“Strength Reduction”(强度减弱)是一种优化,力争用开销小的操作代替开销大的操作,所要付出的代价是执行时间或代码大小。

在循环内,用加

法指令代替乘法指令。 下列例子将演示编译器,根据具体应用,来决定哪一种操作用最少代价达到同样结果。

Slide 16TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

这个变量乘以3

Slide 17TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

用乘法来实现

Slide 18TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

变量乘以4

Slide 19TM

Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.© Freescale Semiconductor, Inc. 2005.

本文来源:https://www.bwwdw.com/article/81vi.html

Top