On Wednesday, 8 April 2015 at 11:17:12 UTC, Mike wrote:
On Tuesday, 7 April 2015 at 20:33:26 UTC, Jens Bauer wrote:

Question number 3: How can I call an external function and keep the binary file size down ?

Are you compiling with -ffunction-sections -fdata-sections and linking with --gc-sections? You may need to in order to get rid of some things.

I had -fdata-sections for the compiler and --gc-sections for the linker, but I was missing -ffunction-sections. Thank you for letting me know about this.
Unfortunately, it did not reduce the size of the output file.

What do you using for your D runtime?

minlibd by Timo Sintonen.

 Perhaps some code in your runtime is implicitly linking
to some code you're not directly calling.

Maybe that's what's causing it, but I find it strange that calling an empty function outside the source file will cause that huge difference.
-But of course, there's a logic explanation somewhere. ;)

Note: I can rename the 'main()' function to 'My1Own2Weird3Function4Name567()' and the same thing happens, so it's not because main() is special.

I also add the following to my linker scripts to get rid of stuff I don't find necessary:
[snip]

It might be caused by the linker script; I'll try and see if I can modify it to get rid of those things.

You can see the latest incarnation of my linker script here: https://github.com/JinShil/stm32f42_discovery_demo/blob/master/linker/linker.ld

Mine is quite huge, so I'll try out yours as a starting point. ;)

Reply via email to