修正 1294589 九、發明說明: 【發明所屬之技術領域】 本發明係有關一種主機板支援套件(Board Support Package,BSP ) 工具,特別是指一種應用於嵌入式系統輔助移植之通用BSP工具及其 應用方法。 【先前技術】 隨著電腦的系統效能與運算能力不斷提升,嵌入式作業系統在嵌 入式系統中扮演了很重要的一環,良好的作業系統可有效的利用系統 身源並控制執行要素。一般來說,移植是使程式可在不同硬體環境下 執行的必要程序,系統開發員為了能執行嵌入式系統,通常會移植作 業系統或應用程式到嵌入式系統中,此時會需要更動作業系统 程式碼。 /一 主機板支援套件(Board Support Package, BSP),是介於主機 板和作業系統之間的一層,屬於作業系統的一部分,主要目的是為了 支持作業系統,使之能夠運行於主機板上。Bsp是相對於硬體平台與 作業系統而言的,不同的作業系統對應於不同定義形式的卿,例如 ^xWorks和Linux系、統的BSP相對於某一處理器(pr 管實現的功能m寫法和接口定義可能完全不同。同== 同的 =台也定義了不同形式的BSP,例如Linux在不同處理器的 椹招卜H同。由於BSP的程式化過程大多數是在某—個成型的娜 、 仃L改’故編寫BSP必須按照該系統BSP的定義彡式 這樣才能與上層作«統保持正確的接口,良好支持上 ^ ARM> MIPS. XScale 個“操作“二要 計編寫觸硬觀格來設 在先則技*巾,開發貞要建立—健人式系統,通常會使用包含 1294589 薇商所提供之硬體平台、作業系統及工具組等的全方 Z二需如織人式系統中各種環境需求來修改作業系案二 時控制(real-tme c〇ntrol)或較小的佔用空間(f〇〇 二 作業系統不能滿足所有的環境需求,開發員就必須移齡 : 統到此硬體平台上來執行,㈣,要在_硬體平台上運作 亦須移誠人式制程式,在移植作職統及應陳式崎的硬體平 台上之前,開發員首先必須了解硬體平台的特徵,但硬 jMODIFICATION 1294589 IX. Description of the Invention: [Technical Field of the Invention] The present invention relates to a motherboard support package (BSP) tool, and more particularly to a universal BSP tool for embedded system assisted transplantation and its application method. [Prior Art] As the system performance and computing power of computers continue to increase, embedded operating systems play an important role in embedded systems. Good operating systems can effectively utilize system sources and control execution factors. In general, porting is a necessary program for programs to be executed in different hardware environments. In order to execute embedded systems, system developers usually migrate operating systems or applications to embedded systems. In this case, they need to be changed. System code. / One Board Support Package (BSP) is a layer between the main board and the operating system and is part of the operating system. The main purpose is to support the operating system so that it can run on the motherboard. Bsp is relative to the hardware platform and the operating system. Different operating systems correspond to different definitions. For example, ^xWorks and Linux systems, BSPs relative to a certain processor (functions written by the pr tube) And the interface definition may be completely different. The same == the same = the station also defines different forms of BSP, for example, Linux is different in different processors. Because the BSP stylization process is mostly in a certain shape Na, 仃L change', so the BSP must be written in accordance with the definition of the system BSP, in order to maintain the correct interface with the upper layer, good support on the ^ ARM> MIPS. XScale "operation" two to write a hard view Grid is set up in the first technology * towel, the development of the establishment of a health-friendly system, usually using the 1294589 Weishang provided by the hardware platform, operating systems and tools, etc. Various environmental requirements in the system to modify the operating system two-time control (real-tme c〇ntrol) or a small footprint (f〇〇 two operating systems can not meet all environmental needs, the developer must be aged: This hardware On the platform to implement, (4), to operate on the _ hardware platform, it is necessary to move the system to the human system. Before transplanting the job system and the hardware platform of Chen Shiqi, the developer must first understand the characteristics of the hardware platform. But hard j
不會主動提供相關細節,故開„必須缺對低階程式碼進 如開機程式或裝置驅動程式,此部份需花費相當的時間盘精力 前技術中並沒有可自動及緒化的方法解決移植 序可使嵌人式緖上市的準斜_短。 ,、癒移植私 山因此,本發明即針對上述習知技術之數項缺失,提出一種應用於 輔助移植之通用bsp工具及其應用方法’以有效克服上述 i琢寺問遺。 【發明内容】 本發明之主要目的在提供—種應驗狀式系統辅助移植之通用 BSP工具及其應用方法,其係可降低移植作鮮統或應用程式到嵌 硬體平台時的障礙,使市場需求多元且成長快速。 本發明之另-目的在提供—種應用於m魏輔助移植之通用 卿工ΐ及其應用方法,其係提供硬體製造商一種普通且明確的標準, 以描述嵌人式硬體的規袼特性與作㈣統關機程序。 本發明之再—目的在提供—種顧於欽式純辅助移植之通用 BSP、:r^及其應用方法,其係可分析BspxML文件中所描述之符合該嵌 入式平台硬體規袼的作鮮、統職程序,並提供—低階硬體控制函 式’可讓作業系統或翻程式在關後直接控制硬體。 、為達上述之目的,本發明提供一種應用於嵌入式系統辅助移植之 通用BSP工具及其應用方法,其係利用一 Bsp語法分析器分析一符合 胤酬之BSPBfL文件’以獲得一符合欲入式平台之硬體規袼及作業 系統或應用程式之開機程序,其中批狐文件更可藉由定義一卿文 1294589 修正 檔類型定義(Document Type Definition,DTD)來擴充延伸;再利用 了程式碼產生器接收BSp語法分析程式所產生之硬體規格與開機程序 等資訊後,產生嵌入式平台之開機程式及低階硬體控制函式,以供作 業系統或應用程式使用。 底下藉由具體實施例詳加說明,當更容易瞭解本發明之目的、技 術内容、特點及其所達成之功效。 【實施方式】It will not provide the relevant details on its own initiative. Therefore, it is necessary to enter the low-level code into the boot program or the device driver. This part takes a considerable amount of time. There is no automatic and easy way to solve the migration. The order can make the embedding type of the quasi-slanting _ short. The more the transplanted private mountain, the present invention is aimed at the above-mentioned several missing of the prior art, and proposes a universal bsp tool for assisted transplantation and its application method' In order to effectively overcome the above-mentioned problem, the main purpose of the present invention is to provide a general-purpose BSP tool for assisting transplantation of an authentication system and an application method thereof, which can reduce the transplantation to the fresh system or the application program. The obstacles in the embedded hardware platform make the market demand diversified and grow rapidly. The other object of the present invention is to provide a general-purpose tool for applying the Wei-assisted transplantation and its application method, which is a hardware manufacturer. Ordinary and unambiguous standards to describe the characteristics of embedded hardware and (4) system shutdown procedures. The re-existence of the present invention is to provide a kind of pure-assisted transplantation General BSP, :r^ and its application method, which can analyze the stencils and responsibilities of the embedded platform hardware specifications described in the BspxML file, and provide - low-order hardware control function Let the operating system or the program directly control the hardware after the closing. For the above purpose, the present invention provides a general BSP tool for embedded system assisted transplantation and its application method, which is analyzed by a Bsp parser. A BSPBfL file that meets the remuneration 'to obtain a boot code that conforms to the hardware specifications of the intended platform and the operating system or application. The batch file can be defined by defining a clear file type 1294589 (Document) Type Definition (DTD) to extend the extension; then use the code generator to receive the hardware specifications and boot programs generated by the BSp parser, and then generate the boot program and low-level hardware control functions of the embedded platform. For use by the operating system or application. The details of the present invention, technical content, features and The effect reached. [Embodiment
本發明係&供一種應用於散入式系統辅助移植之通用工具, 其係針對嵌入式硬體平台的規格及作業系統開機程序來設計,並將規 格及程序撰寫於一開放式且可重複使用的BSPXML文件中,本發明之BSP 工具係可從語法上分析BSPXML文件並產生目標平台上内嵌之作業系統 或應用程式的開機程式。 如第一圖所示,本發明所提供之通用BSP工具包括一 Bsp語法分The present invention is a general-purpose tool for use in an embedded system-assisted transplantation, which is designed for the specifications of an embedded hardware platform and an operating system booting program, and writes specifications and programs in an open and repeatable manner. In the BSPXML file used, the BSP tool of the present invention can syntactically analyze the BSPXML file and generate a boot program for the operating system or application embedded on the target platform. As shown in the first figure, the general BSP tool provided by the present invention includes a Bsp syntax score.
析器32及一程式碼產生器34,BSP語法分析器32係用以分析BspxML 文件12、22/此BSPXML文件12、22分別描述所屬嵌入式平台之硬體 規格及作業系統或應用程式之開機程序,其中Bsp狐文件12描述硬 體製造商所提供之硬體架構1〇,而腿ML文件22則描述新硬體平台 20的硬體規格;而程式碼產生器34則在接收卿語法分析器犯所產 生之硬體規格與_辦㈣訊後,產纽人式平台之開機程式及低 階硬體控制函式,以供作業系統或應用程式使用。 BSPXML文件12、22符合xml格式並具有開放及可重複使用的特 性,其中包含有四個元素:系統單晶片122、222、週邊設備丨24、224、 工具組126、226及開機程序128、228 ;在移植作業系統至不同硬體平 口的哺’如硬體平台1Q、2Q,需要使用符合該硬體平台的系統單晶 ;片122、222及週邊設備124、224,因此系統單晶片122、222及週邊 設備124、224便依此而設定。在BSpxML文件12、22中的工具組126、 226中更可包括作業系統或應用程式所需要之編譯器等工具組與 makefile 槽等。 ’、、〆、 系統單晶片122、222用以定義叙入式系統處理器之硬體規格及相 1294589 修正 ttllT ^ ^ n^ (watchdog ㈣哭考’f.體製造商亦可利用系統單晶片122、222來描述記憶體 記憶體等硬體裝置之規格’甚至啟用與停用 州二、|純式瑪亦可撰寫於系統單晶片122、222中;週邊設備⑶、 以敘述甘欠入式系統中週邊裝置,包括有通用非同步收發傳輸器 立 lversa! Asynchronous Receiver/Transmitter,UART)、快閃記 ^體及乙太網路控制器(Ethernetcontroller)等裝置。硬體製造商 二提供基本__式,在欽式平μ每-硬齡台之記憶映象皆 需詳細地描述。 而工具組126、226即用於描述每一硬體平台所需要特定之工具 組,利用交叉編譯器(cross compiler)、Unux系統最底層之應用程 式開發介面GlibC、除錯器及函式庫等低階開發工具,以產生開機程 式。而開機程序128、228則描述作業系、統或應用程式開機日夺的流程, 如將硬體初始化,可使系統開發員3〇透過程式碼產生器34產生適當 的開機程式,並將作業系統或應用程式載入記憶體中。 田 BSP 文檔類型定義(Document Type Definition, DTD) 36 在本發 明中係利用定義-合格元素列表(list Qf legal elements)來定^ BSPXML文件12、22之規則架構,BSP文檔類型定義36係通過元素宣 告(element declaration )及屬性列表宣告(attribute—Hst declaration)來定義’其中元素宣告係用以給BSpXML文件12、22中 有效之元素集合命名,並詳細說明每一元素中包含的特性資料,屬性 列表宣告則為每一宣告元素的有效屬性集合命名,包括每一屬性值 (attribute value)的類型。透過此BSP文檔類型定義36,硬體製造 商所提供之硬體架構10及系統開發員30可互換資料。一開始可先提 供一標準化的BSP文檔類型定義34,硬體製造商並提供其欲入式系統 之BSPXML文件12,當硬體製造商新增或修改硬體架構時,則可新增新 的元素或屬性到BSP文檔類型定義34中,以延展擴充β§ρ现l文件12 之内容。 因此,當出現新的硬體平台20需要進行移植(p〇r^ing)時,硬 1294589 修正 體裝造商可域此新硬齡台2G之硬體祕提供—娜胤文 作 :r:r=:== 員% 丨田件之程式語言來自動產生一開機程式碼,系統開發 社妙姑li開機程式碼編譯並連結至作業系統或應用程式,即可 釔束移植的動作,啟動新硬體平台2〇。 3〇欲_本發明將—個新的作業系統、應用程式或 =運用本务明來移植的作業系統或應用程式移植到新硬體平台20,The parser 32 and a code generator 34, the BSP parser 32 is used to analyze the BspxML files 12, 22 / the BSPXML files 12, 22 respectively describe the hardware specifications of the embedded platform and the booting of the operating system or application The program, wherein the Bsp fox file 12 describes the hardware architecture provided by the hardware manufacturer, while the leg ML file 22 describes the hardware specification of the new hardware platform 20; and the code generator 34 receives the grammar analysis. After the hardware specifications and _ do (four) news, the startup program and low-level hardware control functions of the new-style platform are used by the operating system or application. The BSPXML files 12, 22 conform to the xml format and have open and reusable features, including four elements: system single chip 122, 222, peripheral devices 24, 224, tool groups 126, 226, and boot programs 128, 228. In the transplantation operation system to the different hardware flats, such as the hardware platform 1Q, 2Q, it is necessary to use the system single crystal according to the hardware platform; the sheets 122, 222 and the peripheral devices 124, 224, so the system single wafer 122, 222 and peripheral devices 124, 224 are set accordingly. The tool sets 126 and 226 in the BSpxML files 12 and 22 may further include a tool group such as a compiler required by the operating system or the application, a makefile slot, and the like. ', 〆, system single chip 122, 222 is used to define the hardware specifications of the system processor and phase 1294589 correction ttllT ^ ^ n^ (watchdog (four) cry test 'f. body manufacturers can also use the system single chip 122, 222 to describe the specifications of hardware devices such as memory memory 'even enable and disable state two, | pure horse can also be written in the system single chip 122, 222; peripheral devices (3), to describe the owe Peripheral devices in the system include devices such as universal non-synchronous transceivers, versatile Receiver/Transmitter (UART), flash memory, and Ethernet controllers. The hardware manufacturer provides a basic __-form, and the memory map of the ping-pong-per-hard-stage station needs to be described in detail. The tool sets 126, 226 are used to describe the specific tool set required for each hardware platform, using the cross compiler, the application development interface GlibC, the debugger and the library at the bottom of the Unux system. Low-level development tools to generate boot programs. The booting programs 128 and 228 describe the process of the operating system, the system, or the application booting. If the hardware is initialized, the system developer can generate an appropriate booting program through the code generator 34, and the operating system. Or the application is loaded into memory. Field BSP Document Type Definition (DTD) 36 In the present invention, a definition-qualified element list (list Qf legal elements) is used to determine the rule structure of the BSPXML file 12, 22, and the BSP document type definition 36 is a pass element. The element declaration and the attribute-hst declaration define 'the element declaration is used to name the set of elements valid in the BSpXML files 12, 22, and specify the attribute data, attributes contained in each element. The list declaration names the valid attribute set for each announcement element, including the type of each attribute value. Through this BSP document type definition 36, the hardware architecture 10 and system developer 30 provided by the hardware manufacturer can exchange data. Initially, a standardized BSP document type definition 34, a hardware manufacturer and a BSPXML file 12 for the desired system can be provided. When the hardware manufacturer adds or modifies the hardware architecture, a new one can be added. The element or attribute is added to the BSP document type definition 34 to extend the content of the β§ρ现1 file. Therefore, when a new hardware platform 20 needs to be transplanted (p〇r^ing), the hard 1294589 modified bodybuilder can provide the hard body secret of this new hard age platform 2G-Nan Weiwen: r: r=:== 员% The language of the 丨田件 automatically generates a boot code, and the system development company 妙 li li 开机 开机 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译 编译Hardware platform 2〇. 3 〇 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
開發員30需要新硬體平台20之鹏ML文件22,此時硬體f 需提請狐中描述新硬體平台20的系統單晶片222、週ZThe developer 30 needs the ML file 22 of the new hardware platform 20, and the hardware f needs to draw the system single chip 222 describing the new hardware platform 20 in the fox, Zhou Z
時-要==的部分,系統開發員3°在第一次移植某作業系統 寫丨狐文件來描述其開機程序228。往後若要移植 文件有新硬體平台20時,則可使用先前所撰寫之贿ML 二二ίΓ後’其BSPXML文件的開機程序描述228可再次利用於不 的移植,達到重複使_目的,免軸前技術中系統開發 :、子不同系統之間的移植時,需要了解多種硬體平台與作業系統 j用程式架構的困難,利用本發明,系統開發員30可不費力的移植 、曰通的作業系統或應用程式到一喪入式平台上。 凊同時參考第二圖所示,其為本發明可提供之低階函式40,在作 業糸統核心' (OS kernel)巾利用此些低階函式4〇以控制新硬體平台 20 ’如§丨時n戚化、啟用鱗敎憶體控㈣及巾斷等,這些低階 ,式40更可在開機後運用於作業系統及應用程式中,系統開發員-3〇 ^用這些低階函式4G的幫助,可輕跡植低階硬體㈣函式以簡化作 業系統低階函式移植的程序。 第二圖為一 BSPXML文件實施例之部分程式碼,直中詳述了 M— Inc.所製駐機板之硬體規格,其中與系統單晶片元素處 理程序有關之處理器模式、中斷模式與遮罩及監時器(watcM〇gtimer) 1294589 修正 等設定皆描述於系統單晶片中;BSPXML文件中0CF(〇n Chip Functi〇ns) 元素係用於疋義晶片上的控制函式,如SetProcessorModeUsr函式定 義轉換處理器到使用者模式(usermocie),Timerinit相關函式用以將 晶片上之計時器初始化。硬體製造商需提供以組合語言或c語言所撰 寫之0CF函式。 ° ' 第四圖為撰寫於BSPXML文件中作業系統的開機程序,使Bsp工具 可產生適當的開機程式碼。其中ENV一VAR中所包含之程式碼係定義; 業系統中之環境變數,如記憶體規劃,ιΝΙΤ一HEAD& INITJ:MAIN中之 程式碼則定義了利驗合語言及C語言有順序的描述作#系統開機流 程兩個部分。利用這些函式,作業系統不需要很詳細的硬體規格細節 即可對新硬體平台進行初始化,使移植更容易。在第四圖之實施例中, miT—HEAD函式先將處理程序轉為svc模式,再將監時器及中斷等命令 停止;接著執行的INIT—CMAIN函式則繼續初始化該新硬體平台,最後", 在結束所有開機程序的執行後,開機程式碼返回由作業系統控制。 I BSPXML是由BSP文檔類型定義來界定規則,第五圖為Bsp文檔類 型定義之實施例,敘述了 BSP文檔類型定義中系統單晶片元素及其子 π素0CF及FUNC。必要的屬性皆被清楚的定義在Bsp文檔類型定義中, 使硬體製造商、系統開發員及作業系統的程式員皆可瞭解BspxML的語 法從而使用BSPXML文件。 °° 唯以上所述者,僅為本發明之較佳實施例而已,並非用來限定本 ^明只知之範圍。故即凡依本發明申請範圍所述之特徵及精神所為之 均等變化或修飾,均應包括於本發明之申請專利範圍内。 【圖式簡單說明】 第一圖為本發明所提供之通用BSP工具與硬體平台之示意圖。 第二圖為本發明可提供之低階函式示意圖。 ,二圖為本發明中系統單晶片元素之部分BSPXML文件之實施例。 第四圖為本發明中開機程序元素之部分BSPXML文件之實施例。 第五圖為本發明中部份BSP文檔類型定義之實施例。 1294589 修正本 【主要元件符號說明】 ίο硬體製造商所提供之硬體架構 12 BSPXML 文件 122 系統單晶片(System on chip, S〇C) A 124週邊設備 . 126工具組 128開機程序 20新硬體平台 22 BSPXML 文件 222 系統單晶片(System on chip,SoC) 224週邊設備 226工具組 228開機程序 30系統開發員 32 BSP語法分析器 34程式碼產生器 36 BSP文檔類型定義 38輸出端 40低階函式Time-to-== part of the system developer 3° in the first migration of a certain operating system to write a fox file to describe its boot process 228. If you want to migrate files to the new hardware platform 20 in the future, you can use the previously written bribe ML 2 Γ ' ' 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其 其System development in front-of-axis technology: When transplanting between different systems, it is necessary to understand the difficulty of using various hardware platforms and operating system j. With the present invention, system developer 30 can easily transplant and communicate. The operating system or application goes to a immersive platform. Referring to the second figure, it is a low-order function 40 that can be provided by the present invention. In the core of the operating system, the low-order functions are used to control the new hardware platform 20'. Such as § 丨 戚 戚 、 、 启用 启用 、 、 、 、 、 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 这些 , , , , , , , , , , , , With the help of the 4G function, the low-order hardware (4) function can be lightly simplified to simplify the procedure of the low-order function migration of the operating system. The second figure is a partial code of a BSPXML file embodiment, which details the hardware specifications of the resident board made by M-Inc., and the processor mode and interrupt mode related to the system single-chip element processing program. Masks and timers (watcM〇gtimer) 1294589 Correction settings are described in the system single-chip; 0CF (〇n Chip Functi〇ns) elements in the BSPXML file are used for control functions on the wafer, such as SetProcessorModeUsr The function defines the conversion processor to user mode (usermocie), which is used to initialize the timer on the wafer. Hardware manufacturers are required to provide the 0CF function written in a combined language or C language. ° 'The fourth picture is the boot program of the operating system written in the BSPXML file, so that the Bsp tool can generate the appropriate boot code. Among them, the code system definition contained in ENV-VAR; the environmental variables in the industry system, such as memory planning, the code in ITO& INITJ:MAIN, defines the sequential description of the language and C language. Make #system boot process two parts. With these functions, the operating system does not require very detailed hardware specification details to initialize the new hardware platform, making porting easier. In the embodiment of the fourth figure, the miT-HEAD function first converts the processing program into the svc mode, and then stops the timer and interrupt commands; then the executed INIT_CMAIN function continues to initialize the new hardware platform. , and finally ", after the execution of all boot programs, the boot code return is controlled by the operating system. I BSPXML is defined by the BSP document type definition, and the fifth figure is an embodiment of the BSP document type definition. The system single-chip element and its sub-π 0CF and FUNC are described in the BSP document type definition. The necessary attributes are clearly defined in the Bsp document type definition, allowing hardware manufacturers, system developers, and operating system programmers to understand the BspxML syntax and use BSPXML files. The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention. Therefore, any changes or modifications of the features and spirits of the present invention should be included in the scope of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS The first figure is a schematic diagram of a general BSP tool and a hardware platform provided by the present invention. The second figure is a schematic diagram of a low-order function that can be provided by the present invention. The second figure is an embodiment of a partial BSPXML file of a system single-chip element in the present invention. The fourth figure is an embodiment of a partial BSPXML file of the booting program element in the present invention. The fifth figure is an embodiment of a partial BSP document type definition in the present invention. 1294589 Revised [Main component symbol description] ίο Hardware architecture provided by hardware manufacturer 12 BSPXML file 122 System on chip (S〇C) A 124 peripheral device. 126 Tool set 128 boot program 20 new hard Body platform 22 BSPXML file 222 System on chip (SoC) 224 Peripheral device 226 Tool set 228 Boot program 30 System developer 32 BSP parser 34 Code generator 36 BSP document type definition 38 Output 40 low order Function