This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Address calculation in RedBoot load function


Hi,

I'm wondering about the address calculation at the end of the
function load_srec_image() in the file load.c . If there's a
given base address (via "-b" option of the load command) then
the entry address of the image will be calculated relative to
that base address:

---------- packages/redboot/current/src/load.c line 536 ----------
    addr = (unsigned char *)_hex2(getc, ('9'-type+2), &sum);
    offset += ('9'-type+2);
    // Save load base/top, entry address
    if (base) {
        load_address = base;
        load_address_end = base + (highest_address - lowest_address);
        entry_address = (unsigned long)(base + (addr - lowest_address));
    } else {
        load_address = lowest_address;
        load_address_end = highest_address;
        entry_address = (unsigned long)addr;
    }
------------------------------------------------------------------

This results in wrong entry and mem addresses when someone loads an
image to an arbitrary address in RAM and afterwards tries to program
it using the calculated addresses of the last loaded file.

Example (image built for address 0x450000 and loaded to RAM
         address 0x220000):

RedBoot> load -m y -b 0x220000
RedBoot> fis create foo

In that case the fis image "foo" will have 0x220000 as entry and mem
address although the loaded s-record contains correct addresses
starting at 0x450000 (a following "fis load foo" would load the image
to a wrong address). Is this intended behaviour?

Thanks for any hints!

Wolfram
--
Wolfram 'L.A.' Kattanek     Institut fuer Mikroelektronik- und
Email:       LA@imms.de     Mechatronik-Systeme (IMMS) gGmbH    
Tel: +49 3677 / 6783-55     Langewiesener Str. 22
Fax: +49 3677 / 6783-38     98693 Ilmenau / Germany

--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]