gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Calling ASM-functions in IWRAM from C-functions in ROM

#24480 - booger - Wed Aug 04, 2004 1:50 pm

Is there a neat way calling ASM-functions in IWRAM from C-functions in ROM without defining IWRAM-attributes? Example:

/* C-code begin */

#define CODE_IN_IWRAM __attribute__ ((section(".iwram"),long_call))

void asm_iwram_function(void) CODE_IN_IWRAM;

void main(void)
{
asm_iwram_function();
}

/* C-code end */

I'm using the latest DevkitARM.

#24481 - poslundc - Wed Aug 04, 2004 1:55 pm

That kind of is the neat way.

I'm pretty sure most devkits also support naming your C files such as: myfunction.iwram.c - but I don't know if that automates the process of generating long calls; I think you'd still have to do so in your header file's function prototype.

Dan.

#24510 - Lord Graga - Wed Aug 04, 2004 7:36 pm

extern that function promo or put it in an header file.