欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > PPT文档下载  

    IAR的使用教程.ppt

    • 资源ID:5433853       资源大小:1.76MB        全文页数:61页
    • 资源格式: PPT        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    IAR的使用教程.ppt

    ,IAR的使用方法,Contents,软件安装,新建STM32工程模板,程序下载及调试,两个例子,4,1,2,3,1.软件安装,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,1.软件安装,IAR版本:V7.1Step1:,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,1.软件安装,IAR版本:V7.1Step2:打开安装包等待安装包解压,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,1.软件安装,IAR版本:V7.1Step3:选择安装“IAR Embbedded Workbench”,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,1.软件安装,IAR版本:V7.1Step4:点击“Next”,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,1.软件安装,IAR版本:V7.1Step5:选择安装目录,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,1.软件安装,IAR版本:V7.1Step6:安装结束后将破解工具复制到安装目录下,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,1.软件安装,IAR版本:V7.1Step7:点击“Patch”,显示框中出现一下信息证明破解成功。File patched!OK-PATCHING DONE-,2.新建STM32工程模板,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step1:下载STM32固件库(http:/www.stmcu.org/),Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step1:下载STM32固件库(http:/www.stmcu.org/),Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step1:下载STM32固件库(http:/www.stmcu.org/),Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,什么是STM32库?在51单片机的程序开发中,我们直接配置51单片机的寄存器,控制芯片的工作方式,如中断,定时器等。配置的时候,我们常常要查阅寄存器表,看用到哪些配置位,为了配置某功能,该置1还是置0。这些都是很琐碎的、机械的工作,因为51单片机的软件相对来说较简单,而且资源很有限,所以可以直接配置寄存器的方式来开发。STM32库是由ST公司针对STM32提供的函数接口,即API(Application Program Interface),开发者可调用这些函数接口来配置STM32的寄存器,使开发人员得以脱离最底层的寄存器操作,有开发快速,易于阅读,维护成本低等优点。当我们调用库的API的时候可以不用挖空心思去了解库底层的寄存器操作,就像当年我们学习C语言的时候,用prinft()函数时只是学习它的使用格式,并没有去研究它的源码实现,如非必要,可以说是老死不相往来。实际上,库是架设在寄存器与用户驱动层之间的代码,向下处理与寄存器直接相关的配置,向上为用户提供配置寄存器的接口。,2.新建STM32工程模板,为什么采用库来开发?对于STM32,因为外设资源丰富,带来的必然是寄存器的数量和复杂度的增加,这时直接配置寄存器方式的缺陷就突显出来了:1)开发速度慢2)程序可读性差这两个缺陷直接影响了开发效率,程序维护成本,交流成本。库开发方式则正好弥补了这两个缺陷。而坚持采用直接配置寄存器的方式开发的程序员,会列举以下原因:1)更直观2)程序运行占用资源少初学STM32的同学,普遍因为第一个原因而选择以直接配置寄存器的方法来学习。认为这种方法直观,能够了解到是配置了哪些寄存器,怎样配置寄存器。事实上,库函数的底层实现恰恰是直接配置寄存器方式的最佳例子,想深入了解芯片是如何工作的话,只要追踪到库的最底层实现就能理解,相信你会为它严谨、优美的实现方式而陶醉。要想修炼C语言,就从ST的库开始吧。,2.新建STM32工程模板,库目录、文件简介,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0LibrariesCMSIS“core_cm3.c文件”在CoreSupport中的是位于CMSIS标准的核内设备函数层 的M3核通用的源文件core_cm3.c和头文件core_cm3.h,它们的作用是为那些采用Cortex-M3核设计SOC的芯片商设计的芯片外设提供一个进入M3内核的接口。这两个文件在其它公司的M3系列芯片也是相同的。至于这些功能是怎样用源码实现的,我们可以不用管它,我们只需把这个文件加进我们的工程文件即可,有兴趣的可以深究。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0LibrariesCMSIS“DeviceSupport文件夹”,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0LibrariesCMSIS“system_stm32f10 x.c文件”是由ST公司提供的,遵守CMSIS标准。该文件的功能是设置系统时钟和总线时钟,M3比51单片机复杂得多,并不是说我们外部给一个8M的晶振,M3整个系统就以8M为时钟协调整个处理器的工作。我们还要通过M3核的核内寄存器来对8M的时钟进行倍频,分频,或者使用芯片内部的时钟。所有的外设都与时钟的频率有关,所以这个文件的时钟配置是很关键的。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0LibrariesCMSIS“stm32f10 x.h文件”所有处理器厂商都会将对内存的操作封装成一个宏,即我们通常说的寄存器,并且把这些实现封装成一个系统文件,包含在相应的开发环境中。这样,我们在开发自己的应用程序的时候只要将这个文件包含进来就可以了,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0LibrariesCMSIS“启动文件(startup)”文件名的英文缩写的意义如下:cl:互联型产品,stm32f105/107系列vl:超值型产品,stm32f100系列xl:超高密度(容量)产品,stm32f101/103系列ld:低密度产品,FLASH小于64Kmd:中等密度产品,FLASH=64 or 128hd:高密度产品,FLASH大于128,2.新建STM32工程模板,库目录、文件简介 STM32F10 x_StdPeriph_Lib_V3.5.0LibrariesCMSIS“启动文件(startup)”启动文件是任何处理器在上点复位之后最先运行的一段汇编程序。在我们编写的c语言代码运行之前,需要由汇编为c语言的运行建立一个合适的环境,接下来才能运行我们的程序。所以我们也要把启动文件添加进我们的的工程中去。总的来说,启动文件的作用是:1.初始化堆栈指针SP;2.初始化程序计数器指针PC;3.设置堆、栈的大小;4.设置异常向量表的入口地址;5.配置外部SRAM作为数据存储器(这个由用户配置,一般的开发板可没有外部SRAM);6.设置C库的分支入口main(最终用来调用main函数);7.在3.5版的启动文件还调用了在system_stm32f10 x.c文件中的SystemIni()函数配置系统时钟,在旧版本的工程中要用户进入main函数自己调用SystemIni()函数。,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0LibrariesSTM32F10 x_StdPeriph_Driver,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0LibrariesSTM32F10 x_StdPeriph_Driver,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0ProjectSTM32F10 x_StdPeriph_Template“stm32f10 x_it.c文件”专门用来编写中断服务函数的,在我们修改前,这个文件已经定义了一些系统异常 的接口,其它普通中断服务函数由我们自己添加。但是我们怎么知道这些中断服务函数的接口如何写呢?是不是可以自定义呢?答案当然不是的,这些都有可以在汇编启动文件中找到,具体的大家自个看库的启动文件的源码去吧。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介STM32F10 x_StdPeriph_Lib_V3.5.0ProjectSTM32F10 x_StdPeriph_Template“stm32f10 x_conf.h文件”这个文件被包含进stm32f10 x.h 文件。是用来配置使用了什么外设的头文件,用这个头文件我们可以很方便地增加或删除上面driver目录下的外设驱动函数库。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,库目录、文件简介前面向大家简单介绍了各个库文件的作用,库文件是直接包含进工程即可,丝毫不用修改,而有的文件就要我们在使用的时候根据具体的需要进行配置。接下来从整体上把握一下各个文件在库工程中的层次或关系,这些文件对应到CMSIS标准架构上。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step1:复制库文件,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step2:在IARV7.1 下新建工程,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step2:在IARV7.1 下新建工程,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step2:在IARV7.1 下新建工程,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step3:向工程中添加库文件,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step3:向工程中添加库文件,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step4:配置工程,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step4:配置工程在General Option 选项中,在Target 选项栏的Device 选项中选择主芯片的类型。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step4:配置工程在C/C+Compiler选项中,对Preprocessor 选项进行设置,在此添加头文件的存储路径以及某些标志符号的宏定义。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step4:配置工程在Linker选项中,选择Config选项,对链接配置文件进行设置,将stm32f2xx_flash.icf 文件拷贝到工程文件夹下,该文件主要负责存储器的映射。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step4:配置工程调试器的选择,在Debugger选项栏的Setup选项条中,选择J-Link/J-Trace调试工具,同时勾选Run to main选项,使程序直接运行至主函数启动。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step4:配置工程在Debugger的Download选项中,需要选择Use flash loader选项,这样才能将程序下载到flash中运行。,Image information in product Note to customers:This image has been licensed to be used within this PowerPoint template only.You may not extract the image for any other use.,2.新建STM32工程模板,Step4:配置工程选择J-Link选择调试通信和接口。一般选用“USB”和“SWD”模式。,3.程序下载及调试,3.程序下载及调试,Step1:Rebuild All每当工程新建好或移动到其他目录下时,都需要进行一次Rebuild All。,3.程序下载及调试,Step1:Rebuild AllMessage窗口errors为0,即库文件包含正确。,3.程序下载及调试,Step2:程序Rebuild All、Compile、MakeCompile:只编译当前源文件。(不管文件是否改动,或者设置是否变动)Make:(常用)编译,连接当前工程。(编译只编译有改动文件,或者设置变动的文件,工程窗口文件右边会有个*号)Rebuild All:编译,连接当前工程。(不管文件是否改动,或者设置是否变动)。,3.程序下载及调试,Step3:程序下载Download and Debug(常用)和Debug without Downloading,3.程序下载及调试,在线调试Live Watch,3.程序下载及调试,在线调试Live Watch只有全局变量才能在Live Watch中查看!,3.程序下载及调试,断点调试,4.两个例子,4.两个例子,LED闪烁,/*函数名:LED_GPIO_Config*函数功能:配置I/O口:LED-PC15*输入:无*输出:无*作者:St*创建时间:2015-11-21*/#define ON 1#define OFF 0void LED_GPIO_Config(void)GPIO_InitTypeDef GPIO_InitStructure;/*开启GPIOC的外设时钟*/RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);/*配置PC15*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_15;GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;GPIO_Init(GPIOC,4.两个例子,LED闪烁,/*函数名:CTRL_LED*函数功能:控制LED灯亮灭,ON为亮,OFF为灭*输入:u8 LED_Control*输出:无*作者:St*创建时间:2015-11-21*/void CTRL_LED(u8 LED_Control)if(LED_Control=ON)GPIO_ResetBits(GPIOC,GPIO_Pin_15);else if(LED_Control=OFF)GPIO_SetBits(GPIOC,GPIO_Pin_15);,4.两个例子,LED闪烁,/*brief Main program.*param None*retval None*/void main(void)SysTick_Init();LED_GPIO_Config();while(1)CTRL_LED(ON);Delay_us(1000000);CTRL_LED(OFF);Delay_us(500000);,4.两个例子,串口,/*函数名:UART4_GPIO_Config*函数功能:配置I/O口:PC10-UART4_TX,PC11-UART4_RX*输入:无*输出:无*作者:St*创建时间:2015-11-21*/void UART4_GPIO_Config(void)GPIO_InitTypeDef GPIO_InitStructure;/*开启GPIOC的外设时钟*/RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO,ENABLE);/*配置PC10*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_10;GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;GPIO_Init(GPIOC,4.两个例子,串口,/*函数名:UART4_Config*函数功能:配置USART2 波特率:115200 数据位:8位 停止位:1位 无奇偶校验*输入:无*输出:无*作者:St*创建时间:2015-11-21*/void UART4_Config(void)USART_InitTypeDef USART_InitStructure;NVIC_InitTypeDef NVIC_InitStructure;/*GPIO Configuration*/UART4_GPIO_Config();/*使能USART4时钟*/RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART4,ENABLE);/*串口复位*/USART_DeInit(UART4);接下页.,4.两个例子,串口,接上页./*USART2参数配置*/USART_InitStructure.USART_BaudRate=115200;USART_InitStructure.USART_WordLength=USART_WordLength_8b;USART_InitStructure.USART_StopBits=USART_StopBits_1;USART_InitStructure.USART_Parity=USART_Parity_No;USART_InitStructure.USART_HardwareFlowControl=USART_HardwareFlowControl_None;USART_InitStructure.USART_Mode=USART_Mode_Rx|USART_Mode_Tx;USART_Init(UART4,接下页.,4.两个例子,串口,接上页.#ifdef EN_UART4_RX NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);NVIC_InitStructure.NVIC_IRQChannel=UART4_IRQn;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0;NVIC_InitStructure.NVIC_IRQChannelSubPriority=0;NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;NVIC_Init(,4.两个例子,串口,/*函数名:UART4_SendData*函数功能:UART4发送数据*输入:u16 Data*输出:无*作者:St*创建时间:2015-11-21*/void UART4_SendData(u16 Data)USART_SendData(UART4,Data);/*等待发送完成*/while(USART_GetFlagStatus(UART4,USART_FLAG_TC)!=SET);/*brief This function handles UART4 Handler.*param None*retval None*/void UART4_IRQHandler(void)if(USART_GetITStatus(UART4,USART_IT_RXNE)!=RESET)/*在此添加接收代码*/*清除UART4接收中断标志位*/USART_ClearITPendingBit(UART4,USART_IT_RXNE);,4.两个例子,总结1)代码书写要规范;2)逻辑要清晰3)要有必要的注释。,考核,考核方式:完成以下要求,能够正确回答与之相关的问题:(1).在IAR开发环境下创建一个完整的可编译、下载和运行的STM32工程;(2).编写流水灯的程序(必须能描述清楚每行代码的作用);(3).用嘀嗒时钟做精准延时(必须能描述清楚每行代码的作用);(4).编写串口数据收发程序(必须能描述清楚每行代码的作用)。考核时间:7.12,晚上6:30。,Thank You!,

    注意事项

    本文(IAR的使用教程.ppt)为本站会员(小飞机)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开