在main()之前,iar都做了啥(What did IAR do before main ()).doc

在main()之前,iar都做了啥(What did IAR do before main ()).doc

  1. 1、本文档共13页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
在main()之前,iar都做了啥(What did IAR do before main ())

在main()之前,iar都做了啥(What did IAR do before main ()) [original] before main (), what did IAR do? Collection Recently, I wrote a simple operating system on Cortex-M3 and decided to use IAR. In order to write the startup code, I took some time to understand what IAR did before main (). First, when the system is reset, the Cortex-M3 obtains the stack top address from the code area offset 0to initialize the value of the MSP register. Next, move the jump address of the first instruction from the code area offset 0 These addresses are where CM3 requires the interrupt vector table to be placed. Here is the disassembly of a programs boot zone: __vector_table: 080040002600 0800400220007E1D 080040060800 This program is started by the IAP program. The IAP program gets the MSP value (0 at 0and sets the value to MSP, which is the maximum 00x200025FF of the main stack. Next, the IAP program gets the address of the Reset_Handler at 0(0x08007E1D) and jumps to Reset_Handler () to execute. IAP here is a complete imitation of the Cortex-M3 reset sequence, that is, in the absence of IAP system, CM3 can only get MSP from 0 from 0access to the address of the first instruction. And IAP exists on the 0address, IAP startup, has consumed the reset sequence, so IAP to start the UserApp program, but also completely imitate the Cortex-M3 reset sequence. Next, lets look at the first instruction after reset - whats in the Reset_Handler () function?. If were using the ST standard peripheral library, then theres already a ready Reset_Handler, but hes a weak definition - PUBWEAK, which can be overridden by the same name we rewrite. In general, we are using the ST provided by Reset_Handler, which can be found in startup_stm32f10x_xx.s in the library of the V3.4 version: PUBWEAK Reset_Handler SECTION.Text:CODE:REORDER (2) Reset_Handler LDR, R0, =SystemInit BLX R0 LDR, R0, =__iar_program_start BX R0 It seem

文档评论(0)

jgx3536 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:6111134150000003

1亿VIP精品文档

相关文档