TI中文支持网
TI专业的中文技术问题搜集分享网站

SPL的串口输出问题

CPUAM3352-1G,调试串口使用UART0。通过串口的xmodern加载u-boot-spl.bin。

UBOOT从旧版本升级到新版本,发现串口没有输出。相同的硬件旧版本SPL是有输出的,新版本SPL没有信息。逐个版本回退,发现SDK01_00_00_03还是能正常输出,升级到SDK02_00_00_00就没有串口输出。

因为硬件设计的问题,且没有仿真器,需要修改UBOOT的SPL代码进行调试,

代码交叉对比,在SDK02_00_00_00同步SDK01_00_00_03修改以下文件,SPL可以串口输出

board.c中增加红色部分的初始化代码,从SDK01_00_00_03对应同步

void s_init(void)
{
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_RTC_ONLY_SUPPORT)
rtc_only();
#endif
/*
* The ROM will only have set up sufficient pinmux to allow for the
* first 4KiB NOR to be read, we must finish doing what we know of
* the NOR mux in this space in order to continue.
*/
#ifdef CONFIG_NOR_BOOT
enable_norboot_pin_mux();
#endif
watchdog_disable();
set_uart_mux_conf();
setup_clocks_for_console();
uart_soft_reset();
#if defined(CONFIG_NOR_BOOT) || defined(CONFIG_QSPI_BOOT)
/* TODO: This does not work, gd is not available yet */
gd->baudrate = CONFIG_BAUDRATE;
serial_init();
gd->have_console = 1;
#elif defined(CONFIG_SPL_BUILD)
gd = &gdata;
preloader_console_init();
#endif
#if defined(CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC)
/* Enable RTC32K clock */
rtc32k_enable();
#endif
#ifdef CONFIG_SPL_BUILD
board_early_init_f();
#endif
}
#endif

在以下三个文件中人为修改代码中预编译的宏定义,人为屏蔽CONFIG_DM

*****************************************

lowlevel_init.S

ENTRY(lowlevel_init)
/*
* Setup a temporary stack. Global data is not available yet.
*/
ldr sp, =CONFIG_SYS_INIT_SP_ADDR
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
#ifdef CONFIG_DM1
mov r9, #0
#else

/*
* Set up global data for boards that still need it. This will be
* removed soon.
*/
#ifdef CONFIG_SPL_BUILD
ldr r9, =gdata
#else
sub sp, sp, #GD_SIZE
bic sp, sp, #7
mov r9, sp
#endif
#endif

*******************************************

spl.h

#ifndef CONFIG_DM1
extern gd_t gdata;
#endif

********************************************

spi.c

#ifndef CONFIG_DM1
/* Pointer to as well as the global data structure for SPL */
DECLARE_GLOBAL_DATA_PTR;

/*
* WARNING: This is going away very soon. Don't use it and don't submit
* pafches that rely on it. The global_data area is set up in crt0.S.
*/
gd_t gdata __attribute__ ((section(".data")));
#endif

/*
* In the context of SPL, board_init_f must ensure that any clocks/etc for
* DDR are enabled, ensure that the stack pointer is valid, clear the BSS
* and call board_init_f. We provide this version by default but mark it
* as __weak to allow for platforms to do this in their own way if needed.
*/
void __weak board_init_f(ulong dummy)
{
/* Clear the BSS. */
memset(__bss_start, 0, __bss_end – __bss_start);

#ifndef CONFIG_DM1
/* TODO: Remove settings of the global data pointer here */
gd = &gdata;
#endif

board_init_r(NULL, 0);
}

问题:

问题1:SPL中是否不支持DM?为什么SPL又生成CONFIG_DM宏

在生成的spl/u-boot-spl.cfg中有定义“#define CONFIG_DM 1”,Device Model,而其它没有定义

#define CONFIG_DM_STDIO 1

#define CONFIG_DM_GPIO 1

#define CONFIG_DM_SEQ_ALIAS 1

#define CONFIG_DM_DEVICE_REMOVE 1

#define CONFIG_DM_WARN 1

#define CONFIG_DM_SERIAL 1

问题2:串口驱动的代码没有修改,只需要CPU和板极的初始化代码调整,即可串口输出。这是代码问题?

Daniel Yoo:

换一个方式提问,SPL的串口是否能使用嘛?

赞(0)
未经允许不得转载:TI中文支持网 » SPL的串口输出问题
分享到: 更多 (0)