Page 1 of 1

GCC/ld/rules.ld adjustment

Posted: Wed Mar 23, 2016 10:37 am
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.

Re: GCC/ld/rules.ld adjustment

Posted: Sun Apr 03, 2016 5:01 pm
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

Re: GCC/ld/rules.ld adjustment

Posted: Sun Apr 03, 2016 6:41 pm
by flabbergast
Thanks, that should do as well. Nice solution!