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.

DS development > overlays

#170435 - Tommmie - Thu Sep 24, 2009 6:45 pm

hey everyone,

me again, but this time about code overlays. Someone linked me to this post: http://forum.gbadev.org/viewtopic.php?t=14707 but when looking at Wintermutes instructions I'm really confused. In which .ld file do i have to put this:

Quote:
Firstly add an extra exclusion category to the main text segment.

Code:

.text : /* ALIGN (4): */
{
*(EXCLUDE_FILE (*.itcm* *.overlay*) .text)


Then later, after the .bss section we generate the overlays.

Code:

__ewram_overlay_lma = __bss_lma + SIZEOF(.bss);

OVERLAY ALIGN(4) : NOCROSSREFS AT (__ewram_overlay_lma)
{
.overlay0 { *(.overlay0) *.overlay0*(.text) . = ALIGN(4); }
.overlay1 { *(.overlay1) *.overlay1*(.text) . = ALIGN(4); }
.overlay2 { *(.overlay2) *.overlay2*(.text) . = ALIGN(4); }
.overlay3 { *(.overlay3) *.overlay3*(.text) . = ALIGN(4); }
.overlay4 { *(.overlay4) *.overlay4*(.text) . = ALIGN(4); }
.overlay5 { *(.overlay5) *.overlay5*(.text) . = ALIGN(4); }
.overlay6 { *(.overlay6) *.overlay6*(.text) . = ALIGN(4); }
.overlay7 { *(.overlay7) *.overlay7*(.text) . = ALIGN(4); }
.overlay8 { *(.overlay8) *.overlay8*(.text) . = ALIGN(4); }
.overlay9 { *(.overlay9) *.overlay9*(.text) . = ALIGN(4); }
}

PROVIDE (__overlay0_size = SIZEOF(.overlay0));
PROVIDE (__overlay1_size = SIZEOF(.overlay1));
PROVIDE (__overlay2_size = SIZEOF(.overlay2));
PROVIDE (__overlay3_size = SIZEOF(.overlay3));
PROVIDE (__overlay4_size = SIZEOF(.overlay4));
PROVIDE (__overlay5_size = SIZEOF(.overlay5));
PROVIDE (__overlay6_size = SIZEOF(.overlay6));
PROVIDE (__overlay7_size = SIZEOF(.overlay7));
PROVIDE (__overlay8_size = SIZEOF(.overlay8));
PROVIDE (__overlay9_size = SIZEOF(.overlay9));

/* find the largest allocated overlay section */
__ewram_overlay_alloc = MAX( SIZEOF(.overlay0) , SIZEOF(.overlay1) );
__ewram_overlay_alloc = MAX( __ewram_overlay_alloc , SIZEOF(.overlay2) );
__ewram_overlay_alloc = MAX( __ewram_overlay_alloc , SIZEOF(.overlay3) );
__ewram_overlay_alloc = MAX( __ewram_overlay_alloc , SIZEOF(.overlay4) );
__ewram_overlay_alloc = MAX( __ewram_overlay_alloc , SIZEOF(.overlay5) );
__ewram_overlay_alloc = MAX( __ewram_overlay_alloc , SIZEOF(.overlay6) );
__ewram_overlay_alloc = MAX( __ewram_overlay_alloc , SIZEOF(.overlay7) );
__ewram_overlay_alloc = MAX( __ewram_overlay_alloc , SIZEOF(.overlay8) );
__ewram_overlay_alloc = MAX( __ewram_overlay_alloc , SIZEOF(.overlay9) );

/* if we use . here then _end points to overlay_lma + SIZEOF(overlay0) ... SIZEOF(overlay9) */

_end = __ewram_overlay_lma + __ewram_overlay_alloc ;
__end__ = __ewram_overlay_lma + __ewram_overlay_alloc ;
PROVIDE (end = _end);
?

Tommmie[/quote][/url]