[U-Boot] [PATCH v3 5/6] arm: debug: add Kconfig entries for lowlevel debug

Simon Glass sjg at chromium.org
Fri Sep 5 23:16:07 CEST 2014


Hi Masahiro,

On 4 September 2014 20:55, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
> Hi Simon,
>
>
> On Wed, 3 Sep 2014 18:01:44 -0600
> Simon Glass <sjg at chromium.org> wrote:
>
>> Hi Masahiro,
>>
>> On 31 August 2014 20:06, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
>> > We have not had a good method to debug the early boot stage such as
>> > lowlevel_init function.  I guess developers generally use dedicated
>> > debuggers for that, but it is difficult in some cases.
>> > (For example, my debugger cannot connect to the ARM processor when
>> > it is in the secure state.  It sometimes happens when I need to
>> > debug the early boot stage on ARM SoCs with secure extension.)
>> >
>> > The low level debug feature in Linux would be also helpful for U-boot
>> > when we are stucking in nasty problems where the console is not
>> > available yet.
>> >
>> > You have to enable CONFIG_DEBUG_LL to use this feature.
>> > For now, only 8250-compatible UART devices are supported.
>> > You can add a header file under arch/arm/include/debug/ directory
>> > to support your UART device if necessary.
>> >
>> > Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
>>
>> Is it possible to use the existing drivers for this? It seems
>> unfortunate to duplicate the ns16550 driver (if that is what has
>> happened).
>
> I am afraid it is difficult since the serial drivers are too
> complicated and written in C.
> Indeed, it is unfortunate, though.
>
> This low level debug framework only uses r0, r1, r2, r3
> registers and does not need stack.
>
> I think it has an advantage over the serial drivers
> for debugging the lowlevel_init where no stack is ready.

We have CONFIG_SYS_INIT_SP_ADDR and the like - if there is no RAM
available for a stack then I would question what RAM you are using to
hold your code :-)

As an example, for ns16500, you can do something like:

ldr r0, =UART_BASE
ldr r0, =UART_BAUD_DIVISOR
bl NS16550_init

ldr r0, =UART_BASE
mov r1, #'a'
bl NS16550_putc

At least for ARMv7, this actually uses no stack, so you could do that
now. I am pretty sure you would find the same with other serial
drivers as they are very simple. The cost is that we need to be able
to call the output function directly. With driver model we could
require this to be part of the API and I'm pretty sure it would be
easy enough. I still think this is far preferable to rewriting
duplicate drivers in assembler. May this is the only possible way in
Linux...

Also you can do:

ldr sp, =CONFIG_SYS_INIT_SP_ADDR

if needed.

Regards,
Simon


More information about the U-Boot mailing list