uboot2021打开DEBUG

adtxl
2023-11-14 / 0 评论 / 39 阅读 / 正在检测是否收录...

uboot中定义了很多DEBUG宏控制的打印,在调试一些模块时可以打开DEBUG宏,方便查找问题。

打开方法

在include/common.h头文件中定义这个宏即可,加上下面几行

#ifndef DEBUG
#define DEBUG 
#endif

然后重新编译即可,编译的时候遇到一个小问题,提示一些符号找不到,看了下也不需要,直接注释掉了。

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 3a07f36c..ee64fbdc 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -562,7 +562,7 @@ static void vidconsole_putc(struct stdio_dev *sdev, const char ch)
        ret = vidconsole_put_char(dev, ch);
        if (ret) {
 #ifdef DEBUG
-               console_puts_select_stderr(true, "[vc err: putc]");
+//console_puts_select_stderr(true, "[vc err: putc]");
 #endif
        }
        video_sync(dev->parent, false);
@@ -579,7 +579,7 @@ static void vidconsole_puts(struct stdio_dev *sdev, const char *s)
                char str[30];
 
                snprintf(str, sizeof(str), "[vc err: puts %d]", ret);
-               console_puts_select_stderr(true, str);
+//             console_puts_select_stderr(true, str);
 #endif
0

评论 (0)

取消