From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20516 invoked by alias); 8 Nov 2011 17:39:10 -0000 Received: (qmail 20507 invoked by uid 22791); 8 Nov 2011 17:39:09 -0000 X-SWARE-Spam-Status: No, hits=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-qy0-f182.google.com (HELO mail-qy0-f182.google.com) (209.85.216.182) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Nov 2011 17:38:43 +0000 Received: by qyk9 with SMTP id 9so823064qyk.20 for ; Tue, 08 Nov 2011 09:38:42 -0800 (PST) Received: by 10.68.14.105 with SMTP id o9mr2251325pbc.95.1320773921833; Tue, 08 Nov 2011 09:38:41 -0800 (PST) Received: by 10.68.14.105 with SMTP id o9mr2251294pbc.95.1320773920004; Tue, 08 Nov 2011 09:38:40 -0800 (PST) Received: from coign.google.com ([2620:0:1000:fd2b:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id jm5sm5848962pbc.1.2011.11.08.09.38.39 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Nov 2011 09:38:39 -0800 (PST) From: Ian Lance Taylor To: chandru1248 Cc: gcc-help@gcc.gnu.org Subject: Re: How to check if .data section is loaded properly in LMA References: <32801216.post@talk.nabble.com> <32801410.post@talk.nabble.com> <32801452.post@talk.nabble.com> Date: Wed, 09 Nov 2011 03:50:00 -0000 In-Reply-To: <32801452.post@talk.nabble.com> (chandru's message of "Mon, 7 Nov 2011 23:06:50 -0800 (PST)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-11/txt/msg00092.txt.bz2 chandru1248 writes: >> You originally said that the .data section was not properly loaded into >> the LMA. What did you mean, precisely? > > I am loading the image using debugger. > > My VMA and LMA addresses are different. When I checked a global initialized > variable, the value is 0 and did not contain the value that is initialized. > > Below is the snapshot of the linker script for the .data section > > .data ORIGIN(rtarea) : AT (__code_ram_end) > { > __data_ram = .; > *(.data) > *(.sdata) > SORT(CONSTRUCTORS) > __data_end = .; > } > rtarea > > I got the VMA as 0x600000 and LMA as 0x28ef294. Normally when you do this kind of thing, your startup code needs to copy the data from the LMA to the VMA. See the last part of http://sourceware.org/binutils/docs-2.21/ld/Output-Section-LMA.html Ian