But let's forget about all that and consider the full U-boot. On the Orange Pi, this gets loaded to 0x4a000000 and execution begins at the first word of the image -- at 0x4a000000, which is the label "_start". You can look high and low for this label. It is not in arch/arm/cpu/armv7/start.S as you might think. You will find it in arch/arm/lib/vectors.S As it turns out though the first instruction at _start is a branch to "reset" in arch/arm/cpu/armv7/start.S so we get there in any event. After performing a fair bit of processor initialization, this branches to "main"
To figure out where "main" is, we resort to ctags. First we run ctags in the base directory for u-boot:
ctags -R .This produces the "tags" file. Ultimately this proves useless as there are "main" things all over the source tree. So I write another ruby script. This one runs grep for main on only those files that I have listed as being used in the orange Pi build. While not ideal, this does quickly lead us to the answer we want.
As it turns out, we have not yet escaped the world of assembly language, we find the _main entry point in ./arch/arm/lib/crt0.S There is a nice informative comment at the start of this file that explains what is going on. It also guides us to a couple of documents in the U-boot documentation directory. Specifically it recommends reading the section entitled "Board Initialisation Flow" in the main README file. There are a number of other files in the "doc" directory that are worth reading (and no doubt others besides these):
README.generic-board README.arm-relocationThe meat of things seems to be the two files common/board_f.c and common/board_r.c. The "f" code gets run pre-relocation. The "r" code is the main deal and gets run post-relocation.
Tom's electronics pages / tom@mmto.org