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 > ARM7 has little memory? [SOLVED]

#46482 - strager - Sat Jun 25, 2005 9:49 pm

Origional post:
I am writing an emulator for the DS (surprise, surprise), and I am having a problem. It has been stumping me for the past few days, so I've decided that posting here would be my last resort. Here't goes:

Since the ARM7 has some extra memory the ARM9 does not have (I don't want to go into the *TCM), I decided that it should take charge of memory. However, this isn't going too well. The problem occurs when I have about 8 Kilobytes of memory allocated to an array (static or dynamic), the linker complains about not enough memory in .iwram and piles up errors about overlapping sections. I've tried numberous things, such as forcing it to specific sections with the result of the linker refusing to think that there are such sections (.ewram, .sbss), and editing the lnkscript (risky, and didn't work).

Thanks in advance for the help.

Edit 1: [Half-way] solved, thanks to gladius. How I got it half-way fixed:
Changed "iwram" to "ewram" in the .rodata section of the lnkscript.
The problem was caused by my constant array (512KB) that had slipped my mind. It was being put in iwram where it could not fit.

Edit 2: It links OK, but now it bloats my binary. I have no clue why this would happen, other than the raw data appearing first, then padding to fill the rest of the memory (- mirrors?), then the actual data. It resulted in a ~24MB file, or ~0x01800000. 0x0200000 + 0x01800000 = 0x03800000, or the end of EXRAM. I wonder why this occurs. If anyone has knowledge of lnkscript syntax and can fix this, please, help me out.

Edit 3: I have confirmed that this is the case (read Edit 2).

Edit 4: This should have been in Edit 3; I have found out that the lnkscript in fact wants to load the code into EXRAM. I had thought it always went into main RAM. I need to know how I could move the text section over to the main RAM with my .rodata. Replacing iwram with ewram does not work this time.

Edit 5: DOH! I had no idea that main RAM was shared by both CPUs. This spoils my plan. :( No matter, I'll just stash everything in the ARM9.

This problem has been solved.


Last edited by strager on Sun Jun 26, 2005 3:07 pm; edited 5 times in total

#46489 - IxthusTiger - Sun Jun 26, 2005 2:43 am

for emulating on the DS or for emulating the DS?

If the former, and if you don't mind that I ask, what are you emulating?

#46490 - strager - Sun Jun 26, 2005 3:19 am

IxthusTiger wrote:
for emulating on the DS or for emulating the DS?

If the former, and if you don't mind that I ask, what are you emulating?


1) On.
2) None of your business. :P
3) There is no #6.

And yes, your post was really helpful to my problem.