From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24154 invoked by alias); 10 Jun 2006 23:42:20 -0000 Received: (qmail 24145 invoked by uid 22791); 10 Jun 2006 23:42:19 -0000 X-Spam-Check-By: sourceware.org Received: from mail.s.netic.de (HELO mail.s.netic.de) (212.9.160.11) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 10 Jun 2006 23:42:17 +0000 Received: from host-213-178-187-15.dsl.netic.de ([213.178.187.15] helo=schleim.qwe.de) by mail.s.netic.de with esmtp (Exim 4.51) id 1FpD5r-000J14-Qe; Sun, 11 Jun 2006 01:42:16 +0200 Received: from localhost (localhost [IPv6:::1]) by schleim.qwe.de (Postfix) with ESMTP id 3EB223B5DA; Sun, 11 Jun 2006 01:42:00 +0200 (CEST) From: Torsten Mohr To: DJ Delorie Subject: Re: use LMA instead of VMA? Date: Sat, 10 Jun 2006 23:47:00 -0000 User-Agent: KMail/1.8 Cc: gdb@sourceware.org References: <200606101707.58539.tmohr@s.netic.de> <200606102104.k5AL4Mcc028893@greed.delorie.com> In-Reply-To: <200606102104.k5AL4Mcc028893@greed.delorie.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200606110141.59278.tmohr@s.netic.de> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00071.txt.bz2 Hi, > > i'd like to test my startup code in crt0.S but have some problems > > with that as gdb uses the sections VMA instead of the LMA. > > Why would this confuse gdb? If the crt0 code is *running* it should > already be at its VMA. In the cases where LMA and VMA differ in my > projects, it's because I need to initialize RAM from ROM, so I don't > need gdb to know about the data until after I've moved it to its VMA. > > Maybe you need to tell us more about how your code is set up? ok, maybe this needs some more explanation. In a project i use my own startup code and in this one i do several things: - set up stack and registers - clear .bss - copy .data from ROM to RAM To place the content of .data to ROM i use the following in my linker script: .data : { *(.data) *(.data.*) *(.gnu.linkonce.d*) CONSTRUCTORS } > ram AT > rom When i look at the section .data, "v850e-unknown-elf-objdump -h" tells me (only .data): Idx Name Size VMA LMA File off Algn 7 .data 00000828 03ff7000 0000730c 00009000 2**2 CONTENTS, ALLOC, LOAD, DATA When i generate an SREC file that i burn into the flash micro everything is placed where i expect it, the content of .data is placed at LMA. So my startup code needs to copy it from LMA to VMA, where the rest of the code expects it. But when i try to simulate it in GDB, GDB loads the content of .data to VMA and i _must_ _not_ copy anything from LMA to VMA, because at LMA there is just nothing. The correct data are already at VMA. To my understanding every code that places something into .data needs to behave like that. That's why i think there could/should be a standard solution. At the moment i use -DREAL_TARGET=0 or =1 per command line to the compiler and assembler and behave differently in the startup code and very small parts of the rest of the code (I/O over serial line). This works quite fine. My project behaves ok in the simulator now, but not in the real target. So i'd like to also test my startup code now, but at the moment i don't see a way for that. But maybe i miss something, if anybody had a solution for that that would be great. Best regards, Torsten.