From: David Hearn Date: Wed, 19 Sep 2007 12:57:10 +0100 Subject: [U-Boot-Users] Setting entry point in u-boot standalone apps In-Reply-To: <47F3F98010FF784EBEE6526EAAB078D1024F86F9@tq-mailsrv.tq-net.de> References: <47F3F98010FF784EBEE6526EAAB078D1024F86F9@tq-mailsrv.tq-net.de> Message-ID: <46F10E96.4050400@swampie.org.uk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Martin Krause wrote: > Hi David, > > u-boot-users-bounces at lists.sourceforge.net wrote on : > >> I have a U-boot standalone app which runs on the Gumstix boards. >> It's based on the /u-boot-1.2.0/examples/ folder. The problem I have >> is that my entry >> function - lets call it app_entry() - isn't at the load address, it's >> somewhere in the middle. I'm using the output from objdump -d > > > This is a known issue, please look at: > http://www.denx.de/wiki/view/DULG/MyStandaloneProgramDoesNotWork > Very helpful - thanks for pointing that out. >> Has anyone else experienced this problem, and can give any advice as >> to >> how to solve it? >> > > You have to change your linker script. Tell the linker where it should > place your entry point function (I'm no linker expert, so I couldn't > give you advice at this ...) > > Regards, > > Martin Krause I've now started using a linker script which does the job. The way I did it was to create a separate object file which just contained a single wrapper function which called my 'main' function. This function would always be at the start of the resulting .o file, and this .o file was then specified as the first entry in the .text section. Consequently this wrapper function is now always at the start of my final binary file. Thanks for the pointers, and the explanations regarding entry points and link locations. David