[U-Boot-Users] code relocation and symbolic debugging

Wolfgang Denk wd at denx.de
Tue Mar 20 02:42:07 CET 2007

In message <f608b67d0703191805t6379c48an24ea9d9d41277d11 at mail.gmail.com> you wrote:
> a pain, especially when trying symbolic debugging. I of course know
> about the gdb add-symbol-file command, but I couldn't figure out how
> to make it relocate symbols along with the text segment. As a result,

Then you obviously did not read the manual. Please RTFM.

> I can set breakpoints and examine automatic variables, but can't see
> static/global variables using the gdb. How do others handle this
> situation - any hits will be highly appreciated.

We just do as described in the manual.

> Now, I don't want to sound too much off the mark, but why is this
> trick even needed?  For at least 10 years now gnu tools provide the
> ability to generate bin images of the executable files and to
> concatenate otherwise noncontiguous segments in one file.

If you want to be able to erase / progarm the flash, at  least  youyr
flash  driver must be running from non-flash memory (at leats on most
standard flash chips). If you want to be able  to  update  U-Boot  in
flash you must have all of U-Boot running in some other memory.

This requires to copy & relocate the image.

And this has nothing to do with where the code/data segments are

> Utilizing this feature would allow to benefit from all the u-boot
> early startup elegant smarts (running with data in the cache, testing
> the entire dram, stc)., then the first stage code would just move the
> main chunk to the predefined location and pass control to it. This way
> no need to worry about adjusting tabled addresses, about data not
> fitting into the room allotted, about gdb not alllowing to see
> variables - this approach is pretty much worry free at least on mips
> and ppc architectures where I extensively deployed it before joining
> the u-boot club.

Feel free to submit patches - if they actually work we will be  happy
to consider them.

I'm just afraid that you miss a few points...

> Of course with such a heavy legacy like u-boot has it is difficult to
> switch on a whim, but would this be even considered? And why has not
> it been done like that in the first place?

Because nobody was clever enough to implement it? Or maybe because it
does not work? Dunno...

Best regards,

Wolfgang Denk

DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Text processing has made it possible to right-justify any idea, even
one which cannot be justified on any other grounds."
                                                 -- J. Finnegan, USC.

More information about the U-Boot mailing list