GCC/ld/rules.ld adjustment

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: utzig, lbednarz, tfAteba, barthess, RoccoMarco

flabbergast
Posts: 71
Joined: Sat Aug 22, 2015 1:22 pm

GCC/ld/rules.ld adjustment

Postby flabbergast » Wed Mar 23, 2016 10:37 am

I would like to suggest a small adjustment to GCC/ld/rules.ld file (patch attached), against the current svn. The point is that this makes it possible to use custom ld scripts without extra hassle of copying over rules* ld files as well.

Explanation: if rules* files do not reside in the same directory as the main ld script (e.g. STM32F042x4.ld which doesn't come with the mainline ChibiOS - so I put it in the project directory) then the INCLUDE commands can't find the rules_*.ld files in the main ChibiOS tree. It's because the search paths passed normally to linker are 1) wherever the main ld script is; and 2) os/common/startup/ARMCMx/compilers/GCC
However the rules_* ld files are not there, they're in the 'ld' subdirectory of 2).

With this patch, I can 'INCLUDE ld/rules.ld' in my main project ld script, and then the nested INCLUDEs in the rules.ld find the rules_*.ld correctly.

This makes no change to the demos/ldscripts included in the mainline ChibiOS because of 2) above.
Attachments
rules.ld.patch.zip
(374 Bytes) Downloaded 53 times

User avatar
Giovanni
Site Admin
Posts: 12177
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 570 times
Been thanked: 487 times
Contact:

Re: GCC/ld/rules.ld adjustment

Postby Giovanni » Sun Apr 03, 2016 5:01 pm

Hi,

I modified rules.mk instead, now the library path is $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/ld, this should fix the problem. Having a library path to $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC was pointless because ld files moved all under ./ld.

Giovanni

flabbergast
Posts: 71
Joined: Sat Aug 22, 2015 1:22 pm

Re: GCC/ld/rules.ld adjustment

Postby flabbergast » Sun Apr 03, 2016 6:41 pm

Thanks, that should do as well. Nice solution!


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 4 guests