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 > [SOLVED] Q: Setting memory sections for some code & data

#78491 - Mighty Max - Fri Apr 07, 2006 6:34 pm

Hello,

i got a problem with some linker settings, and i have no idea on the solution, maybe someone might be able to help:


I have some code and some data i want to be in a given mem region. I want them to be in the area 0x23B8000-23EFFFF. There is more then enough space for them there.

I did several things (to try) to get this working: I've defined a data and a code section at this address via the ds_arm9.ld. But when i assign anything, data or code into this section via "__attribute__ ((section("name")))" the thing won't start anymore. (HW keeps whitescreens, dualis crashes)

Even if i don't access any of this region, and do a simple "Hello World" nds. The .map file looks ok. The .nds is about 3.8MB, so it's building the arm9 bin as a monolithic block as expected.


I tested if i could make a workaround. The nds is small enough to match complete in this region, so i modified the ewram start & size in the ld. Again, the .map looked right, the nds was at 73kB (the same size as without any tries to get into this memory region)

But on the load it crashes again with whitescreens.


Any help would be great.
_________________
GBAMP Multiboot


Last edited by Mighty Max on Fri Apr 07, 2006 8:13 pm; edited 1 time in total

#78503 - DekuTree64 - Fri Apr 07, 2006 7:19 pm

Make sure ARM7 isn't using that address range at all.

For the ewram start change test, make sure your ndstool call puts the ARM9 start address at the right place.

Make sure there are no stacks or anything are defined to be in that area (in arm9.ld, stuff like __sp_irq = suchandsuch).

Make sure __eheap_end doesn't go past your area's address.

I've monkeyed my way around linkscripts to add new sections before without too much trouble, so don't give up too easily :)
If you do create it as a section, base it off .itcm or something that's not contiguous with the main binary, so the actual data will be part of the main binary, even though the linking address is way at the end. Then add a line in crt0 to copy it to the real address like the other sections.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#78508 - Mighty Max - Fri Apr 07, 2006 7:51 pm

Thanks DekuTree64,

the change of the NDS entrypoint did it. Stupid me *g*

Now i can finally finish the project :)
_________________
GBAMP Multiboot

#78555 - thundrestrike - Sat Apr 08, 2006 2:24 am

what are you makeing, mightymax? im just curious thanks
_________________
popcorn

#78609 - Mighty Max - Sat Apr 08, 2006 11:56 am

It will need a lot of tweaking still before i can release info to it.
I don't want to promise something i can't hold.

It looks good so far, tho.
_________________
GBAMP Multiboot