uboot阶段日志信息的打开方法:
t7\lichee\brandy\u-boot-2014.07\include\common.h
#define DEBUG //添加这个语句
#ifdef DEBUG
#define _DEBUG 1
#else
#define _DEBUG 0
#endif
t7\lichee\brandy\u-boot-2014.07\include\mydebug.h
t7\lichee\brandy\u-boot-2014.07\include\configs\sun8iw17p1.h
t7\lichee\brandy\u-boot-2014.07\board\sunxi\common\debug_mode.c
原因:
t7\lichee\brandy\u-boot-2014.07\common\board_f.c
t7\lichee\brandy\u-boot-2014.07\common\console.c
/* Called before relocation - use serial functions */
int console_init_f(void)
{
gd->have_console = 1;
int dram_size;
uint debug_buf_base= 0;
uint offset = 0, i = 0;
uint cpu_buf_size[MAX_CPU_CNT] = \
{CPU0_BUF_SIZE,CPU1_BUF_SIZE,CPU2_BUF_SIZE,CPU3_BUF_SIZE};
#ifdef CONFIG_SILENT_CONSOLE
if (getenv("silent") != NULL)
gd->flags |= GD_FLG_SILENT;
#endif
print_pre_console_buffer();
//if it is not boot mode, set debug enable
if(uboot_spare_head.boot_data.work_mode != WORK_MODE_BOOT)
return 0;
//if the dram size is 0, set debug enable
dram_size = uboot_spare_head.boot_data.dram_scan_size;
if (!dram_size)
return 0;
//if user input 's', set debug enable
//这里是输入s字符将是终端shell模式
if (uboot_spare_head.boot_ext[0].data[1] == 's') {
gd->force_shell = 1;
return 0;
}
//if user selete, set debug enable
//maybe: user set sysconfig
//maybe: user press keyboard 'd' or 's'
//'d': only show debug information
//输入字符d是debug信息显示模式,修改这里即可。这里直接返回即可打开串口调试信息
debug_level = uboot_spare_head.boot_ext[0].data[3];
if (debug_level)
{
return 0;
}
debug_buf_base = (CONFIG_SYS_SDRAM_BASE + dram_size * 1024 * 1024 - CONFIG_SUNXI_DEBUG_BUF_SIZE);
memset((void*)debug_buf_base, 0, CONFIG_SUNXI_DEBUG_BUF_SIZE);
offset = debug_buf_base;
for(i = 0; i < MAX_CPU_CNT; i++)
{
debug_info[i].debug_addr = offset;
debug_info[i].max_len = cpu_buf_size[i];
offset += cpu_buf_size[i];
}
debug_level = 0;
return 0;
}
t7\lichee\brandy\u-boot-2014.07\lib\trace.c
以上是大概出现的地方,最后修改如下:
t7\lichee\brandy\u-boot-2014.07\common\console.c
原因如下:
即
#define DEBUG_ENABLE 1
决定了serial_printf()函数和puts(const char *s)函数是空还是运行打印。直接打开这个开关即可。
内核阶段串口日志的打开方法:
t7\lichee\tools\pack\chips\sun8iw17p1\configs\default\env.cfg