This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: redboot elf loader
Gary Thomas wrote:
...
Also, there have been recent changes to RedBoot which would allow for
your SRAM section to be defined as a usable memory region that fixes
this problem. This is done on a platform basis - look at the MOAB
(PowerPC) platform for an example.
Not exactly, because this region cannot be loaded (written) by redboot
(AFAIK there are ISR vectors and redboot data). After my program takes
control it destroys it at all.
I am not sure if we really think about the same - my poor Eglish, sorry
for that 8-)
During startup I want to put (relocate) some code at address 0 which not
available during program loading phase, so I declare (in linker script)
that virtual addres of the section is 0 and load address is somewhere
after BSS section in conventional RAM. Now I expect that elf loader
place my code at the load address (LMA) _not_ at virtual address (VMA).
And even more, I think that loader cannot efectively check VMA ranges
because of MMU and other things. It can and should check only load
addresses.
Am I right?
How about sending a patch which shows this more fully?
No problem, below patch against version included in eCos 2.0
--- ecos/packages/redboot/current/src/load.c 2003-09-29
09:41:47.858057600 +0200
+++ dropzone/load.c 2003-09-29 14:13:38.000000000 +0200
@@ -340,8 +333,8 @@
// Set address offset based on lowest address in file.
addr_offset = 0xFFFFFFFF;
for (phx = 0; phx < ehdr.e_phnum; phx++) {
- if (phdr[phx].p_vaddr < addr_offset) {
- addr_offset = phdr[phx].p_vaddr;
+ if (phdr[phx].p_paddr < addr_offset) {
+ addr_offset = phdr[phx].p_paddr;
}
}
addr_offset = (unsigned long)base - addr_offset;
@@ -351,7 +344,7 @@
for (phx = 0; phx < ehdr.e_phnum; phx++) {
if (phdr[phx].p_type == PT_LOAD) {
// Loadable segment
- addr = (unsigned char *)phdr[phx].p_vaddr;
+ addr = (unsigned char *)phdr[phx].p_paddr;
len = phdr[phx].p_filesz;
if ((unsigned long)addr < lowest_address) {
lowest_address = (unsigned long)addr;
Regards,
--
Artur Lipowski
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss