Reducing libgbas IWRAM footprint

Post Reply
bim
Posts: 7
Joined: Fri Nov 03, 2017 6:56 pm

Reducing libgbas IWRAM footprint

Post by bim » Sat Jan 12, 2019 2:26 pm

Looking at the .map file of my GBA .elf with amap I see several blocks of IWRAM being allocated by libgba. I attached an amap screenshot. Is there any way to reduce that? Heap management could rather be in EWRAM and why a mutex? I probably only need the headers and the interrupt stuff libgba offers. What can I do?
On a tangent: Is there a way to use MaxMOD without libgba?
Attachments
mapfile_amap.png
(193.45 KiB) Not downloaded yet

WinterMute
Site Admin
Posts: 1845
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Reducing libgbas IWRAM footprint

Post by WinterMute » Wed Jan 23, 2019 1:23 pm

Traditionally on GBA .data & .bss go in iwram, this is a function of the linkscript & has very little to do with libgba. Bear in mind that EWRAM is 16bit access & is much slower than IWRAM so changing it is likely to have a performance impact.

devkitARM also builds code for platforms where threading is possible, thus there are locks in malloc which do nothing on GBA. If you're that concerned then perhaps you should manage memory yourself.

Yes, it's possible to use maxmod without libgba, I've provided sample code that uses libtonc at https://devkitpro.org/viewtopic.php?f=37&t=8830
Help keep devkitPro toolchains free, Donate today

Personal Blog

bim
Posts: 7
Joined: Fri Nov 03, 2017 6:56 pm

Re: Reducing libgbas IWRAM footprint

Post by bim » Thu Jan 24, 2019 11:42 am

Your right. I've done just that. I removed libgba and also got rid of memory management using the GCC options:
-Wl,--wrap=malloc,--wrap=free,--wrap=alloc,--wrap=calloc
All allocations are redirected to my internal methods, which I need anyway. This gives me more control over allocations, but still static stuff can be allocated in IWRAM/EWRAM if needed.

Btw. Does MaxMODs IWRAM footprint depend on the number of channels? It uses ~7-8kB of IWRAM. Could I reduce that?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests