I've been playing with Game Boy Advance coding in C. For interrupts to work, the address of your interrupt handler routine must be manually copied to RAM location 0x03007FFC. I know how to do this in ARM Assembly but not in C. I was trying something like this:
#define REG_INTERRUPT *(vu32*)0x03007FFC
void irqhandler()
{
while(1){}
}
int main()
{
REG_INTERRUPT = &irqhandler();
while(1){}
return 0;
}
But it doesn't work. From what I understand about C functions, it seems like C is thinking I'm trying to get the address of the return value of irqhandler
(which there is none since it's a void) and that's where the error comes from. How do I tell C that I want the memory location of the function itself?