Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 28 Oct 2004 02:42 PM by  mikee@logicpd.com
deciphering the makefile for the sample_zoom_app program
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages
ylin
New Member
New Member
Posts:


--
28 Oct 2004 08:20 AM
    In the arch/arm directory, the makefile for the sample_zoom_app contains the following two line:

    $(OBJCOPY) --adjust-vma $(FIXUP) sample_app
    $(OBJCOPY) --strip-all sample_app stripped

    where FIXUP = 0x40000000.

    What exactly is the purpose of these two lines?

    thank you,
    mikee@logicpd.com
    New Member
    New Member
    Posts:


    --
    28 Oct 2004 02:42 PM
    ylin,

    The line $(OBJCOPY) --adjust-vma $(FIXUP) sample_app is used to adjust the addresses listed in the ELF headers. Typically we use this to "fake out" the LogicLoader and have it load something into Flash that is actually destined for RAM.

    For instance, on the A400, SDRAM starts at 0xC0000000. Lets say that I have an application that is going to execute starting at 0xC0004000. When I load the ELF file, LogicLoader is going to read the addresses from the ELF headers, determine that this program has been linked to run out of SDRAM, and load it starting at 0xC0004000.

    Now, lets say I want to store that same program in Flash. In order to do this, I need to include some assembly code at the start of the program to copy itself out into the appropriate area of SDRAM (otherwise, of course, it won't run). But, I also need to make the LogicLoader think that it is going to execute from Flash. By adding 0x40000000 to each of the section header addresses within the ELF file, LoLo is going to think that the program wants to run at 0x00004000. Therefore, it will unpack it into SDRAM and then allow you to burn it into flash memory.

    Later on, you can run your program by jumping to the first address within Flash memory. Your program will copy itself out to SDRAM, and then run.


    The line $(OBJCOPY) --strip-all sample_app stripped simply creates a "stripped" version of the program. Stripping the file removes unnecessary information such as debug data from the program. This makes it smaller and faster to load over a serial connection.

    You should do a man objcopy or objcopy --help for more information on these options.

    Regards,
    --mikee
    You are not authorized to post a reply.