From: David Hearn <dave@swampie.org.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Setting entry point in u-boot standalone apps
Date: Tue, 18 Sep 2007 09:56:33 +0100 [thread overview]
Message-ID: <46EF92C1.5050309@swampie.org.uk> (raw)
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 <elf
file> > <elf file>.dis to determine where in the address range the
functions are located.
When I originally built the hello_world.c examples, the hello_world()
function was located at the load address and everything worked fine. I
would do issue the following commands to run it:
loadb a0000000
<send the .bin file>
go a0000000
However I discovered that as I made changes to this file the
hello_world() function was moved around within the address range (ie. it
was no longer at the start of the range) - this was discovered when the
app no longer worked. After investigating I found that I needed to
disassemble the file, locate where the entry function is now located,
and do the following commands:
loadb a0000000
<send the .bin file>
go a0000948 (or whatever the address of my entry function was)
This then worked every time.
My problem is that I wish to avoid this as every time I change any of
the functions located before my entry function, this address changes.
It would be far nicer, and easier, to just have my entry function always
located at the start of the range and I can then always execute my app by doing 'go a0000000' irrespective of any changes I make to the code..
I'm using a slightly modified version of the Makefile in the examples
folder, the particular interesting part (I think) which I've not changed is:
$(ELF):
$(obj)%: $(obj)%.o $(LIB)
$(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
-o $@ -e $(notdir $(<:.o=)) $< $(LIB) \
-L$(gcclibdir) -lgcc
The -e part should be specifying the entry point of the ELF file,
however outputting the result of the $(notdir) part shows it's empty.
When I've replaced it with just the entry function's name, it makes no
difference either.
As I understand it (taken from:
<http://sourceware.org/binutils/docs-2.17/ld/Entry-Point.html>):
"There are several ways to set the entry point. The linker will set the
entry point by trying each of the following methods in order, and
stopping when one of them succeeds:
* the `-e' entry command-line option;
* the |ENTRY(|symbol|)| command in a linker script;
* the value of the symbol |start|, if defined;
* the address of the first byte of the `.text' section, if present;
* The address |0|."
Unfortunately, the examples don't use linker scripts, and I don't want
to start messing with these as it interacts with u-boot to some extent
(certainly built within u-boot's makefile), and it's all working as it
is. From what I understand though, the -e option should be sufficient.
Has anyone else experienced this problem, and can give any advice as to
how to solve it?
Thanks
David
next reply other threads:[~2007-09-18 8:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 8:56 David Hearn [this message]
2007-09-18 9:22 ` [U-Boot-Users] Setting entry point in u-boot standalone apps Martin Krause
2007-09-19 11:57 ` David Hearn
2007-09-18 19:07 ` Wolfgang Denk
2007-09-19 11:57 ` David Hearn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46EF92C1.5050309@swampie.org.uk \
--to=dave@swampie.org.uk \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox