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 > Functions in IWRAM ?

#74629 - Mollusk - Mon Mar 06, 2006 4:47 pm

I have some critical code I'd like to make as fast as possible, so I wanted to do like I did with the gba : put the code in IWRAM... But there don't seem to be any macros to do so, and when I use my own ones devkitpro tells me there is no .iwram section...

Any ideas ?
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#74635 - knight0fdragon - Mon Mar 06, 2006 6:09 pm

I discussed that question before so heres the answer

source:
http://www.forum.gbadev.org/viewtopic.php?t=5856&start=30

from DekuTree64
Quote:
It looks like the latest ARM7 linkscript puts variables in iwram by default, and it would still run fine with the table in main RAM anyway.

_________________
http://www.myspace.com/knight0fdragonds

MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206

#74636 - Mollusk - Mon Mar 06, 2006 6:16 pm

but it's the functions I want to put in IWRAM, not the variables...
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#74639 - DekuTree64 - Mon Mar 06, 2006 6:29 pm

Well, on ARM9, functions go into main RAM by default, so you do have to specify. The section you're after is .itcm, which is 32KB and even faster than IWRAM because it's internal to the ARM9 core, which runs at twice the main system frequency. There's also .dtcm for data, which is 16KB.

There are 2 16KB blocks of IWRAM that can be toggled back and forth between the two processors, which are pretty fast too. I guess there's no section defined for them though.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#74658 - Mollusk - Mon Mar 06, 2006 8:56 pm

Thanks Deku. I already put the code in ITCM, but it just didn't seem faster than normal code, not sure why :/ (it's basically routines writing to the VRAM to plot pixels).
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#74670 - DekuTree64 - Mon Mar 06, 2006 10:45 pm

Yeah, since drawing routines are generally fairly tight loops, they'll just get cached on the first run through. ITCM is good when you have something that's called occasionally throughout the frame, but not often enough to stay in the cache between calls.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#74671 - Mollusk - Mon Mar 06, 2006 10:48 pm

ok, I'll test ITCM on other program parts to see if it gives them speed increases then...
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#74904 - acox - Wed Mar 08, 2006 6:33 pm

DekuTree64 wrote:
Yeah, since drawing routines are generally fairly tight loops, they'll just get cached on the first run through. ITCM is good when you have something that's called occasionally throughout the frame, but not often enough to stay in the cache between calls.


Since that stuff is already in a tightly coupled memory, you wouldn't want it poluting the cache as well.

Anyone done some work on keeping the itcm & dtcm contents out of the caches?
_________________
3D on GBA

#74905 - pepsiman - Wed Mar 08, 2006 7:02 pm

acox wrote:
Anyone done some work on keeping the itcm & dtcm contents out of the caches?

Devkitarm does this by default.