GCC/ld/rules.ld adjustment

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

Moderators: RoccoMarco, lbednarz, tfAteba

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

GCC/ld/rules.ld adjustment

Post by flabbergast »

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 492 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: GCC/ld/rules.ld adjustment

Post by Giovanni »

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

Post by flabbergast »

Thanks, that should do as well. Nice solution!
Post Reply