codewarrior快速使用手册
- 格式:pdf
- 大小:794.03 KB
- 文档页数:10
CodeWarrior 开发环境快速入门-工程创建先看一下你的实验板上单片机是MC9S12DG128吧?如果是,往下看。
如果不是,去看“CodeWarrior 开发环境快速入门-工程创建 for 9S12XDT512.doc”。
注意一下文末的“注”。
1、运行CodeWarrior IDEa、选择开始> 程序> CodeWarrior > CodeWarrior Development Studio for S12(X) V5.0 --- 弹出菜单。
b、选择CodeWarrior IDE。
启动集成开发环境(IDE)。
2、弹出如下窗口。
如未出现该界面,可点击主菜单项“File”,在下拉菜单中点击“Startup Dialog…”,即可出现该界面。
3、点击“Create New Project”按钮a、选择单片机型号为“MC9S12DG128B”,并选择调试方式为“TBDML”(因为需连接实验板进行调试,故需选上TBDML)。
点“下一步(N)>”。
b、选中复选框“C”。
需需用C和汇编嵌套编程,还需选中复选框“Relocatable assembly”。
然后在上述界面中更改工程名称和存取路径:在Project name 文本框中, 输入工程名,工程创建后IDE 会自动添加.mcp 扩展名;在Location 文本框中输入工程保存的位置或者点击Set... 浏览文件夹。
之后点“下一步(N)>”。
c、在下面的界面中可为新建的工程加入一些有用的文件。
如不需要加入一些文件,可直接点“下一步(N)>”。
d、在下面的界面中选中“None”。
然后点“下一步(N)>”。
e、在下面的界面中进行如图所示的配置(默认配置)。
然后点“下一步(N)>”。
f、在以下界面中选择“No”,即不需要将工程配置使用PC-lint。
然后点“下一步(N)>”。
然后点“完成”。
至此系统创建已经好了一个工程。
写给CodeWarrior初学者1.运行CodeWarrior IDE,打开软件界面;2.点击“File”菜单下的“New”选项,然后在“Project”选项卡中选择“HC(S)12 New Project Wizard”,也就是新建工程向导,在右侧输入你要键入的工程名和你要放在哪个文件夹下面;3.点击“确定”后下面选择你采用的单片机型号,比如你选择“MC9S12D64”或者“MC9S12NE64”;(其中如果选择MC9S12NE64,则必须安装光盘上的NE64补丁插件)4.点击“下一步”后,选择你采用哪种编程语言,尽量不要选第三个“C++”,因为好像我试的有问题,如果你单纯的C,则选择第二个,如果你是C和汇编混合编程,则前两个都要选的;5.选择是否采用“处理器专家”,该项功能可以方便程序的寄存器设置,但我用过感觉比较糊涂,所以我一般选择“No”;6.下面就是选择是否采用“PC-lint”,选择“No”;7.选择是不是支持浮点数,如果你的工程采用浮点数则选择下面的两个中一个,否则选择“No”;8.选择采用哪种内存定位模式,一般选择第一个“Small”模式9.最后一步,选择前面两项,如果仅选择第一项,则仅可以软件调试,前两项都选择可以支持软件和硬件调试。
10.完成后,软件会自动创建一个工程,如下图所示,,其中左侧的sources 文件夹下面的main.c就是你的主程序文件,你可以在里面添加代码,同时在左侧按鼠标右键,会弹出菜单,里面有“Add Files”或“Create Group”等,可以根据你的需要往新创建的工程里添加你自己的头文件或者C文件。
11.你可以在main.c里面编辑你的代码,如果需要加入中断,则在左侧找到Prm文件夹下面打开“P&E_ICD_Linker.prm”,然后在右侧该文件里你可以加入你自己的中断函数和中断向量入口地址,记住:你在这个Prm里定义的自己的中断函数名,要和主函数里面的中断函数名对应起来;比如我在Prm文件里定义了串口接收中断:VECTOR ADDRESS 0XFFD6 SCI0Recive_ISR则在主函数(main.c)里面这样引用该中断函数:interrupt void SCI0Recive_ISR(void){里面是你自己的代码}12.现在一个简单的工程基本创建完成,点击下面的编译按钮进行或者调试按钮就进入调试环境13.如果您点击调试(绿色类似箭头按钮)的时候没反应,那可能是您设置的Debug 路径有问题,如果您采用我的方法,比如CW3.0仅安装了Compiler,然后安装了CW4的Debugger,这样的话就要设置一下Debug的路径。
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 开发环境迅速入门 -工程创立先看一下你的实验板上单片机是发环境迅速入门 -工程创立forMC9S12DG128吧假如是,往下看。
假如不是,去看“”。
CodeWarrior 开注意一下文末的“注”。
1、运转CodeWarrior IDEa、选择开始 > 程序 > CodeWarrior > CW for HC12 --- 弹出菜单。
b、选择 CodeWarrior IDE -- IDE启动 , 同时弹出CodeWarrior 窗口。
2、在 IDE 主菜单栏中 , 选择 File > New –弹出新建窗口。
a、选择 HC(S)12 New Project Wizardb、在 Project name 文本框中 , 输入工程名—-工程创立后IDE 会自动增添 .mcp 扩展名。
c、在 Locationd、点击 OK --文本框中输入工程保留的地点或许点击弹出 New Project Wizard –Page 1。
Set... 阅读文件夹。
点击 Next --弹出 New Project Wizard –Page 2。
f、选择MC9S12DG128B。
g、点击 Next -- 弹出 New Project Wizard - Page 3 。
h、保证复选框 C 被选中。
i、点击 Next –弹出 New Project Wizard - Page 4 ;用户能够选择能否用“ Processor Expert”,由软件自动达成中止向量,外头模块初始化等工作。
j、选择Nok、点击Next –弹出 New Project Wizard - Page 5 ;用户能够选择能否将工程配置使用PC-lint。
l、选择Nom、点击Next –弹出 New Project Wizard - Page 6 ;用户能够选择启动代码的种类。
n、选择 ANSI startup codeo、点击 Next button -- New Project Wizard - Page 7 ;用户能够选择工程配置的浮点种类。
Code Warrior 软件使用指南一、软件安装指南二、关于BDM驱动三、创建一个新的工程四、编写与运行你的程序2011年10月16日陈万忠Code Warrior 软件使用指南一、软件安装指南1. 打开文件安装文件夹2. 找到安装文件3. 双击此文件,出现安装界面:4. 点击“NEXT”按钮,出现安装路径信息。
如果修改系统默认路径,点击“change”按钮,然后修改安装路径,否则点击“NEXT”按钮。
5. 在安装过程中,根据提示信息,完成每一步的安装。
6. 安装完毕后,在所有程序中找到Code Warrior 执行文件,点击执行即可进入Code Warrior 集成环境。
7. 也可以拖到桌面上。
此时桌面出现如下图标:二、关于BDM驱动请将“BDM使用说明和驱动”文件夹下的文件:和以及三个文件,复制到:C:\Program Files\Freescale\\Prog\gdi目录下(或者你安装时修改过的Code Warrior 所在目录\Prog\gdi子目录下),在调试时选择Open Source BDM 调试接口即可。
三、创建一个新的工程创建一个新的工程,要按照下面向导选项的8个步骤来选择完成。
双击桌面快捷图标,进入 Code Warrior集成开发环境窗口。
第一步:创建一个新的工程。
第二步:选择CPU类型,选择HCS12X目录下的HCS12X Family。
第三步:选择CPU芯片型号和BDM工具TBDML。
第四步:选择编程语言,我们选择C语言编程。
第五步:添加文件到工程,一般直接按“下一步”。
第六步:快速开发应用程序选择,选None。
第七步:选择中的用户自定义模式。
第八步:选择不使用PC-Lint(TM)链接工具软件,点击“完成”按钮,Code Warrior集成开发环境就会自动生成整个工程的文件系统。
四、编写与运行你的程序在Code Warrior集成开发环境中,利用其自动生成的函数模板,就可以编写和调试你的应用程序了。
CodeWarrior使⽤说明第⼀章: 认识CodeWarrior第⼆章: ⼯程和⽬标⽂件的显⽰和定制第三章: 编译第四章: 链接第五章: 调试第六章: 定制第七章: 库函数和Microsoft Foundation Classes (MFC)1). CodeWarrior 能做些什么?A).使⽤C/C++ 进⾏编程B).也⽀持Java 开发本课程仅限于应⽤C/C++ 语⾔在Windows 平台上使⽤CodeWarrior 进⾏的开发.2). CodeWarrior 优点是什么?CodeWarrior 能够⾃动地检查代码中的明显错误,它通过⼀个集成的调试器和编辑器来扫描你的代码,以找到并减少明显的错误,然后编译并链接程序以便计算机能够理解并执⾏你的程序.3).常⽤编程类型说明:A).应⽤程序(如:⽂本编辑器WordPad )B). 庞⼤的商业软(如:⽐如象Adobe Photoshop,MicrosoftWord,CodeWarrior…)C). 控制⾯板(control panels)<实际上是设置系统功能的⼀个简单界⾯,⽐如可以在控制⾯板中完成.如:设置⾳量和⿏标移动速度这样⼀些参数.>D). 动态链接库(dynamic linked libraries,DLLs)<提供⼀些很有⽤的被系统和应⽤程序共享的函数.通常它们没有⽤户界⾯.>E). 插件(plug-ins)<类似于DLLs,插件也是可供其它软件使⽤的⼩程序,但插件只能被特定的软件使⽤.>4).CodeWarrior⼯具条介绍: 4.1).⽂件菜单: 4.2).编辑菜单4.3).查看菜单4.4).查找菜单4.5).⼯程菜单4.6).调试菜单4.8).窗⼝菜单4.9).帮助菜单4.7).VCS 菜单5).CodeWarrior 集成开发环境的设置5.1).通⽤设置5.5.1).编译设置(Build Settings): 选择是否在执⾏编译之前保存已打开的源⽂件,以及有多少内存被⽤于编译⼯作;5.5.2).IDE 之外(IDE Extras): ⼏个独⽴的设置.⽐如指定CodeWarrior 是否使⽤⼀个第三⽅的⽂本编辑器——因为集成的编辑器并不是很完美,这可以通过指定⼀个你惯⽤的编辑器来替代它;5.5.3).插件设置(Plug-In Settings): 供插件开发商调试他们的插件;5.5.4).隐藏⽂件夹(Shielded Folders): 在这⾥指定的⽂件夹在⼯程设计期间,或执⾏查找和⽐较操作期间,将要被忽略掉.如果在你的⼯程级有⼀个巨⼤的“数据”⽂件⽬录,⽽你⼜不想让这些⽂件降低CodeWarrior 的操作速度时,这个设置就很管⽤了;5.5.5).资料树(Source Trees): ⽤于指定CodeWarrior 在编译程序时⽤不着的⽬录.5.2).编辑器设置5.2.1).编辑器设置(Editor Settings): ⼏个⽤于定制编辑器显⽰、管理⽂本和窗⼝的设置项;5.2.2).字体和制表符(Fonts and Tabs): 设置编辑器中的⽂本⼤⼩、字体、制表符和其它显⽰设置;5.2.3).⽂本颜⾊(Text Colors): ⽤于指定特定语⾔元素(⽐如程序的注释)在编辑窗⼝中的显⽰的颜⾊。
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。