U-BOOT移植的經(jīng)驗之談
(說明:頂行寫的為需要修改的文件名 空一個TAB鍵寫的內(nèi)容中行前沒有標(biāo)記的為原樣抄的內(nèi)容,做定位用的,行前加‘-’號的為要修改的內(nèi)容,行前加‘+’號的為修改后的內(nèi)容。所以實際上是按照patch文件的書寫方式來做的修改,便宜理解,也能夠說的更清楚點,省的多花文字來描述,寫代碼還是挺直接的)
本文引用地址:http://m.butianyuan.cn/article/201611/323264.htmboard/44b0/44b0/44b0.c boot_params = 0x0c000100board/44b0/44b0/config.mk TEXT_BASE = 0x0c300000board/44b0/44b0/Makefile OBJS := 44b0.o flash.oboard/44b0/44b0/lowlevel_init.S Tcos = 11 = 0x3 (4clk) Tacc = 001 = 0x1 (2clk) Toch = 0 (0clk) Tcah = 0 (0clk) Trcd = 01 (2clk) Trp = 00 (2clk) Trc = 11 (7clk) MCLK = 40MHz refresh_count = 1424 BWSCON_val = 0x11110090 最后三個 .word 0x16 .word 0x20 .word 0x20board/44b0/common/flash.c 把所有的#ifdef CONFIG_B2改成#ifdef CONFIG_44b0(板子名稱)cpu/s3c44b0/config.mk (gcc版本過低,編譯時報錯時:) -PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) +PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=pacs-gnu))cpu/s3c44b0/serial.c void serial_setbrg(void) { switch(gd->baudrate) case 115200: divisor = 21 ;Mclk = 40Mhz }cpu/s3c44b0/start.S(vectors_base = 0x0c0000008) ldr r1,=LOCKTIME ldr r0,=2000 str r0,[r1] ldr r1,=PLLCON ldr r0,=0x48032 ;Mclk=40Mhzinclude/configs/44b0.h (cp B2.h) -#define CONFIG_B2 +#define CONFIG_44b0 -#define CONFIG_S3C44B0_CLOCK_SPEED 75 +#define CONFIG_S3C44B0_CLOCK_SPEED 40 -#define CONFIG_DRIVER_LAN91C96 -#define CONFIG_LAN91C96_BASE 0x04000300 +#define CONFIG_DRIVER_RTL8019 +#define RTL8019_BASE 0x06000300 -#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_DATE | CFG_CMD_ELF | CFG_CMD_EEPROM | CFG_CMD_I2C) +define CONFIG_COMMANDS ( CONFIG_CMD_DFL|CONFIG_CMD_DATE|CONFIG_CMD_NET|CONFIG_CMD_ENV|CONFIG_CMD_FLASH) 注:如采用上述的|換行,可能有的編譯的時候會報錯,我的就會,所以采用單行書寫 -#define CONFIG_BOOTFILE "~~~`" +#define CONFIG_BOOTFILE "uclinux.bin" -#define CONFIG_BOOTCOMMAND "bootm 20000 f0000" +#define CONFIG_BOOTCOMMAND "bootm 50000" -#define CFG_MEMTEST_START 0x0c400000 //還不明白這個定義是什么意思 -#define CFG_MEMTEST_END 0x0c800000 //如果刪除的話,編譯的時候會報錯 +#define CFG_MEMTEST_START 0x0c000000及//所以還是留著吧,適當(dāng)?shù)亩x一下 +#define CFG_MEMTEST_END 0x0c100000 //也不知道會有什么影響 -#define CFG_LOAD_ADDR 0x0c700000 +#define CFG_LOAD_ADDR 0x0c008000 -#define PHYS_SDRAM_1 0xc0000000 -#define PHYS_SDRAM_1_SIZE 0x01000000 -#define PHYS_FLASH_1 0x00000000 -#define PHYS_FLASH_SIZE 0x00400000 +#define PHYS_SDRAM_1 0x0c000000 +#define PHYS_SDRAM_1_SIZE 0x00800000 +#define PHYS_FLASH_1 0x00000000 +#define PHYS_FLASH_SIZE 0x00200000 -#define CFG_MAX_FLASH_SECT 256 +#define CFG_MAX_FLASH_SECT 32 -#define CFG_ENV_IS_IN_EEPROM 1 -#define CFG_ENV_OFFSET 0x0 +#define CFG_ENV_IS_IN_FLASH +#undef CFG_ENV_IS_NOWHERE +#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x20000) +#define CFG_ENV_SECT_SIZE 0x10000 +#define CFG_MONITOR_BASE PHYS_SDRAM_1 ;ENV IS NOT IN EEPROM /tools/envcrc.cMakefile ifeq($(ARCH),arm) -CROSS_COMPILE = arm-linux- +CROSS_COMPILE = arm-elf- B2_config : unconfig @./mkconfig $(@:_config=) arm s3c44b0 B2 dave +44b0_config : unconfig #./mkconfig $(@:_config=) arm s3c44b0 44b0 44b0lib_arm/board.c +#include static int display_banner(void) { #endif 后加上一段代碼:LED指示燈亮,蜂鳴器關(guān) PCONE |= (1<<10); pe5=pcon(10:11) PCONE &= ~(1<<11); PDATE &= ~(1<<5); ;beep=gpe5 //led0=pc1 led1=pc2 led2=pc3 PCONC |= ((1<<2)|(1<<4)|(1<<6)); //pconc[1:2:3]=PCONC[765432]output=01 PCONC &= ~((1<<3)|(1<<5)|(1<<7)); PDATC |= (1<<1); pdatc1=PDATC[1]=1 led0=light }
按照這個修改后的U-BOOT大概功能是齊全的,也算是成功移植吧 至于到底是不是,還要繼續(xù)驗證了。
另外,由于板子上網(wǎng)卡壞了,所以就沒有去修改網(wǎng)卡相關(guān)的了。以后用到的話再說吧~~
評論