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.

C/C++ > Need help with custom arm7 linker script

#162363 - jimis - Mon Sep 01, 2008 9:13 am

How can I set my project to use a custom linker script?
From what I have learned so far I need to change the linker parameters. I created a file named customds_arm7.specs

----Original "ds_arm7.specs"
---------------------------------------------------------------
%rename link old_link

*link:
%(old_link) -T ds_arm7.ld%s

*startfile:
ds_arm7_crt0%O%s crti%O%s crtbegin%O%s
----------------------------------------------------------------

----Custom file "customds_arm7.specs"
--------------------------------------------------------------------
%rename link old_link

*link:
%(old_link) -T custom_arm7.ld%s

*startfile:
ds_arm7_crt0%O%s crti%O%s crtbegin%O%s
---------------------------------------------------------------------

All i did was to replace -T ds_arm7.ld%s with -T custom_arm7.ld%s
(the custom_arm7.ld is a copy of the original ds_arm7.ld)
In the makefile in the linker parameters i wrote -specs=customds_arm7.specs and i don't get any errors.
Is this method correct?

#162384 - jimis - Mon Sep 01, 2008 6:05 pm

No need to answer. I solved my problem.

#162387 - gauauu - Mon Sep 01, 2008 7:01 pm

jimis wrote:
No need to answer. I solved my problem.


Care to share your solution? It's always nice when people share the solution, so future people with the same problem can learn....

#162404 - jimis - Tue Sep 02, 2008 8:29 am

Of cource. What i did above was correct.
I made a custom arm7 linker script to copy arm7 binary at 0x03800000 in order to use shared wram for communication between the two processors.
My game crushed constantly until I added to ndstool line "-r7 0x3800000 -e7 0x3800000". I would have never realised that error but fortunatelly for me I got an answer in another post.