From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Fri, 03 Nov 2006 18:09:36 -0600 Subject: [U-Boot-Users] Why are some global vars part of the image, and some not? In-Reply-To: <20061103234751.103E6353C4E@atlas.denx.de> References: <20061103234751.103E6353C4E@atlas.denx.de> Message-ID: <454BDA40.5090806@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: > In message <454BC07C.4090704@freescale.com> you wrote: >>> #ifdef CFG_SPD_BUS_NUM >>> static volatile unsigned int i2c_bus_num = CFG_SPD_BUS_NUM; >>> #else >>> static volatile unsigned int i2c_bus_num = 0; >>> #endif >> Ok, I fixed my problem by changing the above line to: > > I don't see any problem that needed fixing. The problem is that without specifying the section attribute, when I ran my code, i2c_bus_num was equal to 0xFFFFFFFF. >> static volatile unsigned int i2c_bus_num __attribute__ ((section ("data"))) = 0; >> >> Is "data" the right section to use? Here's my lds file: > > If you have to ask this question, then the answer is no, and better > don't mess with things you don't understand. > > What exactly is the "problem" you are experiencing? Did you read the > documentation, especially section "Initial Stack, Global Data" in the > README? Please let me know if there is anything in this text which is > not clear enough. That section doesn't address issues with global (static or otherwise) variables that need to be read prior to relocation. -- Timur Tabi Linux Kernel Developer @ Freescale