[U-Boot] ## Application terminated, rc = 0x1

Nable
2015-09-23T23:23:31Z

Hi,

> i want to boot a little kernel on ARM Cortex a9.
> But the kernel crushes pretty early with the following u-boot output:
>
> ## Starting application at 0x01000000 ...
> ## Application terminated, rc = 0x1

What board do you use? This address may be used by something different
than application code.

> Since i have no clue where (and how) to start debugging,
> my first question is:
>
> What may cause "Application terminated, rc = 0x1"?
This message is located in two places:
common/cmd_boot.c -> do_go()
common/cmd_elf.c -> do_bootelf()

In both places it prints return value of your application (value of R0
after control is passed back to u-boot). What command do you use to
start application? First option (cmd_boot -> do_go -> do_go_exec) may
use do_go_exec() implementation from arch/arm/lib/cmd_boot.c that
forces Thumb mode and I'm not sure whether it's OK for your
application.

> There must be any other issue.
> But how to find out what's wrong?
>
> Please, any advice for debugging, or any hint about what may cause
> rc=0x1 is welcome.
arm-none-eabi-gdb + OpenOCD + JTAG dongles is a nice setup for
debugging. If you have JTAG dongle, you can build U-Boot with debug
information, set temporary breakpoint on do_go and do_bootelf
functions, let the CPU run till one of these points and then
single-step to the entry point of your application and further.

Debugging without JTAG is possible but it's a hard way. As a first
attempt you can start with verifying that "int main(){ return 2; }"
shows "Application terminated, rc = 0x2" and if it doesn't happen, you
should look at the disassembly of your application. Btw, did you try
applications from examples?