How to customise gcc.lkopt ?



gcc.lkopt seems to be automatically generated by the build - so where does it actually come from?

where are the inputs & options from which it is created?


gcc.lkopt is indeed generated automatically by the Studio.
But you can workaround that by, for example making a copy of the script at project’s root directory (e.g. mygcc.lkopt), and edit it as you want.
Then in the project options, go to project properties > C/C++ Build > Settings > ARM ELF GCC C++ Linker

In the command line pattern, you get something like:

${COMMAND} -Wl,--script,gcc.lkopt ......

Just modify it:

${COMMAND} -Wl,--script,../mygcc.lkopt ......

And the linker will use the custom script.


I made the change, but the build is now grindingly slow!

It sticks in dd.exe for ages, and genbin.exe for a long time.

And, once the actual build has finished, it then spends a load more time “refreshing workspace”


Probably because the .axf file has shot up to ~400MB - yes, Mega Bytes!! :open_mouth: