Specifications
14.2.9. Porting Problem: cannot move location
counter backwards
Question:
I'm trying to port U-Boot to a new board and the linker throws an error message like this:
board/<your_board>/u-boot.lds:75 cannot move location counter backwards (from 00000000b0008010 to 00000000b0008000)
Answer:
Check your linker script board/your_board/u-boot.lds which controls how the object files
are linked together to build the U-Boot image.
It looks as if your board uses an "embedded" environment, i. e. the flash sector containing the
environment variables is surrounded by code. The u-boot.lds tries to collect as many as possible
code in the first part, making the gap between this first part and the environment sector as small as
possible. Everything that does not fit is then placed in the second part, after the environment sector.
Some your modifications caused the code that was put in this first part to grow, so that the linker finds
that it would have to overwrite space that is already used.
Try commenting out one (or more) line(s) before the line containing the
"common/environment.o" statement. [ "lib_generic/zlib.o" is usually a good
candidate for testing as it's big ]. Once you get U-Boot linked, you can check in the u-boot.map
file how big the gap is, and which object files could be used to fill it up again.
14.2.10. U-Boot Doesn't Run after Upgrading my
Compiler
Question:
I encountered a big problem that U-Boot 1.1.4 compiled by ELDK 4.1 for MPC82xx crashed.
But if I build it using gcc-3.4.6 based cross tools, U-Boot on my board boots correctly.
The same U-Boot code built by ELDK 4.1 (gcc-4.0) failed, nothing occurs on the serial port.
Answer:
This is often a missing volatile attribute on shared variable references, particularly hardware
registers. Newer compiler versions optimize more aggressively, making missing volatile
attributes visible.
If you use -O0 (no optimization) does it fix the problem?
If it does, it most likely is an optimization/volatile issue. The hard part is figuring out where. Device
handling and board-specific code is the place to start.
14.2.11. How Can I Reduce The Image Size?
Question:
I am trying to reduce the size of the u-boot.bin file so that it fits into 256 KB. I disabled all the drivers
that I didn't need but the binary size is still 512KB, it seems to be a hard number coded in somewhere.
14.2.11. How Can I Reduce The Image Size? 164