• u-boot中debug的一些总结


       研究u-boot,首要搞清楚的是代码的流程,运行流程是什么样子的呢?不知道,就看log。这就要把log信息

    打开。研究u-boot的文件,发现里面是很多DEBUG宏定义的打印,这个打印着怎么打开呢?

        其实很简单,只需要把文件include/common.h中加上这句话即可:

      #define DEBUG //记得喔,这个语句要加载一行上面才行。

       

     1 #ifdef DEBUG  
     2 #define _DEBUG  1  
     3 #else  
     4 #define _DEBUG  0  
     5 #endif  
     6   
     7 #ifndef pr_fmt  
     8 #define pr_fmt(fmt) fmt  
     9 #endif  
    10   
    11 /*  
    12  * Output a debug text when condition "cond" is met. The "cond" should be  
    13  * computed by a preprocessor in the best case, allowing for the best  
    14  * optimization.  
    15  */  
    16 #define debug_cond(cond, fmt, args...)            
    17     do {                          
    18         if (cond)                 
    19             printf(pr_fmt(fmt), ##args);      
    20     } while (0)  
    21   
    22 #define debug(fmt, args...)           
    23     debug_cond(_DEBUG, fmt, ##args)  

      另外一个间接的查看谁被编译的方式:只需到该目录下,ls -al *.o,即可确认真正被调用的函数。

    因为该函数被编译了,就会生成.o文件。

  • 相关阅读:
    Python JSON的基本使用
    python socket函数详解
    python关于字符编码的基本操作
    关于git的一些简单命令
    CS和BS结构的优缺点
    Web测试详细点
    详解SESSION与COOKIE的区别
    如何测试一个网页登陆界面
    二层交换机、三层交换机和路由器的原理及区别
    LSA分类
  • 原文地址:https://www.cnblogs.com/dylancao/p/8673601.html
Copyright © 2020-2023  润新知