飞思卡尔-CodeWarrior开发快速入门手册
- 格式:pdf
- 大小:1.23 MB
- 文档页数:8
Freescale Semiconductor, Inc.Document Number: 用户指南 Rev. 0, 09/2014Confidentiality statement, as appropriate to document/part status.___________________________________________________________________飞思卡尔单片机快速上手指南作者:飞思卡尔半导体IMM FAE 团队飞思卡尔半导体是全球领先的单片机供应商,其单片机产品包含多种内核,有数百个系列。
为支持用户使用这些产品,飞思卡尔提供了丰富的网站资源、文档及软硬件工具,另外,我们还有众多的第三方合作伙伴及公共平台的支持。
对于不熟悉飞思卡尔产品和网站的初学者来说,了解和使用这些资源这无疑是一个令人望而生畏的浩瀚工程。
本指南的目的,就是给初学者提供一个指导,让他们不被这些海量信息淹没;用户根据本指导提供的操作步骤,能迅速找到所需的资源,了解如何使用相关的工具。
在本指南中,我们以飞思卡尔的新一代Kinetis 单片机K22系列为例,介绍了如何获取与之相关的资源,如何对其进行软硬件设计和开发。
实际上,这些方法也适用于其它的单片机系列。
当然,对于其它有较多不同之处的产品,我们也会继续推出相应的文档,供广大用户参考。
目录1 如何获取技术资料与支持 ..........................................................2 2 如何选择产品、申请样片及购买少量芯片和开发工具 ........... 93 飞思卡尔单片机的开发环境、开发工具和生态系统 ............. 224 如何阅读飞思卡尔的技术文档 ................................................ 45 5 飞思卡尔单片机硬件设计指南 ................................................ 55 6飞思卡尔单片机软件开发指南 (67)飞思卡尔单片机快速上手指南, Rev. 1, 09/20142Freescale Semiconductor, Inc.1 如何获取技术资料与支持1.1 概述当用户使用飞思卡尔单片机芯片时,如何获取芯片的数据手册(Datasheet )、参考设计(Reference Manual )和官方例程等资源呢?另外当用户遇到了技术问题该如何获得帮助和解答呢?这里以Kinetis 的K22系列芯片为例为大家介绍如何解决这些问题。
CodeWarrior™ Development Studiofor Microcontrollers V6.x Quick StartSYSTEM REQUIREMENTSHardware PC with 1 GHz Intel® Pentium® compatibleprocessor512 MB of RAM (1 GB recommended)CD-ROM driveDepending on host-target connection: ParallelPort, 9-pin Serial Port, or USB PortOperating System Microsoft® Windows® XP orMicrosoft Windows Vista® Operating Systems32-bit (Home Premium Edition and BusinessEdition)Disk Space 2 GB total400MB on Windows system diskThis Quick Start explains how to install the CodeWarrior Development Studio for Microcontrollers V6.x software, and how to use the IDE to create, build, and debug a project.NOTE You must install the CodeWarrior software on the equipment on which you intend to use the software.1.Insert CodeWarrior Development Studio CD into CD-ROM drive —CW Auto Install beginsNOTE If Auto Install does not start, run launch.exe, which is located in the root directory of the CD.The CodeWarrior software may be part of a DVD included withyour kit. In this case, click Install CodeWarrior DevelopmentStudio for Microcontrollers, follow the on-screen instructions,and skip to step "Check for updates".2.Follow setup program's on-screen instructionsNOTE Special Edition: The Special Edition license is automatically installed with your product and you do not need to register it.This license allows you to develop projects with unlimitedassembly code, up to 32KB of C code for HC(S)08/RS08derivatives and up to 64KB of C code for ColdFire V1derivatives.NOTE Evaluation Edition: The Evaluation license is automatically installed with your product and you do not need to register it.This license allows you to develop projects as ProfessionalEdition within the 30-day evaluation period. After 30 days, thelicense works as Special Edition license (free permanent, butfeature limited) which supports unlimited assembly code, up to32KB of C code for HC(S)08/RS08 derivatives and up to 64KBof C code for ColdFire V1 derivatives.1.Create a projecta.Select Start > Programs > Freescale CodeWarrior >CW forMicrocontrollers V6.x > CodeWarrior IDE — IDE starts and displaysstartup dialog box.Startup Dialog Boxb.Select Create New Project — the Microcontrollers New Project Deviceand Connection dialog box appears.NOTE This section of the quick start demonstrates using the New Project Wizard. We use an MC68HC908GZ60target as anexample.c.Expand HC08 and GZ Family and select MC68HC908GZ60 derivative. NOTE If your MCU is missing from the list, download a service pack for that device at /codewarrior/downloads.Device and Connection Dialog Boxd.Select Full Chip Simulation as your default connection.e.Click Next — the Project Parameters dialog box appears.Project Parameters Dialog Boxf.In Project name text box, the IDE supplies a default project name. Entera project name of your choice.NOTE The IDE automatically creates a folder with the same name in specified location. The IDE automatically adds .mcp extensionwhen it creates project.g.In Location text box enter location to store project, click Set to browse tofolder locationh.Select C as language to be supported by project.NOTE You can click Finish to accept defaults for remaining options.i.Click Next — the Add Additional Files dialog box appears.This dialog box lets you browse folders and add or remove files to or fromthe project.Add Additional Files Dialog Boxj.Click Next — the Processor Expert dialog box appears.This dialog box let you specify whether you want your project configuredto use Device Initialization or Processor Expert.Processor Expert Dialog Boxk.Select the None option button.l.Click Next — the C/C++ Options dialog box appears.This dialog box allows you to specify C/C++ Options.C/C++ Options Dialog Boxm.Select ANSI startup code as code, the New Project Wizard will place in your project as startup code.n.Select Small as memory model to use.o.Select None for floating point format to support.p.Click Finish — the IDE creates your project according to your specifications; Project window appears, docked at left side of mainwindow.Project WindowNOTE To undock project window, double-click the double gray lines.To re-dock window, right click in title tab and select Docked.2.Select connectionFor this example, we specified Full Chip Simulation (FCS).a.To change MCU and connection, select Project >Change MCUConnection.b.Make sure Full Chip Simulation is selected in drop-down list.3.Edit source codea.Double click main.c in Sources folder — the Editor window opensdisplaying contents of file.main.c in Editor Windowb.Make changes to contents of main.c file, if desired.c.From the IDE main menu bar, select File > Save — the IDE saveschanges.4.Add files if appropriatea.In the project window, select a folder.b.From IDE main menu bar, select Project > Add Files.The Select files to add dialog box appears.c.Navigate to the directory that contains file you want to add.d.Select the filename of file you want to add to project.e.Click Open — the Project Messages window appear indicating accesspath has been added to target, if the path is new to the project.f.In the project window, filename of the added file appears under theselected folder.5.Build projecta.From IDE main menu bar, select Project > Make — the IDE builds(assembles, compiles, and links) project; Error & Warnings windowopens showing any error messages and warning messages1.Start debuggera.Click on project window title bar to ensures that window is active projectb.From main menu bar, select Project > Make.c.From main menu bar, select Project > Debug — the True-TimeSimulator & Real-Time Debugger window opens.True-Time Simulator & Real-Time Debugger WindowNOTE The Source and Assembly panes display the main.c program and code.2.Set breakpointa.Point at a C statement in Source window and right-click — the Sourcecontext menu appears.b.Select Set Breakpoint — a permanent breakpoint mark is set.3.Run applicationa.From the True-Time Simulator & Real-Time Debugger window, selectRun — the Run menu appears.b.Select Start/Continue or click on Start/Continue icon — theProgram executes till the first breakpoint; Command pane displaysprogram statusDebugger Simulator Command Pane4.Click the Start/Continu e icon — the simulator resumes programexecution.5.Click the Halt icon — the Simulator stops program execution.6.From the True-Time Simulator & Real-Time Debugger windowtoolbar, select File > Exit to exit the debugger.7.From IDE main Window toolbar, select File > Exit to exit theCodeWarrior IDE.Congratulations!You have successfully created, built, and run an HC08 application with the CodeWarrior for Microcontrollers V6.xsoftware!Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. CodeWarrior is a trademark or registered trademark of Freescale Semiconductor, Inc. in the United States and/or other countries. PROCESSOR EXPERT and EMBEDDED BEANS are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.Copyright © 2009 Freescale Semiconductor, Inc. All rights reserved.Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document.Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including “Typicals”, must be validated for each customer application by customer's technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part.How to Contact UsCorporate Headquarters Freescale Semiconductor, Inc. 6501 William Cannon Drive West Austin, Texas 78735U.S.A.World Wide Web /codewarrior Technical Support /supportRevised: 24 September 2009。
CodeWarrior V10.1 使用方法快速入门CodeWarrior V10.1 Quick Start Guide1.启动CodeWarrior。
如果是首次启动该软件,需要设定一个工作空间。
选定工作空间后,如果是第一次运行CodeWarrior,则首先进入“欢迎”界面,点击该界面左上角“×”按钮,关闭该界面后即进入“C/C++项目”编程界面。
2.新建工程:在工具栏中选择 “文件->新建->BareBoard Project”,如图1所示。
图11)设定文件名在缺省状态下,该新建工程将保存在当前工作空间的文件夹下。
完成后点击“下一步”,如图2所示。
图22)选择芯片类型。
此处以MK10N512VMD100为例。
选择好芯片类型后,点击“下一步”,如图3所示。
图33)选择调试器类型(可多选)如果成功安装了新的USBBDM并且patch成功,此处会出现USBDM选项,如图4所示。
如果要在该工程中添加一些已有文件、或者希望生成一个默认的main.c文件,则完成后点击“下一步”。
如无上述需求,则直接点击“完成”。
此时将生成一个包含Startup Code、但不含main.c 的新工程。
图44)选择导入的默认文件以及是否生成main.c,完成后点击“下一步”。
CodeWarrior的默认编程语言是C,也支持C++和汇编,如果使用C语言编程,此处也可直接单击“完成”,具体操作如图5所示。
图55)选择编程语言,完成后点击“下一步”,如图6所示。
图66)选择是否需要调用一些快速开发工具(如Processor Expert、Device Initialization),完成后点击“完成”,如图7所示。
图7至此,CodeWarrior将为您生成一个包含Startup.c和main.c的新工程。
在编程界面(C/C++项目)下的工程窗口下,您可以浏览该工程含有的全部文件。
如果您无法找到上述窗口,可在CodeWarrior界面左下角的视图管理器中寻找。
CodeWarrior 10.2简明手册CodeWarrior 10.2简明手册 (1)1 下载安装CW v10.2 (1)2 安装BDM驱动 (2)3 导入现有工程 (3)4 编译、下载源码工程 (4)5. 带有操作系统程序的编译、下载 (6)5.1 带有操作系统模板程序的打开 (6)5.2 带有操作系统模板程序的编译 (7)5.3 带有操作系统模板程序的下载 (7)6 CodeWarrior 10.2常用操作 (8)7 常见问题说明 (9)基于Eclipse的CodeWarrior Development Studio for Microcontroller v10.2(简称CW10.2)作为一个完整的集成开发环境,提供了高度可视化操作及自动创建复杂嵌入式系统应用的功能,为使用Freescale嵌入式产品开发提供了便利。
官方推荐使用CW v10.2进行Freecale Kinetis嵌入式产品的开发。
本文将对使用CW v10.2开发K60项目的操作进行简要说明。
本文安装的cw10.2 版本是特别版的,支持128KB的代码大小。
用户若需要更大的代码空间和更多的功能的话,则需要向飞思卡尔申请license,这些license都是要收费的。
1 下载安装CW v10.2飞思卡尔半导体为注册用户在其官方网站的网址链接处下载后,双击可执行安装文件,如图1所示,根据提示即可完成安装。
由于有的CW10.2版本安装完成后默认是中文版的,有的默认是英文版的。
集成开发环境的原版是英文版的,所以英文版的运行速度比中文版的快很多。
这里建议用英文版的CW10.2,不建议用户使用中文版集成开发环境,所以本章介绍的使用说明都是基于英文版的。
想将飞思卡尔的CW10.2集成开发环境变成英文版,首先需要关闭当前的CW10.2,然后右击CW10.2桌面图标选择“属性”,在“目标”栏下“…”后面加上“–nl en”再单击“应用”后便改成英文版;加上“–nl zh”可以改2 安装BDM驱动CW_v10.2中已包含了BDM写入器(Open Source BDM,OSBDM)的驱动文件,将BDM接到PC机器时,Windows会提示发现新硬件:提示连接到“Windows Update”更新,选择“否,暂时不”,点击“下一步”。
Codewarrior 使用指南飞思卡尔 HC08/HCS12 系列微控制器开发环境 - Codewarrior 使用指南(草稿)tyf01@ 2005 年 10 月仅供学习参考,请勿用于商业目的1Codewarrior 使用指南第一章 Codewarrior IDE 概述在软件开发过程中,通常需要经过以下几个步骤: • 新建:创建新项目,源文件 • 编辑:按照一定的规则编辑源代码,注释 • 编译:将源代码编译成机器码,同时还会检查语法错误和进行编译优化 • 链接:将编译后的独立的模块链接成一个二进制可执行文件 • 调试:对软件进行测试并发现错误 在软件开发中,每个过程都会用到不同的工具。
如果每个工具都单独存在,这样就 会给开发人员带来很多不便。
所以很多公司为开发人员提供了集成开发环境。
开发 人员可以在同一个工具或平台上完成以上全部的工作。
Codewarrior 是 Metrowerks 公司开发的软件集成开发环境(以后简称 IDE)。
飞思 卡尔所有系列的微控制器都可以在 codewarrior IDE 下进行软件开发。
Codewarrior IDE 特点Codewarrior IDE 为软件开发提供了一系列的工具,其中包括: 项目管理器:为软件开发人员管理上层的文件;将项目进行分组管理,比如文件或 目标系统;跟踪状态信息,比如修改日期;决定编译顺序或每次编译应包括哪些文 件;与插件一起提供版本控制功能 编辑器:利用颜色来区分不同的关键字;允许用户利用颜色机制自定义关键字;自 动检查括号范围;利用菜单在不同的文件或函数中导航 搜索器:搜索一个特定的字符串;用特定的字符串代替查找到的字符串;允许使用 常规表达式;提供文件比较功能; 源代码浏览器:标志符(变量名称,函数名称)数据库;利用数据库来对代码快速 定位;对所有的标志符连接到用到它的代码中; 编译系统:编译器将源代码编译成机器码;链接器将目标文件链接成可执行文件 调试器:利用标志符数据库进行源代码级调试;支持各种标志符数据库,比如: codeview, DWARF, SYM 等Codewarrior IDE 优点•交叉平台开发2Codewarrior 使用指南 开发人员可以在不同的操作系统下使用 codewarrior IDE 来开发自己的软 件。
CodeWarrior开发环境快速入门-程序下载CodeWarrior开发环境快速入门-工程创建1、运行CodeWarrior IDEa、选择开始>程序>CodeWarrior>CW for HC12V4.6---弹出菜单。
b、选择CodeWarrior IDE--IDE启动,同时弹出CodeWarrior窗口。
2、在IDE主菜单栏中,选择File>New–弹出新建窗口。
a、选择HC(S)12New Project Wizardb、在Project name文本框中,输入工程名—-工程创建后IDE会自动添加.mcp扩展名。
c、在Location文本框中输入工程保存的位置或者点击Set...浏览文件夹。
d、点击OK--弹出New Project Wizard–Page1。
点击Next--弹出New Project Wizard–Page2。
f、选择MC9S12DG128B。
g、点击Next--弹出New Project Wizard-Page3。
h、确保复选框C被选中。
i、点击Next–弹出New Project Wizard-Page4;用户可以选择是否用“Processor Expert”,由软件自动完成中断向量,外围模块初始化等工作。
j、选择Nok、点击Next–弹出New Project Wizard-Page5;用户可以选择是否将工程配置使用PC-lint。
l、选择Nom、点击Next–弹出New Project Wizard-Page6;用户可以选择启动代码的类型。
n、选择ANSI startup codeo、点击Next button--New Project Wizard-Page7;用户可以选择工程配置的浮点类型。
p、选择Noneq、点击Next--New Project Wizard-Page8;允许用户选择工程配置的内存模式。
r、选择Bankeds、点击Next button--New Project Wizard-Page9;允许用户工程配置的连接方式。