Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux 程式設計 >> Linux 程式設計

把 WINCE 的 Stepldr 從 S3C2440A 移植到 S3C2410A:以 .bib 配置為切入點

三星提供的 S3C2440A BSP 裡有一個 Stepldr 引導程式,我已經把它成功移植到 S3C2410A 上。需要動的地方集中在 NAND Flash 驅動部分,原因很單純:兩顆 IC 的 NAND 暫存器不同,S3C2440A 的暫存器比較豐富,S3C2410A 則精簡許多。本文先從 Stepldr.bib 的配置說起。

檔案開頭的授權與限制說明

; Copyright (c) Microsoft Corporation. All rights reserved.
;
; NOTE: The Steppingstone loader can only be 4096 bytes in length max.
;       Romimage will need to create and page-align the .pdata section and
;       the linker generates a 1-page header on the file. In this .bib file
;       we'll call the size 0x3000, but we'll post-process the .nb0 file to
;       remove the .pdata section and the header.
;
; NOTE: The Steppingstone loader and the IPL are concatenated and stored in
;       the first two SmartMedia NAND flash blocks. If the size of either
;       loader is altered in the .bib file, the bootloader code will need
;       to be updated as it makes an assumption about the first two NAND
;       flash blocks being reserved.

MEMORY 段

MEMORY
;    Name      Start     Size      Type
;    -------   --------  --------  ----
     STEPLDR   00000000  00003000  RAMIMAGE
     STACK     33ff5800  00001000  RESERVED
     RAM       33ff0000  00001000  RAM

CONFIG 段

CONFIG
 COMPRESSION=ON
 PROFILE=OFF
 KERNELFIXUPS=ON
 ROMSTART=00000000
 ROMWIDTH=32
 ROMSIZE=00001000

MODULES 段

MODULES
;    Name    Path                                                          Memory Type
;    ----    --------------------------------------------------------------  -----------
     nk.exe  $(_TARGETPLATROOT)/target/$(_TGTCPU)/$(WINCEDEBUG)/stepldr.exe  STEPLDR

關鍵參數為什麼這樣設

請特別留意上面標示的 ROMSIZE 與 STEPLDR 的 RAMIMAGE 大小。S3C2410A 有個特性:在 NAND Flash 啟動模式下,晶片會自動把 NAND 最開頭的 4K 程式映射到內部 4K SRAM 中執行。另一方面,PB5.0 這個工具在編譯小於 4K 的程式時會出狀況,因此解法就是把 ROMSIZE 設為 4K,STEPLDR 的 RAMIMAGE 設為 12K。

如此設定後會產生 stepldr.nb0、stepldr.nb1、stepldr.nb2 三個檔案,實際燒錄只需要 stepldr.nb1 這一個。燒錄工具用 SJF2410A 這個 JTAG 工具即可。

另外,堆疊起始位址為 0x33FF5800,大小 1K,這塊保留區域不可挪作他用。

下一篇將深入分析 Stepldr 移植到 S3C2410A 的組語部分,見 https://www.linuxidc.com/Linux/2012-02/54651p2.htm

Copyright © Linux教程網 All Rights Reserved