Pointer allocation problem
Kanwal Preet Singh CHANANA
kanwalpreet.singh@st.com
Fri Sep 1 08:41:00 GMT 2006
Hi Richard,
Thanks a lot for all your support. I have fixed this problem.
Actually, in my scatter file the alignment was correct but the Load address
range of *.data section was overlapping with our IRAM_CODE section(code
running from RAM). So load time, the *.data section was getting corrupted. I
certified that all global data was getting corrupted. So I rectified the
load addresses & now Image is running fine on target board.
I have successully ported my project from ADS to GNU-ARM. Anybody need any
help on this issue, mail me.
Thanks everybody for support.
Kanwal
-----Original Message-----
From: Richard Earnshaw [mailto:rearnsha@arm.com]
Sent: Friday, September 01, 2006 2:00 PM
To: Kanwal Preet Singh CHANANA
Cc: gcc-help@gcc.gnu.org; crossgcc@sources.redhat.com
Subject: Re: Pointer allocation problem
On Fri, 2006-09-01 at 05:08, Kanwal Preet Singh CHANANA wrote:
> Hi all,
>
> I am porting my project from ADS to GCC_ARM v4.0.3. I have been able
> to compile & Link my source files with GCC-ARM. The image (running in
> Flash) crashes on target. The reason for crash is wrong pointer
> allocation.
>
> I have used a pointer to a structure as shown below:
>
> typedef volatile struct UARTInfoTag
> {
> void (*rxInt_p) (void);
> void (*txComplete_p) (void);
> tUartLineStatusCallbackFunc lineStatusInt_p;
> tBool NewRxData;
> tBool IsTransmitting;
> } UARTInfo;
>
> #define NUMBER_OF_UARTS 2
>
> UARTInfo UARTCallBack[NUMBER_OF_UARTS];
> UARTInfo *pUARTInfo = &UARTCallBack[0];
>
> UARTCallBack is located in RAM with &UARTCallBack[0]=0x000033C8, but
> pUARTInfo contains the value 0x4B1D1BCA & pUARTInfo is located in RAM
> at address 0x00001FCA.
>
^^^^^^^^^^^
here's your problem. This isn't a 32-bit aligned address, so attempts to
deference it as an aligned address will fail.
Are you sure your scatter file is correctly aligning your rw and zi sections
correctly?
R.
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list