El sáb, 16/1/16, Molnár Károly <carlos...@freemail.hu> escribió:

>On Tue, 12 Jan 2016 23:15:51 +0000 (UTC)
>
>Vicente Sendra <vise...@yahoo.es> wrote:
>
>> Hello.
>> 
>> I've been using SDCC (PIC port) for some time and using gputils to assemble 
>> and link.
>> 
>> Gplink has an option to remove dead sections -O2.
>> 
>> It crashed when using this option, but recently i've repported the bug and 
>> it has been quickly fixed.
>> (See details here: https://sourceforge.net/p/gputils/bugs/286/ )
>> 
>> The problem is -O2 removes code only from entire sections not used, and SDCC 
>> generates only one code section for all functions of each file. So code is 
>> only removed if no function of a file is used. 
>> This is not very useful, normally you have some libraries and use part of 
>> the functions of that files, all unused functions should be removed. This 
>> could be possible if each file had it's own code section. I have done some 
>> test with real projects (adding a code section for each function manually to 
>> the resulting asm) and i've seen very big memory savings after linking (up 
>> to 20%, very project dependent).
>> 
>> I suggest adding a new Option for the SDCC PIC port to create a code section 
>> for each function in every compiled file. I think it should be very easy to 
>> implement this option, it just adds a line for each function in the output 
>> file, i propose the following format (the one i used in my tests):
>> 
>> function_name (.c file function) -> _function_name (.asm file function) -> 
>> code_function_name (.asm file code section)
>> 
>> Just add "code" prefix to each generated asm function name and add new 
>> section line before the function start label, an example here:
>> 
>> --------------------------------------------------
>> ;***
>> ;  pBlock Stats: dbName = C
>> ;***
>> ;entry:  _serial_hw_init    ;Function
>> start
>> ; 2 exit points
>> ;has an exit
>> ;; Starting pCode block
>> code_serial_hw_init    code   
>> ;Function start
>> _serial_hw_init    ;Function start
>> ; 2 exit points
>> ;    .line    695;
>> "src/serial/serial_hw.c"   
>> pin_mode_input(SERIAL_HW_RX0);
>>     BANKSEL    _TRISB
>>     BSF    _TRISB,5
>
>> 
>
>The solution is ready, in the #9457 svn version.
>
>Molnár Károly


Hello.

I've checked #9462 svn version and everything seems to be ok.

I've tested it with a sample project (PIC16F690) and savings are quite massive:

O1 SDCC pre-svn#9457:
ROM 3780 - RAM 256

O2 SDCC pre-svn#9457:
ROM 3321 - RAM 240 (-12% ROM)

O2 SDCC svn#9462
ROM 2673 - RAM 240 (-29% ROM)

Thank you very much!


El mié, 13/1/16, Philipp Klaus Krause <p...@spth.de> escribió:

>Isn't this a way of implementing RFE #452?
>
>Philipp

As i see it every port will rely on the linker implementation to do it, so 
implementing RFE #452? will need to be addressed by each linker program.



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to