When compiling the following program, I get the error expected ‘;’ before numeric constant
. What am I doing wrong?
#include <stdio.h>
#define GPIOBase 0x4002 2000
uint32_t * GPIO_type(char type);
int main(void)
{
GPIO_type('G');
return 0;
}
uint32_t * GPIO_type(char type)
{
return (uint32_t *) GPIOBase;
}
The problem is:
#define GPIOBase 0x4002 2000
And where you use it:
return (uint32_t *) GPIOBase;
becomes:
return (uint32_t *) 0x4002 2000;
Which is a compiler error. There's a stray 2000 lingering after your 0x4002. I suspect you want:
#define GPIOBase 0x40022000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With