SDCC 3.4.0 does not optimize the unused functions, variables and constants. As a result, the hex file size is 18,8kb, and the IAR generates a hex file size 2,5kb.
-------------- Build: Release in test (compiler: Small Device C Compiler)---------------
-------------- Build: Release in test (compiler: Small Device C Compiler)---------------
sdcc.exe -mstm8 -DSTM8S003 --opt-code-size --noinvariant --nolospre -I"C:\Program Files\SDCC\include" -c main.c -o obj\Release\main.rel
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp7. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp6. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp2. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp2. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
sdcc.exe -L"C:\Program Files\SDCC\lib" -o bin\Release\test.ihx -mstm8 -DSTM8S003 --opt-code-size --noinvariant --nolospre -lstm8 --out-fmt-ihx obj\Release\main.rel
Output file is bin\Release\test.ihx with size 18.72 KB
Running project post-build steps
cmd /c "packihx <bin\release\test.ihx>bin\Release\test.hex"
packihx: read 252 lines, wrote 500: OK.
Process terminated with status 0 (0 minute(s), 4 second(s))
0 error(s), 0 warning(s) (0 minute(s), 4 second(s))</bin\release\test.ihx>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SDCC 3.4.0 does not optimize the unused functions, variables and constants. As a result, the hex file size is 18,8kb, and the IAR generates a hex file size 2,5kb.
-------------- Build: Release in test (compiler: Small Device C Compiler)---------------
sdcc.exe -mstm8 --opt-code-size -I"C:\Program Files\SDCC\include" -c main.c -o obj\Release\main.rel
sdcc.exe -L"C:\Program Files\SDCC\lib" -o bin\Release\test.ihx -mstm8 -DSTM8S003 --opt-code-size -lstm8 --out-fmt-ihx obj\Release\main.rel
Output file is bin\Release\test.ihx with size 18.82 KB
Running project post-build steps
cmd /c "packihx <bin\release\test.ihx>bin\Release\test.hex"
packihx: read 253 lines, wrote 503: OK.</bin\release\test.ihx>
This main.c - used only function LCD_init ()
ASM file size is 115,217kb
Why don't work optimization with STM8 CPU?
Thanks in advance!
P.S. I tried all possible COMMAND LINE OPTIONS and SDCC version with STM8 support .
Last edit: Pavlo Kharchenko 2014-09-06
-------------- Build: Release in test (compiler: Small Device C Compiler)---------------
sdcc.exe -mstm8 -DSTM8S003 --opt-code-size --noinvariant --nolospre -I"C:\Program Files\SDCC\include" -c main.c -o obj\Release\main.rel
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp1. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp7. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp6. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp2. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp2. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
Warning: Non-connected liverange found and extended to connected component of the CFG:iTemp16. Please contact sdcc authors with source code to reproduce.
sdcc.exe -L"C:\Program Files\SDCC\lib" -o bin\Release\test.ihx -mstm8 -DSTM8S003 --opt-code-size --noinvariant --nolospre -lstm8 --out-fmt-ihx obj\Release\main.rel
Output file is bin\Release\test.ihx with size 18.72 KB
Running project post-build steps
cmd /c "packihx <bin\release\test.ihx>bin\Release\test.hex"
packihx: read 252 lines, wrote 500: OK.
Process terminated with status 0 (0 minute(s), 4 second(s))
0 error(s), 0 warning(s) (0 minute(s), 4 second(s))</bin\release\test.ihx>
You need not post redundant messsages on both support-requests and the discussion.
I have post a feature request ticket, since what you have encountered is a common problem to all of sdcc's ports.
sourceforge.net/p/sdcc/feature-requests/413/