#143000 - eKid - Tue Oct 16, 2007 12:28 am
I have some code here that assembles to ~11kb in size, and i have some data that i need assembled at 0x4000, how is this done... (i need the rom padded to 16kb then the data comes), some attempts failed because of other sections being written to the end too
#143062 - silent_code - Tue Oct 16, 2007 1:40 pm
this is interesting. me, i'd like to place executable code to a certain (not yet fixed) address. please post any progress! my stuff is rather low on the priority list, so i don't have time to play very much with it.
i guess you could somehow tell the compiler you want a specific amount of bytes (like an array) to be reserved, starting at 0x4000. but how to do that is beyond me.
good luck and happy coding!
#143064 - kusma - Tue Oct 16, 2007 2:07 pm
This is typically what a linker-script is used for.
#143067 - silent_code - Tue Oct 16, 2007 2:36 pm
well? any hints, links, whatsoever? come on, i know you have them. ;^p
#143068 - kusma - Tue Oct 16, 2007 3:16 pm
silent_code wrote: |
well? any hints, links, whatsoever? come on, i know you have them. ;^p |
Yes, stay the f*ck away from it, and look for an alternative to forcing the exact address; writing linker scripts easily gives you brain-cancer. Perhaps getting a different hobby? I heard knitting is less frustrating.
#143079 - silent_code - Tue Oct 16, 2007 5:56 pm
by "them" i meant "hints", "links" (to hints) and "whatsoever"... so i found your post quite irritating... mostly this part:
kusma wrote: |
Perhaps getting a different hobby? I heard knitting is less frustrating. |
to make it clear, i don't want you to send me any linkscripts.
i know they are a pain to write, that's why this stuff is so low priority (right now) and i'm still "hunting" for information - as much as i can get.
ps: tepples and me have *something* in common, you know.
isn't there a possibility that's similar to putting code and data into specific ram? (i guess the answer is link script.)
#143083 - kusma - Tue Oct 16, 2007 6:38 pm
silent_code wrote: |
isn't there a possibility that's similar to putting code and data into specific ram? (i guess the answer is link script.) |
Yes there is, and yes the link-script is the way to do just that. I won't lecture you on that, simply because I'm not the right person for the task; my experience with writing link-scripts is pretty bad. Lack of proper documentation is the primary reason for that. I'm sure there's people who are better suited for this here on these forums. But sure, I'd love to see some documentation on link-scripts myself, so if someone has some good links, shoot.
I must say, I can't really find many good reasons to require a specific memory location for a given symbol, so I'm wondering if you're attacking the problem from the wrong side.
#143086 - silent_code - Tue Oct 16, 2007 7:06 pm
well, i know ds organize (?) has this plug-in and program extendability, but that seems like overkill to me.
what i want is to have some interchangable functions that don't need to reside in memory all at once (think of enemy ai - most of the time there won't be a single level with all enemy types, so why wast valuable memory with routines that won't be called around 2/3 of the game?), but can be "swapped". i thought having a specific memory location for that would be easier than relocating everyting.
i hope you understand what i mean.
#143095 - kusma - Tue Oct 16, 2007 8:24 pm
silent_code wrote: |
i hope you understand what i mean. |
Yes, you mean overlays. The default linkerscript for gba in devkitPro supports iwram overlays, so you don't need to be messing around with your own if gba and iwram is your issue. If not, look at the gba.specs file in devkitpro, and try to extrapolate that code to whatever you need.
#143099 - tepples - Tue Oct 16, 2007 9:32 pm
You could try taking a look at the specs, link script, etc. for a DLDI driver.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#143118 - eKid - Wed Oct 17, 2007 1:11 am
i ended up just pointing the program to 0x8004000/0x2004000 and padding the rom to 16kb...