每次碰上问题,都要花上很长时间去寻找答案。从上周五开始到今天,除去周末两天回家,我一直被一个blamed bug困扰。其实这个问题不能叫做bug,只是因为碰到的bug太多叫习惯了,应该称之为a mistake更贴切些。


连“Uncompressing Linux…”都没有出现。
ZTEXTADDR 0x00010000
ZREALADDR 0x0C008000
ZBSSADDR 0x0C400000


在 boot loader 程序的设计与实现中,没有什么能够比从串口终端正确地收到打印信息能更令人激动了。此外,向串口终端打印信息也是一个非常重要而又有效的调试手段。但是,我们经常会碰到串口终端显示乱码或根本没有显示的问题。造成这个问题主要有两种原因:(1) boot loader 对串口的初始化设置不正确。(2) 运行在 host 端的终端仿真程序对串口的设置不正确,这包括:波特率、奇偶校验、数据位和停止位等方面的设置。

此外,有时也会碰到这样的问题,那就是:在 boot loader 的运行过程中我们可以正确地向串口终端输出信息,但当 boot loader 启动内核后却无法看到内核的启动输出信息。对这一问题的原因可以从以下几个方面来考虑:

(1) 首先请确认你的内核在编译时配置了对串口终端的支持,并配置了正确的串口驱动程序。

(2) 你的 boot loader 对串口的初始化设置可能会和内核对串口的初始化设置不一致。此外,对于诸如 s3c44b0x 这样的 CPU,CPU 时钟频率的设置也会影响串口,因此如果 boot loader 和内核对其 CPU 时钟频率的设置不一致,也会使串口终端无法正确显示信息。

(3) 最后,还要确认 boot loader 所用的内核基地址必须和内核映像在编译时所用的运行基地址一致,尤其是对于 uClinux 而言。假设你的内核映像在编译时用的基地址是 0xc0008000,但你的 boot loader 却将它加载到 0xc0010000 处去执行,那么内核映像当然不能正确地执行了。

(1) 内核配置时已经设置了CONFIG_SERIAL_S3C44B0X和CONFIG_SERIAL_S3C44B0X_CONSOLE,即内核已支持串口端。
(2) 因为bootloader中已经能正常使用串口,所以内核中就没有再对串口进行初始化设置,因此不存在设置不一致的问题。而CPU的时钟频率我统一设置为60MHz。
(3) 内核尚未解压,因此该问题不用考虑。 


把bootloader中的打印函数移到内核中,命名为test_serial,并设置head.S中start的第一句为bl test_serial,但是仍然没有字符出现。

if(data==’\n’) { while(!(rUTRSTAT0 & 0x2)); Delay(10); //because the slow response of hyper_terminal WrUTXH0(‘\r’); } while(!(rUTRSTAT0 & 0x2)); //Wait until THR is empty. Delay(5); WrUTXH0(data);


#define WrUTXH0(ch) (*(volatile unsigned char *)(0x1d00023))=(unsigned char)(ch)


12 static int s3c44b0x_putc(char c) 13 { 14 while (!(SYSREG_GET(S3C44B0X_UTRSTAT0) & 0x2)); 15 SYSREG_SETB(S3C44B0X_UTXH0, c); 16 if(c == ‘\n’) 17 s3c44b0x_putc(‘\r’); 18 }


287 #ifdef CONFIG_CPU_BIG_ENDIAN 288 #define S3C44B0X_UTXH0 0x01d00023 289 #define S3C44B0X_URXH0 0x01d00027 290 #else 291 #define S3C44B0X_UTXH0 0x01d00020 292 #define S3C44B0X_URXH0 0x01d00024 293 #endif

没找到CONFIG_CPU_BIG_ENDIAN,应该是LITTLE ENDIAN,发现地址和bootloader中不一样:0x01d00020。

287 #ifdef CONFIG_CPU_BIG_ENDIAN 288 #define S3C44B0X_UTXH0 0x01d00023 289 #define S3C44B0X_URXH0 0x01d00027 290 #else 291 #define S3C44B0X_UTXH0 0x01d00023 292 #define S3C44B0X_URXH0 0x01d00027 293 #endif



15 static int s3c44b0_putc(char c) 16 { 17 CSR_WRITE(DEBUG_TX_BUFF_BASE, c); 18 while(!(CSR_READ(DEBUG_CHK_STAT_BASE) & DEBUG_TX_DONE_CHECK_BIT)); 19 20 if(c == ‘\n’) 21 s3c44b0_putc(‘\r’); 22 }


#define DEBUG_TX_BUFF_BASE (Base_Addr+0x104020) #define DEBUG_RX_BUFF_BASE (Base_Addr+0x104024) #define DEBUG_UARTLCON_BASE (Base_Addr+0x104000) #define DEBUG_UARTCONT_BASE (Base_Addr+0x104004) #define DEBUG_UARTBRD_BASE (Base_Addr+0x104028) #define DEBUG_CHK_STAT_BASE (Base_Addr+0x104010)


12 static int s3c44b0x_putc(char c) 13 { 14 while (!(SYSREG_GET(S3C44B0X_UTRSTAT1) & 0x2)); 15 SYSREG_SETB(S3C44B0X_UTXH1, c); 16 if(c == ‘\n’) 17 s3c44b0x_putc(‘\r’); 18 }



Uncompressing Linux……………………….. done, booting the kernel.


— EOF —


  1. After study a couple of of the weblog posts on your website now, and I really like your approach of running a blog. I bookmarked it to my bookmark web site record and can be checking again soon. Pls try my website online as nicely and let me know what you assume.:visit our site: http://jericbox.com

  2. Kundenservice wird bei uns groß geschrieben, daher nehmen wir uns die Zeit, die Sie zur Beantwortung Ihrer Fragen benötigen und beraten Sie ausführlich zu der 24 Stunden Pflege im eigenen Zuhause.

  3. Kein Wunder – außer vielleicht Ladykrachern fällt mir da beim besten Willen nichts ein.

  4. Match designer along with the girl fresh man The nike jordan, who hitched on the 6th associated with September this holiday season within an outdoor ceremony, then refreshments and video game titles along with a nighttime underneath Hugo Boss. I just now love precisely how upon every snapshot Jess is usually either laughing as well as smiling suit in order to break open, or maybe wiping happy cry away- it’s consequently lovely!

  5. garcinia rev forskolin uses green coffee slimming acai quick burn reviews vemma mangosteen side effects hoodia gordonii seeds for sale zero fiber zap cloth chitosan 250 is guar gum whole 30 approved lipozene 30-day free trial glucomannan 1000mg

  6. where to buy slendera pure garcinia cambogia and natural cleanse forskolin dr mercola green coffee cleanse ultra with flax seed acai cleanser mangosteen for the liver hoodia gordonii cactus powder incense for sale coffee enema instructions chitosan japan manufacturer of optical devices guar gum köpenhamn hovedstaden do lipo den injections work vitamins japan

  7. I have been exploring for a little bit for any high quality articles or blog posts on this sort of area . Exploring in Yahoo I at last stumbled upon this site. Reading this information So i am happy to convey that I’ve an incredibly good uncanny feeling I discovered just what I needed. I most certainly will make certain to do not forget this website and give it a look on a constant basis.

  8. Enjoyed looking through this, very good stuff, regards . “Whenever you want to marry someone, go have lunch with his ex-wife.” by Francis William Bourdillon.

  9. What i do not realize is in truth how you’re no longer actually much more neatly-favored than you might be right now. You are so intelligent. You already know therefore significantly with regards to this subject, produced me in my view imagine it from numerous various angles. Its like women and men don’t seem to be interested unless it is something to do with Girl gaga! Your personal stuffs nice. Always care for it up!

  10. Nicht zu Unrecht, denn dieses Symptom kann sowohl harmlos sein als auch auf eine Erkrankung an Brustkrebs oder gar einen Herzinfarkt sein.


电子邮件地址不会被公开。 必填项已用*标注