On Fri, Mar 25, 2011 at 11:35 AM, Albert ARIBAUD <albert.arib...@free.fr> wrote:
> Le 25/03/2011 17:12, Aneesh V a écrit :
>
>> Another problem I have with relocation is that it makes debugging with
>> JTAG debugers more difficult. The addresses of symbols in the ELF
>> target are no longer valid. Of course, you can load the symbols at an
>> offset from the original location. But one has to first enable debug
>> prints, find the relocation offset, use it while loading the symbols
>> before you can do source level debugging.
>
> Actually you don't need recompiling: simply set a breakpoint at the
> entry of relocate_code and once you hit the bp, look up r2: it contains
> the destination. If you want the offset rather than the absolute
> address, set the breakpoint right after the 'sub r9, r6, r0' round line
> 222: r9 will then give you the offset. Unload the current symbols,
> reload the symbols with the relevant offset, and there you go.

I would like to revisit this thread. I'm not sure how other people do
development in U-Boot but I like to use an ICE and a source-level
debugger for any significant effort. I think it should be possible to
use a JTAG debugging just by loading the u-boot ELF file and running.

With this patch (or something similar) this is possible. Without it,
it is painful.

To be clear, we are not talking here about creating a platform that
doesn't use relocation, just that for development purposes it is
convenient to be able to disable it.

Looking at the December thread
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/88067/focus=88262

Aneesh:
> > Shouldn't we provide a CONFIG option by which users can disable
> > Elf relocation?

Wolfgang:
> Why should we?  It would just make the code even more complicated, and
> require a lot of additional test cases.

>From what I can see this is a new CONFIG option, two ifdefs in the
board.c file, and optionally disabling the -pie position-independent
executable option to reduce size. It is pretty trivial:

 arch/arm/config.mk   |    2 ++
 arch/arm/lib/board.c |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

Regards,
Simon

>
> Amicalement,
> --
> Albert.
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to