<?xml version="1.0" encoding="gbk"?> <rss version="2.0"><channel> <title>定阅帖子更新</title> <link>http://www.broadkey.com.cn/XML.ASP</link><description>TEAM Board - 意得法电子</description> <copyright>TEAM 2.0.5 Release</copyright><generator>TEAM Board by TEAM5.Cn Studio</generator> <ttl>30</ttl><item><link>http://www.broadkey.com.cn/Thread.asp?tid=161 </link><title>ARM&amp;nbsp;入门</title><author>rokey</author><pubDate>2009-12-01 8:49:48</pubDate><description><![CDATA[<strong>1 </strong><a class="jt" title="" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_02.html" target="_blank" jquery1259628505156="35"><font color="#0033cc"><strong>ARM</strong></font></a><strong> 的启动</strong> <br />
　　<br />
　　一般的<a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_01.html" target="_blank" jquery1259628505156="38"><font color="#0033cc">嵌入式</font></a>系统在主程序执行之前都需要执行一些初始化的过程以创造<a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_01.html" target="_blank" jquery1259628505156="39"><font color="#0033cc">嵌入式</font></a>程序运行的环境，尤其是一些高级的<a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_01.html" target="_blank" jquery1259628505156="40"><font color="#0033cc">嵌入式</font></a>系统，由于核心芯片使用内存映射、内存保护等机制以及编程使用高级语言 C,C++ 甚至 JAVA 语言，都需要先创建一个适合程序运行的硬件环境，然后初始化或者配置或者剪裁 run-time library, 这些工作都必须在主程序运行前完成，所以一个 startup 程序或者程序组对于一个<a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_01.html" target="_blank" jquery1259628505156="41"><font color="#0033cc">嵌入式</font></a>系统来说是非常重要的。要编写 startup 程序，需要对编译器、链接器和汇编器的细节有一定的了解，同时对 <a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_02.html" target="_blank" jquery1259628505156="42"><font color="#0033cc">ARM</font></a> 芯片硬件本身的地址分配以及 memory mapping 机制也需要有一些了解。
<p jquery1259628505156="45">　　 <strong jquery1259628505156="44">2 <a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_02.html" target="_blank" jquery1259628505156="43"><font color="#0033cc">ARM</font></a> 程序的工作过程 </strong></p>
<p jquery1259628505156="47">　　 首先由各种 source file 经过编译产生 object 文件，然后 object 文件经过链接生成 Image 文件，然后通过 ICE 的方法，根据描述文件的指定下载到目标板上的固态存储器指定地址当中，比如 flash ， EEPROM, ROM 等等。在程序执行之前，根据某些描述文件，将需要读写数据的部分读出放入动态存储器比如 RAM 当中，然后程序从 ROM 开始执行。或者有时为了提高程序的运行速度，也可以将所有的程序 ( 有一些 root 的部分除外，以后会提及 ) 通过一个描述文件放入指定的 RAM 当中，然后程序从 RAM 开始执行，但是这样会耗费大量的动态存储器，所以大部分程序会取折中的方法，将需要快速运行的部分和要读写的部分放入 RAM 中 ( 一般读固态存储器的过程和动态存储器的过程是一样的，但是写就不同了，所以读写的部分一定要放到 RAM 中 ) ，而只读的部分和对速度要求不是那么高的部分放入固态存储器。同时 <a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_02.html" target="_blank" jquery1259628505156="46"><font color="#0033cc">ARM</font></a> 结构的异常向量表规定放在地址为 0x00000000 开始的地址空间上，而一般的 CPU 为了提高异常相应速度，会将这个向量段 remap 到其他的 RAM 当中，所以在描述文件当中必须精确指定异常向量跳转程序的地址到 remap 的地方。</p>
<p jquery1259628505156="49">　　 在 application 程序执行前，还需要由一些文件描述 application 程序执行的环境。比如系统工作时钟，总线频率。现在一般<a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_01.html" target="_blank" jquery1259628505156="48"><font color="#0033cc">嵌入式</font></a>编程语言为 C,C++ 等。如果在使用它们的时候使用的 runtime-library ，那么在程序执行前还需要为这些库函数初始化 heap 。然后 <a class="jt" href="http://www.eeworld.com.cn" rel="http://www.eeworld.com.cn/my/keyad/ad_content_02.html" target="_blank" jquery1259628505156="50"><font color="#0033cc">ARM</font></a> 可能工作在不同的模式，还需要为不同的工作模式设置 stack 。这样，描述链接地址的文件，以及在 application 运行前所有的初始化程序就是 startup 程序组。</p>
<p>　　 <strong>3 STARTUP 分类 </strong></p>
<p>　　 这样，将 startup 程序所完成的功能分类。一类是链接地址描述，一类是各种初始化的程序。根据不同的应用，描述文件和初始化程序的内容以及结构和复杂程度都会不同。但是基本上，它们都必须实现以下功能。</p>
<p>　　<strong> 3.1 描述文件实现功能 </strong></p>
<p>　　 描述文件可以是链接命令行上简单的几个字符，也可以是一个非常复杂的文件，但是它必须完成如下功能：指定程序下载的地址；指定程序执行的地址。</p>
<p>　　 <strong>3.2 初始化程序实现的功能 </strong></p>
<p>　　 初始化程序根据不同的应用，其结构和复杂度也不同，但是它必须完成如下基本功能：异常向量初始化；内存环境初始化；其他硬件环境初始化。</p>]]></description></item></channel></rss>