[U-Boot] printf in uboot
Graeme Russ
graeme.russ at gmail.com
Mon Dec 12 22:29:33 CET 2011
Hi Siddharth,
On Tue, Dec 13, 2011 at 6:51 AM, Simon Glass <sjg at chromium.org> wrote:
> Hi,
>
> On Sun, Dec 11, 2011 at 11:51 PM, siddharth baisane
> <nov15twentyten at gmail.com> wrote:
>> hi,
>>
>> I am trying to print statement in uboot.
>> but whenever I add *printf *statement board hangs.
>> For example in *u-boot/lib_arm/board.c* i added prinf statement and board
>> hags.
>>
>>
>>
>>
>> void start_armboot (void)
>> {
>> init_fnc_t **init_fnc_ptr;
>> char *s;
>> #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
>> unsigned long addr;
>> #endif
>>
>>
>> *printf("armboot starts\n");*
>> /* Pointer is writable since we allocated a register for it */
>> gd = (gd_t*)(_armboot_start - CONFIG_SYS_MALLOC_LEN - sizeof(gd_t));
>> /* compiler optimization barrier needed for GCC >= 3.4 */
>> __asm__ __volatile__("": : :"memory");
>>
>> memset ((void*)gd, 0, sizeof (gd_t));
>> gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
>> memset (gd->bd, 0, sizeof (bd_t));
>>
>> gd->flags |= GD_FLG_RELOC;
>>
>> monitor_flash_len = _bss_start - _armboot_start;
>>
>>
>
> You can use the CONFIG_PRE_CONSOLE_BUFFER feature to support printf()
> prior to console_init_f().
Which raises questions about the version you are running - Prior to
the implementation of CONFIG_PRE_CONSOLE_BUFFER, a change was made to
squelch console output prior to console init which turned printf(),
puts() and friends into a nop prior to console init, so the addition
of a printf() should not have caused the board to hang (although I do
admit these changes were after 2011.09)
I suggest upgrading to latest top-of-tree, or wait another 10 days for 2011.12
Regards,
Graeme
More information about the U-Boot
mailing list