From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12940 invoked by alias); 26 Jul 2005 17:21:44 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 12788 invoked by uid 22791); 26 Jul 2005 17:21:39 -0000 Received: from londo.lunn.ch (HELO londo.lunn.ch) (80.238.139.98) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 26 Jul 2005 17:21:39 +0000 Received: from lunn by londo.lunn.ch with local (Exim 3.36 #1 (Debian)) id 1DxT7Y-0005J9-00; Tue, 26 Jul 2005 19:21:36 +0200 Date: Tue, 26 Jul 2005 17:21:00 -0000 To: Matt Sartori Cc: eCos Discussion Message-ID: <20050726172136.GB10656@lunn.ch> Mail-Followup-To: Matt Sartori , eCos Discussion References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: Andrew Lunn Subject: Re: [ECOS] Simple Redboot Q's X-SW-Source: 2005-07/txt/msg00285.txt.bz2 On Tue, Jul 26, 2005 at 06:03:51PM +0100, Matt Sartori wrote: > Yes, that all the jumps and references within the code are relative, not > absolute. Nope. eCos is position dependant. ie you have to load it where it expects to be loaded. Otherwise it crashes and burns. > I think what I'm not quite understanding is what the load does. > I would expect the loading of an elf to involve the interpretation of > the file as to where to put it (and probably other stuff), however > loading an elf explicitly to a location (with -b) doesn't make logical > sense to me since the elf already knows where it wants to go. Correct. You should not tell the loader where to put the image. You only need this for raw binaries. That format does not contain the position information so you have to tell it. > Equally baffling to me is when I load a .bin to an explicit location > then I can't just run it from that location. > > Only when I load the .bin into the same memory location as what I've put > in the binary's linker script does it work Thats the position independant stuff again... You code appears not to be position independant. It contains absolute addresses, not relative addresses. Hence when its in the wrong place it crashes an burns. If you want to be able to load your application to any random address you need to make your application position independant. This can be quite difficult, so most applications don't do it. Andrew -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss