fw.bin 使用 sbl.bin 中的 sbl_printf 函数
This commit is contained in:
@@ -22,6 +22,8 @@ Information is free from patent or copyright infringement.
|
||||
#define SBL_DEBUG_UART_PORT 0
|
||||
|
||||
extern struct uart_ctrl uart_e_ctrl;
|
||||
|
||||
// 这个定义在其他文件
|
||||
extern uint32_t g_is_print_enable;
|
||||
|
||||
static int (*format_str_v_fn)(const str_format_context *ctxt, const char *format,
|
||||
@@ -65,6 +67,13 @@ int8_t getc(void)
|
||||
return (int8_t)c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern str_format_context rom_log_ctxt;
|
||||
extern int rom_format_str_v(const str_format_context *ctxt, const char *format,
|
||||
va_list ap);
|
||||
|
||||
|
||||
int sbl_printf_init(void *sbl_format_str_v, void *sbl_log_ctxt)
|
||||
{
|
||||
format_str_v_fn = sbl_format_str_v;
|
||||
@@ -81,6 +90,9 @@ int32_t sbl_printf(const char *fmt, ...)
|
||||
|
||||
if (g_is_print_enable == 0)
|
||||
return 0;
|
||||
if(!format_str_v_fn){
|
||||
sbl_printf_init(rom_format_str_v, &rom_log_ctxt);
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
res = format_str_v_fn(p_log_ctxt, fmt, ap);
|
||||
|
Reference in New Issue
Block a user