- Android系統(tǒng)級深入開發(fā)
- 韓超 梁泉
- 347字
- 2018-12-29 13:39:32
4.2 GoldFish體系結(jié)構(gòu)移植
GoldFish處理器是ARM體系結(jié)構(gòu)的一種“機器”,這種“機器”的代碼在arch/arm/mach-goldfish/目錄中,相關(guān)的頭文件在arch/arm/mach-goldfish/include/mach目錄中。
arch/arm/mach-goldfish/目錄中的Kconfig是GoldFish的主配置文件,內(nèi)容如下所示:
if ARCH_GOLDFISH menu "Goldfish Options" config MACH_GOLDFISH bool "Goldfish (Virtual Platform)" select CPU_ARM926T config MACH_GOLDFISH_ARMV7 bool "Goldfish ARMv7 (Virtual Platform)" select CPU_V7 select VFP select VFPv3 select NEON endmenu endif
當(dāng)ARCH_GOLDFISH宏被使能的時候,可以選擇兩種GoldFish處理器,一種由MACH_GOLDFISH表示,一種由宏MACH_GOLDFISH_ARMV7表示。前者是一種ARMV5E體系結(jié)構(gòu)的ARM926處理器,后者是ARMV7體系結(jié)構(gòu)的處理器(即Cortex A),使能了VFP和NEON等特性。在一般情況下,使用MACH_GOLDFISH即可。
arch/arm/mach-goldfish/目錄中Makefile的內(nèi)容如下所示:
obj-y := pdev_bus.o timer.o switch.o audio.o pm.o obj-$(CONFIG_MACH_GOLDFISH) += board-goldfish.o obj-$(CONFIG_MACH_GOLDFISH_ARMV7) += board-goldfish.o
arch/arm/mach-goldfish/board-goldfish.c是GoldFIsh機器實現(xiàn)的核心文件,機器類型的定義如下所示:
MACHINE_START(GOLDFISH, "Goldfish") .phys_io = IO_START, .io_pg_offst = ((IO_BASE) >> 18) & 0xfffc, .boot_params = 0x00000100, .map_io = goldfish_map_io, .init_irq = goldfish_init_irq, .init_machine= goldfish_init, .timer = &goldfish_timer, MACHINE_END
在MACHINE_START和MACHINE_END之間的內(nèi)容為機器的信息。這里實現(xiàn)的結(jié)構(gòu)是arch/arm/include/asm/mach/arch.h中定義的struct machine_desc。這里賦值了定時器、物理IO等內(nèi)容,以及初始化機器、初始化irq、IO映射等函數(shù)指針。
推薦閱讀
- Expert C++
- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- 數(shù)據(jù)結(jié)構(gòu)和算法基礎(chǔ)(Java語言實現(xiàn))
- Selenium Design Patterns and Best Practices
- 小程序,巧運營:微信小程序運營招式大全
- 編譯系統(tǒng)透視:圖解編譯原理
- Getting Started with Python Data Analysis
- C++從入門到精通(第5版)
- RubyMotion iOS Develoment Essentials
- Delphi開發(fā)典型模塊大全(修訂版)
- 零基礎(chǔ)輕松學(xué)C++:青少年趣味編程(全彩版)
- 從零開始:C語言快速入門教程
- Ionic3與CodePush初探:支持跨平臺與熱更新的App開發(fā)技術(shù)
- 一步一步學(xué)Spring Boot:微服務(wù)項目實戰(zhàn)(第2版)
- Mastering Clojure