<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > ARM裸機開發(fā)bootloader我是bootloader設計師

          ARM裸機開發(fā)bootloader我是bootloader設計師

          作者: 時間:2016-11-19 來源:網(wǎng)絡 收藏
          一、bootloader設計藍圖

          1、什么是bootloader

          本文引用地址:http://www.ex-cimer.com/article/201611/318211.htm

          如果說系統(tǒng)內(nèi)核是航天飛機的話,那么bootloader就是助推器,它帶動了內(nèi)核。在內(nèi)核啟動之前它要做許多硬件的初始化操作,來適合系統(tǒng)的安全啟動。

          2、bootloader設計方法-模仿

          90%的設計從模仿開始,模仿加入自己的想法就是設計。bootloader的模仿我們一般會參照行業(yè)老大uboot。

          3、uboot簡介

          uboot可以支持多種嵌入式cpu,例如X86、ARM、MIPS

          還可以支持多種嵌入式操作系統(tǒng),例如wince、linux、vxworks、QNX

          uboot分為自主模式和開發(fā)模式:自主模式下,uboot的運行不需要人的參與,這往往也是產(chǎn)品模式。

          開發(fā)模式是供開發(fā)人員使用,對uboot進行修改,來適應自己的需要。

          4、uboot的查看

          我們一般會使用sourceinsight來查看相對比較大的程序,它可以自動定位函數(shù)位置。這方便了我們的查找。

          二、ARM的啟動流程

          為什么要關心ARM的啟動流程

          這是因為軟件的設計要遵循硬件的要求。滿足硬件的一些要求。

          主要從三個方面進行介紹:1、啟動方式 2、地址布局 3、啟動流程

          幾點說明:一上電,處理器會從0地址開始讀取指令并執(zhí)行。 Nandflash不參與統(tǒng)一編址。

          2440:

          1、啟動方式:Norflash Nandflash

          2、內(nèi)存地址從00x30000000開始

          3、啟動流程(來自手冊):s3c2440A boot code can be executed on an external NAND flash memory. In order to support nand flash bootloader, the s3c2440A is equipped with an internal SRAM buffer called "steppingstone". When booting, the first 4 KBytes of the NAND flash memory will be loaded into steppingstone and the boot code loaded into stippingstone will be executed.

          Generally, the boot code will copy NAND flash content to SDRAM. the main program will be executed on the SDRAM.

          6410:

          1、啟動方式:SROM、OneNAND、MODEM、IROM(NAND、SD)

          2、bootloader的起始地址0x0C000000, 之前的為internal ROM。0地址處為映像區(qū)。DRAM起始地址為0x50000000.

          3、a、iROM supportsinitialboot up : initialize system clock, D-TCM, device specific controller and booting device.

          b、iROM boot codes can load4KBof bootloader tostepping stone. The8 KBbootloader is called BL1.

          c、BL1:BL1 can initialize system clock, UART, and SDRAM for user. After initializing, BL1 will load remaining boot loader which is calledBL2on theSDRAM

          d、Finally,jump to start address of BL2. That will make good environment to use system.

          210:

          1、啟動方式:同6410

          2、地址布局:0地址處為Boot area,內(nèi)存地址從0x20000000開始。

          3、啟動流程:a、iROM can do initial boot up : initialize system clock, device specific controller and booting device.

          b、b、iROM boot codes can load boot-loader to SRAM. The boot-loader is called BL1. then iROM verify integrity of BL1 in case of secure boot mode.

          c、BL1 will be executed: BL1 will load remained boot loader which is called BL2 on the SRAM then BL1 verify integrity of BL2 in case of secure boot mode.

          d、BL2 will be executed: BL2 initialize DRAM controller then load OS data to SDRAM

          e、finally, jump to start address of OS. that will make good environment to use system.

          三、Uboot 工作流程分析

          1、程序入口

          2、第一階段程序分析

          3、第二階段程序分析

          也就是上面談到的BL1和BL2,這兩部分也是要我們自己來編寫的部分。BL0廠家已固化在硬件中,就不需要我們自己編寫了。

          2440

          1、查看兩個文件

          1、uboot下的Makefile

          2、uboot/board/samsung/smdk2440/uboot.lds下查看代碼段首文件,ENTRY標明程序入口(鏈接器腳本),start.S(cup/s3c24XX/start.o(.text))。

          2、BL1分析(入口start.S 中 _start)

          使用source Insight

          分析/cpu/s3c24XX/start.S

          提示:start.S中設置堆棧為c語言做鋪墊。

          1、設置中斷向量表

          2、設置處理器為SVC模式

          3、刷新I/D cache

          4、關閉mmu和cache

          5、初始化系統(tǒng)時鐘

          6、初始化串口

          7、簡單初始化nand flash

          8、進行內(nèi)存初始化

          9、nand flash中的bl到內(nèi)存

          10、設置堆棧

          11、清除bss段

          3、BL2分析(入口start_armboot)

          1、初始化串口

          2、LCD初始化

          3、初始化網(wǎng)卡

          4、初始化LED

          5、執(zhí)行用戶輸入命令(死循環(huán),一直等待用戶的使用)

          6410同2440幾乎有同樣的工作,不過執(zhí)行的先后順序和方式不同。而210是新版本的U-boot,它的BL1、BL2分別產(chǎn)生了兩個.bin文件。它有廠家固化的irom,BL1被到iram中,BL2被到內(nèi)存中。

          三、Bootloader架構設計

          在進行設計之前,我們遵循的原則:盡量歸類整理,分階段去完成。還就是要盡早的使用c語言這樣編程比較簡單些。下面是思維導圖:



          評論


          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();