《ADS开发工具的基本使用.ppt》由会员分享,可在线阅读,更多相关《ADS开发工具的基本使用.ppt(39页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、1ADS开发工具的基本使用开发工具的基本使用 史先强史先强南京博芯电子技术有限公司南京博芯电子技术有限公司2Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.目目 录录ADS安装与简介1J-Link使用方法简介2跑马灯:简单嵌入式开发入门3RTC:中断服务程序入门43开发工具链安装:开发工具链安装:ADS与与Jlink 4Copyright 2007 Prochip Electronics Co
2、,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.ADS:ARM Developer Suite常用ARM开发工具(Windows平台)ARM SDT(ARM Software Development Kit)ARM Developer Suite(V1.2)Keil uVision(MDK)(V3.24)IAR Embedded WorkBench(V5.20)RealView Developer Suite(RVDS)ADS组成部分集成开发环境(CodeWarri
3、or IDE from Metrowerks)调试器(Debuggers):AXD、armsd代码生成工具(Code Generation Tools)指令集模拟器(Instruction Set Simulators)ARM应用库(ARM Applications Library)ARM 开发包(ARM Firmware Suite)5Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.ADS安
4、装安装Step by StepStep1:双击Setup.exe6Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.ADS安装安装Step by StepStep2:一路Next,程序开始安装Step3:直到安装完毕7Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any
5、means without prior written consent.ADS安装安装Step by StepStep3:跳出ARM Lisence Winzard,点击下一步8Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.ADS安装安装Step by StepStep3:选择Install Lisence,点击下一步9Copyright 2007 Prochip Electronics C
6、o,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.ADS安装安装Step by StepStep4:填入你的Code,点击下一步10Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.ADS安装安装Step by StepStep5:点击下一步,直至完成11Copyri
7、ght 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.ADS安装安装Step by StepStep6:在程序安装主界面点击“Finish”,完成安装12Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.Code
8、Warrior用户界面用户界面13Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.J-Link安装安装点击“Setup_JLinkARM_V400.exe”,一路Next,直至安装完成14开发工具链安装:配置开发环境开发工具链安装:配置开发环境 15Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be r
9、eproduced by any means without prior written consent.配置配置AXD调试器调试器正确连接开发板电源,并用Jlink将PC的USB接口与开发板的20Pin JTAG接口正确连接,将开发板上电点击“开始”-所有程序-ARM Developer Suite v1.2-AXD Debugger,打开AXD调试器16Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written co
10、nsent.配置配置AXD调试器调试器点击“Options”-Configure Target点击“ADD”,在弹出的文件选择框中选择JlinkRDI.dll路径:C:Program FilesSEGGERJLinkARM_V400 JlinkRDI.dll17Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.配置配置AXD调试器调试器点击OK,结束配置18Copyright 2007 Proc
11、hip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.配置配置AXD调试器调试器验证AXD配置在AXD的Memory窗口输入0 x10001000地址并回车回车,如果看到相似数据,则表明AXD配置成功,仿真器可以正确识别开发板上的CPU如果在AXD的界面中看不到Memory窗口,请点击Processor Views-Memory19开发一个简单的开发一个简单的ADS工程:工程:GPIO控制控制LED 20Copyright 2007 P
12、rochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.入门:新建一个工程入门:新建一个工程在D盘新建目录LED,并从Sample代码中拷贝boot、include、misc文件夹及int_vec_handler.c文件到LED目录Step1:建立工程目录,并拷贝必要文件21Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduc
13、ed by any means without prior written consent.入门:新建一个工程入门:新建一个工程打开CodeWarrior,File-New选择Project标签在Project name内填入工程名在Location内填入路径点击“确定”注意:注意:注意:注意:无论工程名还是路径,都不要出现中文、空格等Step1:建立新的工程22Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written
14、 consent.入门:新建一个工程入门:新建一个工程Step2:向新工程内添加刚才拷贝的文件:注意:注意:使用鼠标拖拽LED_DATA及LED.mcp不要添加进去23Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.入门:新建一个工程入门:新建一个工程Step3:在跳出的对话框中选“OK”,完成文件添加:24Copyright 2007 Prochip Electronics Co,ltd.A
15、ll Rights Reserved.Not to be reproduced by any means without prior written consent.入门:新建一个工程入门:新建一个工程Step4:添加Main.c文件:File-new选择File选项卡输入文件名:main.c勾选“Add to Project”,并选择当前工程LED.mcp依次勾选Targets内的选项25Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without
16、 prior written consent.入门:新建一个工程入门:新建一个工程Step5:完成自己的main函数在打开的main.c文件中输入以下内容#include#includeub4020evb.h#includeintc.hint main()while(1);return 0;26Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.入门:新建一个工程入门:新建一个工程Step6:尝试
17、编译:Project-make根据错误提示,删除misc文件夹下的“pmu.c”修改int_vec_handler.c,将vector数组的handler全部替换为NULL,并去掉不需要的头文件,仅保留intc.h和studio.h再次编译,已经去掉所有Error27Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.入门:新建一个工程入门:新建一个工程Step7:更改工程设置Edit-Debug
18、rel Settinglanguage Setting:将ARM Assembler等选项的Target and Source选项卡中的“Architecture of Processor”选项均设为“ARM720T”28Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.入门:新建一个工程入门:新建一个工程Step8:更改工程设置Edit-Debugrel SettingARM Linker:O
19、utPut:Linkertype-Simple,RO Base-0 x04000000Options:Image entry point-0 x04000000Layout:Place at beginning of imageObject/Symbol-boot_gfd.oSection-BOOT至此,我们已经成功建立了一个空白工程,并可以在Main函数中添加自己的功能代码,下面我们将一步步实现LED的控制。29Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any m
20、eans without prior written consent.GPIO_PORTE_DIR:0=1控制一个控制一个LED-GPIO控制原理控制原理OUTINPin 93SMCGPIOSMC_DAT0GPIO_PORTE:0GPIO_PORTE_SEL:0=1GPIO_PORTE_DIR:0=0GPIO_PORTE_SEL:0=030Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.控制一
21、个控制一个LED添加功能代码添加功能代码在main函数添加以下代码*(RP)GPIO_PORTE_SEL|=0 x01;/选择Pin93为GPIO功能*(RP)GPIO_PORTE_DIR&=0 x01;/设置该管脚为输出*(RP)GPIO_PORTE_DATA|=0 x1;/拉高管脚,点亮LED*(RP)GPIO_PORTE_DATA&=0 x1;/拉低管脚,熄灭LED编译并在DEBUG模式下单步运行,观察LED0Project-makeProject-debug加入循环与闪烁31Copyright 2007 Prochip Electronics Co,ltd.All Rights Res
22、erved.Not to be reproduced by any means without prior written consent.控制一个控制一个LED完善程序,加入循环与闪烁完善程序,加入循环与闪烁最终的main函数int main()int i;*(RP)GPIO_PORTE_SEL|=0 x01F;/选择Pin93为GPIO功能*(RP)GPIO_PORTE_DIR&=0 x01;/设置该管脚为输出while(1)*(RP)GPIO_PORTE_DATA|=0 x1;/拉高管脚,点亮LEDfor(i=0;i0 x400000;i+);*(RP)GPIO_PORTE_DATA&=
23、0 x1;/拉低管脚,熄灭LEDfor(i=0;i1;i+;调用中断服务程序调用中断服务程序(*vectori.handler)();35Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.中断服务程序中断服务程序INT_VECTOR vector=INTSRC_NULL,NULL ,INTSRC_EXINT0,NULL ,INTSRC_EXINT1,NULL ,INTSRC_EXINT2,NUL
24、L ,INTSRC_EXINT3,NULL ,INTSRC_EXINT4,NULL ,INTSRC_EXINT5,NULL ,INTSRC_EXINT6,NULL ,INTSRC_EXINT7,NULL ,INTSRC_EXINT8,NULL ,INTSRC_EXINT9,NULL ,INTSRC_EXINT10,NULL ,INTSRC_SDIO,NULL ,INTSRC_SMC1,NULL ,INTSRC_SMC0,NULL ,INTSRC_USB,NULL ,INTSRC_NULL,NULL ,INTSRC_SSI,NULL ,INTSRC_I2S,NULL ,INTSRC_LCDC,N
25、ULL ,INTSRC_PWM,NULL ,INTSRC_UART3,NULL ,INTSRC_UART2,NULL ,INTSRC_UART1,NULL ,INTSRC_UART0,NULL ,INTSRC_TIMER3,NULL ,INTSRC_TIMER2,NULL ,INTSRC_TIMER1,NULL ,INTSRC_MAC,NULL ,INTSRC_EMI,NULL ,INTSRC_DMAC,NULL ,INTSRC_RTC,RTCIntHandler ,;typedef structint_vectorU8IntNum;void(*handler)(void);INT_VECTO
26、R;36Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.SEP4020地址空间分配地址空间分配CSFCSE(SDRAM)CSB、CSC、CSDCSA(NorFlash)IOESRAM0 x0400 00000 x1000 00000 x2000 00000 x3000 0000MACLCDCDMAEMIGPIOPMCINTCNand_Data(0 x11000200)37Copyright 2
27、007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.中断服务程序以中断服务程序以RTC的秒中断为例的秒中断为例涉及的Memory空间ESRAM:0 x04000000,64KNorFlash:0 x20000000,2MSDRAM:0 x30000000,32M系统零地址映射上电默认:0 x200000000 x0(NorFlash)配置REMAP寄存器后:0 x300000000 x0(SDRAM)0 x000000
28、000 x040000000 x200000000 x30000000NorFlashNorFlashSDRAMSDRAM38Copyright 2007 Prochip Electronics Co,ltd.All Rights Reserved.Not to be reproduced by any means without prior written consent.中断与分散装中断与分散装载什么是分散装载?为什么要分散装载?怎么实现分散装载?ESRAM:0 x04000000SDRAM:0 x30000000NorFlash:0 x000000000 x20000000boot_gfd.oint_gfd.oSDRAM:0 x3000000000 x00000000Before RemapAfter RemapNorFlash:0 x20000000ESRAM 0 x04000000 ESRAM 0 x04000000 boot_gfd.o(BOOT,+First)SDram 0 x30000000 SDram 0 x30000000 int_gfd.o(INT,+First)*(+RO,+RW,+ZI)39谢谢!谢谢!