Parse Error Query

Andrea 'Fyre Wyzard' Bocci fwyzard@inwind.it
Tue Feb 26 22:35:00 GMT 2002


At 04.04 25/02/2002 (GMT -0800), erica arya wrote:

>Hello,
>
>I am facing a problem while compiling my application
>using gcc compiler version 2.96-h8300-000821.
>The areas of problem in my application where the
>problem exists is as below:

Hi Erica.
I see two errors in your code.

1)
Assuming it is typed as it appears in the mail, the #define aren't correct. 
You must terminate the first line with a \ so that the definition continues 
to the following line. That is,

>#define TPU_TGR1B   ( volatile unsigned long
>(0xFFFFFF2A) )  /* Timer general B      */
>#define TPU_TIER1   ( volatile unsigned long
>(0xFFFFFF24) )  /* Timer intrpt enab    */
>#define ITU_TSTR    ( volatile unsigned long
>(0xFFFFFEB0) )  /* Timer start          */

should become

#define TPU_TGR1B   ( volatile unsigned long   \
(0xFFFFFF2A) )  /* Timer general B      */
#define TPU_TIER1   ( volatile unsigned long   \
(0xFFFFFF24) )  /* Timer intrpt enab    */
#define ITU_TSTR    ( volatile unsigned long   \
(0xFFFFFEB0) )  /* Timer start          */

The erros you get, however, don't seem related to this issue, so I guess 
that in your code the #defines are each on a single line.

2)
I'm not sure what you meant, but I guess you are trying to access a 
physical some memory addresses, at 0xFFFFFF24...B0.
What you've written is trying to assign, eg., 0x7FFF to the (volatile 
unsigned long) value 0xFFFFFF2A. The right (?) way to do this would be to 
change

volatile unsigned long  (0xFFFFFF2A)  = 0x7FFFF

into

*(volatile unsigned long *) 0xFFFFFF2A  = 0x7FFFF

So your code should be

#define TPU_TGR1B ( * (volatile unsigned long *) 0xFFFFFF2A )    /* Timer 
general B */
#define TPU_TIER1 ( * (volatile unsigned long *) 0xFFFFFF24 )    /* Timer 
intrpt enab */
#define ITU_TSTR  ( * (volatile unsigned long *) 0xFFFFFEB0 )    /* Timer 
start */

void main(void)
{
TPU_TGR1B  = 0x7fff;   /* Set duty of LED 50% by TGRB */
TPU_TIER1 |= 42;       /* Enable B compare/match interrupt */
ITU_TSTR  |= 0x02;     /* Start Channel 1 */
}

I hope to have been of some help,
fwyzard



More information about the Gcc-help mailing list