Skip to main content.

14.2.20. My standalone program does not work

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 calles with unexpected arguments. What's wrong?

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, but at 0x40058. Just start your standalone program at this address, and everything should work well.
14.2.19. How can I create an uImage from a ELF file 1. Abstract 14.2.21. Linux hangs after uncompressing the kernel
Prev Home Next