您的位置:首页 > 其它

从零移植uboot 2017 到nuc970(第二十二天)

2017-03-30 17:55 274 查看
我想怎麼解決昨天的問題,首先要好好思考幾個問題

1.spl階段功能正常,那麼此時sysclk,串口的時鐘各是多少呢?

   

   答:從start.S開始,其中bl    lowlevel_init    /* go setup pll,mux,memory */,而其中只是關閉中斷,而非設置pll,

        到這裏還是默認的外部時鐘12MHZ,在之後的main中 設置board_init_f也是按照12mhz設置的串口波特率

        之後串口正常。

2.nuc970從外部時鐘到其他各個時鐘的設置是怎麼樣的?

   答:



          從圖可得12M的時鐘會經過APLL和UPLLh或者直接給uart0提供時鐘,而我並沒有設置pll且CLK_DIVCTL0中採取默認值,所以串口設備使用12M默認外部時鐘

     3 .我昨天記錄的問題到底是什麼導致的?  

   答: 通過不斷的嘗試和鎖定在uboot2013makefile中找到一句話

     

nuc970_config:     unconfig
@mkdir -p $(obj)include $(obj)board/nuvoton/nuc970evb
@mkdir -p $(obj)nand_spl/board/nuvoton/nuc970evb
@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
@echo "RAM_TEXT = 0xE00000" >> $(obj)board/nuvoton/nuc970evb/config.tmp
@$(MKCONFIG) nuc970_evb arm arm926ejs nuc970evb nuvoton nuc970
@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
也就是說,ram_text被指定到0xe00000,問題就在這裏,而這裏只是生成config.temp 會被其他makefile使用,

在相應的目錄下看config.mk發現

sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp

ifndef CONFIG_NAND_SPL
CONFIG_SYS_TEXT_BASE = $(RAM_TEXT)
else
CONFIG_SYS_TEXT_BASE = 0x200

endif
所以,這裏在2017.3的頭文件修改

#define CONFIG_SYS_TEXT_BASE        0xE00000
 按道理應該會成功,嘗試下,恩成功了

loaded - jumping to U-Boot...
initcall: 1000200201000000
initcall: 1000201121202110
initcall: 1000200201002222
initcall: 1000121212221021
initcall: 1000200201001012
initcall: 1000200201212212
malloc_simple: size=220x, ptr=220x, limit=1101221x: 0x
Missing uclass for driver root_driver
dm_init() failed: -12
華麗的分割線,現在可以用串口調試主uboot
但是還是非常不行,並沒有一次順利而是出現了

loaded - jumping to U-Boot...
initcall: 1000200201000000
initcall: 1000201121201010
initcall: 1000200201002222
initcall: 1000121212221021
initcall: 1000200201001012
initcall: 1000200201212212
malloc_simple: size=220x, ptr=220x, limit=1101221x: 22010211002100010100x
malloc_simple: size=10010x, ptr=11000x, limit=1101221x: 22010211002100011020x
initcall: 1000200201010120
initcall: 1000200201212010
initcall: 1000122001122020
initcall: 1000201011020200
initcall: 1000200201210111
initcall: 1000212000022202
u boot serial success!
initcall: 1000201102210200
initcall: 1000222000021222

U-Boot 2017.03-rc3-00003-g3fd2b3a-dirty (Mar 30 2017 - 17:12:32 +0800)

initcall: 1000200201200222
U-Boot code: 1000121211021002X -> 1001011012110021X  BSS: -> 1001012201222220X
initcall: 1000121212122212
CPU: NUC972
initcall: 1000200210110222
initcall: 1000200201202121
DRAM:  initcall: 1000122001221101
initcall: 1000200202111000
Monitor len: 120220201211X
Ram size: 11200021111001111X
Ram top: 11200021111001111X
initcall: 1000200201001111
initcall: 1000200201120201
TLB table from 11200011011011020x to 11200011222122001x
initcall: 1000200201002101
initcall: 1000200201110220
Reserving 102022dk for U-Boot at: 11122120010112001x
initcall: 1000200201102021
Reserving 384k for malloc() at: 11121211011010111x
initcall: 1000200202010101
Reserving 10021u Bytes for Board Info at: 11121211011000020x
initcall: 1000200201002200
initcall: 1000200201100100
Reserving 21010u Bytes for Global Data at: 11121211010202010x
initcall: 1000200201011220
initcall: 1000200201010021
initcall: 1000200202122202
initcall: 1000200202102211
initcall: 1000200202020100

RAM Configuration:
Bank #0: 0lx Bank #1: 0lx
DRAM:  64 MiB
initcall: 1000200201010212
New Stack Pointer is: 11121211010200122x
initcall: 1000200202001011
initcall: 1000200201220011
Relocation Offset is: 10121221022020222x
Relocating to 11122120010112001x, new gd at 11121211010202010x, sp at 11121211010200122x
initcall: 11122122002000112
initcall: 11122122002000211
initcall: 1000200210101121 (relocated to 11122122002122120)
dram_bank_mmu_setup: bank: 0
dram_bank_mmu_setup: bank: 1
initcall: 1000200210022112 (relocated to 11122122002120111)
efi_runtime_relocate: Relocating to offset=11122120010112001x
efi_runtime_relocate: Setting 11200002111020210 to 11200002111101001x
efi_runtime_relocate: Setting 11200002111021020 to 11122221211011020x
efi_runtime_relocate: Setting 11200002111021112 to 11122221211011200x
efi_runtime_relocate: Setting 11200002111021211 to 11122221211011200x
efi_runtime_relocate: Setting 11200002111021222 to 11200002111101221x
efi_runtime_relocate: Setting 11200002111022010 to 11122221201212121x
efi_runtime_relocate: Setting 11200002111022102 to 11200002111022120x
efi_runtime_relocate: Setting 11200002111102211 to 11122210121201120x
efi_runtime_relocate: Setting 11200002111102222 to 11200002111012011x
efi_runtime_relocate: Setting 11200002111110010 to 11200002111011212x
efi_runtime_relocate: Setting 11200002111110021 to 11200002111011212x
efi_runtime_relocate: Setting 11200002111110102 to 11122210122100220x
efi_runtime_relocate: Setting 11200002111110120 to 11200002111012110x
efi_runtime_relocate: Setting 11200002111110201 to 11200002111012011x
efi_runtime_relocate: Setting 11200002111110212 to 11200002111012011x
efi_runtime_relocate: Setting 11200002111111000 to 11200002111012011x
efi_runtime_relocate: Setting 11200002111111011 to 11200002111012011x
efi_runtime_relocate: Setting 11200002111111022 to 11122210121201212x
initcall: 1000200202210202 (relocated to 11122122002001201)
in
4000
itcall: 1000200210020121 (relocated to 11122122002111120)
Pre-reloc malloc() used 11000lx bytes (0d KB)
using memory 11121211011010111lx-11122120010112001lx for malloc()
initcall: 1000200202211001 (relocated to 11122122002002000)
initcall: 1000200202202021 (relocated to 11122122002000020)
initcall: 1000200210012212 (relocated to 11122122002110211)
initcall: 1000200210012010 (relocated to 11122122002110002)
initcall: 1000122002002002 (relocated to 11122120101100001)
initcall: 1000212112210212 (relocated to 11122210212001211)
efi_add_memory_map: 0x0lx 0x0lx 16,384 �
efi_add_memory_map: 0x0lx 0x0lx 0 �
efi_add_memory_map: 0x10110020120111102lx 0x0lx 4,286 �
efi_add_memory_map: 0x11200002021120220lx 0x0lx 2 �
initcall: 1000202021200110 (relocated to 11122200120221102)
initcall: 1000200210011112 (relocated to 11122122002102111)
initcall: 1000200210010111 (relocated to 11122122002101110)
Now running in RAM - U-Boot at: 11122120010112001x
initcall: 1000200202211100 (relocated to 11122122002002022)
initcall: 1000200210002110 (relocated to 11122122002100102)
NAND:  running board_nand_init()
running here
running REG_HCLKEN()
running detect nand chip()
running set the default()
running get_flash_type()
run here
run here2
run here3
run here4
mafid:EC dev_id:F1
running success get_flash_type()
running check for a chip()
running the end of this function()
running mtd->writesize()
running m_i32smrasize()
running set the default()
running get_flash_type()
run here

這樣的錯誤,很顯然 set_the_default出現了錯誤,不應該再調回去執行這個函數,問題到底該怎麼確定 並不是特別有思路,是出現了指針的錯誤跳轉那麼和什麼現象有關係呢?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  u-boot 移植 框架