DENX . DULG . MyStandaloneProgramDoesNotWork

14.2.20. My standalone program does not work

Question:
I tried adding some new code to the hellow_world.c demo program. This works well as soon as I only add code to the existing hello_world() function, but as soon as I add some functions of my own, things go all haywire: the code of the hello_world() function does not get executed correctly, and my new function gets called with unexpected arguments. What's wrong?

Answer:
You probably failed to notice that any code you add to the example program may shift the entry point address. You should check this using the nm program:
$ ${CROSS_COMPILE}nm -n examples/hello_world
0000000000040004 T testfunc
0000000000040058 T hello_world
000000000004016c t dummy
...
As you can see, the entry point (function hello_world()) is no longer at 0x40004 as it was before and as it's documented. Instead, it is now at 0x40058. So you have to start your standalone program at this address, and everything should work well.

----- Revision r1.3 - 26 Dec 2008 - 16:45 - WolfgangDenk
Copyright © 2002-2019 by DENX Software Engineering