View unanswered posts | View active topics It is currently Mon Oct 22, 2018 6:30 am



Reply to topic  [ 2 posts ] 
 GBA Overlay sections [Solution] 
Author Message

Joined: Sat Mar 07, 2015 8:23 pm
Posts: 3
Hello,

I'm trying to use overlay sections. However when I do so, it seems the .pad section doesn't count them and overlaps them. Here's what I get in the map file:
Code:
.iwram0         0x030036ac       0x24 load address 0x080ca818
 *(.iwram0)
 .iwram0        0x030036ac       0x14 t_overlay.thumb.o
                0x030036ac                Overlay0
 .iwram0.__stub
                0x030036c0        0xc linker stubs
                0x030036cc                . = ALIGN (0x4)
                0x080ca818                PROVIDE (__load_start_iwram0, LOADADDR (.iwram0))
                0x080ca83c                PROVIDE (__load_stop_iwram0, (LOADADDR (.iwram0) + SIZEOF (.iwram0)))

.iwram1         0x030036ac       0x24 load address 0x080ca83c
 *(.iwram1)
 .iwram1        0x030036ac       0x14 t_overlay.thumb.o
                0x030036ac                Overlay1
 .iwram1.__stub
                0x030036c0        0xc linker stubs
                0x030036cc                . = ALIGN (0x4)
                0x080ca83c                PROVIDE (__load_start_iwram1, LOADADDR (.iwram1))
                0x080ca860                PROVIDE (__load_stop_iwram1, (LOADADDR (.iwram1) + SIZEOF (.iwram1)))

.rel.dyn        0x030036d0        0x0 load address 0x080ca860
 .rel.iplt      0x030036d0        0x0 d:/softs/devkitpro/devkitarm/bin/../lib/gcc/arm-none-eabi/5.3.0/../../../../arm-none-eabi/lib/gba_crt0.o

.iwram2         0x030036ac        0x0
 *(.iwram2)
                0x030036ac                . = ALIGN (0x4)
                [!provide]                PROVIDE (__load_start_iwram2, LOADADDR (.iwram2))
                [!provide]                PROVIDE (__load_stop_iwram2, (LOADADDR (.iwram2) + SIZEOF (.iwram2)))

Code:
.pad            0x02001738        0x8 load address 0x080ca83c
                0x02001738        0x4 LONG 0x52416b64
                0x0200173c        0x4 LONG 0x4d
                0x02001740                . = ALIGN (0x4)
                0x080ca844                __rom_end__ = (__pad_lma + SIZEOF (.pad))


And of course the linker complains. How can I fix this ?
Thank you.


Sun Jan 03, 2016 1:11 am
Profile

Joined: Sat Mar 07, 2015 8:23 pm
Posts: 3
Hi,

I create a new topic since the previous one hasn't been approved yet.
I've managed to get overlays working by changing the linkscript:

Old:
Code:
   __iwram_overlay_end = . ;
   __ewram_lma = __iwram_overlay_lma + (__iwram_overlay_end - __iwram_overlay_start) ;

New:
Code:
    __iwram_overlay_size = __load_stop_iwram0 - __load_start_iwram0 + __load_stop_iwram1 - __load_start_iwram1 + __load_stop_iwram2 - __load_start_iwram2 + __load_stop_iwram3 - __load_start_iwram3 + __load_stop_iwram4 - __load_start_iwram4 + __load_stop_iwram5 - __load_start_iwram5 + __load_stop_iwram6 - __load_start_iwram6 + __load_stop_iwram7 - __load_start_iwram7 + __load_stop_iwram8 - __load_start_iwram8 + __load_stop_iwram9 - __load_start_iwram9;
    __ewram_lma = __iwram_overlay_lma + __iwram_overlay_size;


According to the doc ftp://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_22.html, . after OVERLAY is using the max size of all sections, not the sum of all sizes. I believe the current linkscript is buggy.
Could something along these lines be integrated into the next update ?
Thanks !


Sun Jan 03, 2016 12:56 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
  Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.
Get devkitPro at SourceForge.net. Fast, secure and Free Open Source software downloads