Filippo - ELMARC
(stranger)
Thu Apr 17 2008 03:33 AM
Unused routines on program memory

I added a library file on my project and I call only some routines but all of them are on program memory?
how can I delete them to save flash?
Is there a compiler option?


alager
(Tester - PRO for PSoC)
Fri Apr 18 2008 11:26 AM
Attachment
Re: Unused routines on program memory

Someone a while back wrote a perl script called reduce.pl and posted it to psocdeveloper.com. I've attached it here. It will remove unused API functions, with one caveat, that is discussed in this link:
External code sublimator

This is the only way to remove unused APIs safely on a 29x part for the ICC compiler, and the only way I know of when using the HiTech compiler.

The forum forces certain file extensions for attachments, so I renamed the file to .lst. Perl usually used .pl, so just rename it to reduce.pl and you're good to go. Also make sure you have perl installed on your computer.

Aaron


bkropf
(Cypress AE)
Fri Apr 18 2008 11:54 AM
Re: Unused routines on program memory

Unfortunately, HI-TECH doesn't do any removal of assembly language routines. It either links in a whole .asm file or it doesn't.

Another way you can accomplish what you want is by adding your own source .asm file. You can cut and paste only the routines and code you want from the library .asm file (and any needed .inc or .h files). You could change the names of each of the routines in the same way. Then, your calls to the routines will only go to your custom file, and there will be no calls to routines in your library .asm file. Then, the library .asm file won't get linked in at all, whereas your customer .asm file will. Now, you're only linking in exactly the routines you want. This may be slightly tedious, but it should work fine. You also wouldn't need to worry about trusting someone else's perl script

Best regards,
Ben


alager
(Tester - PRO for PSoC)
Mon Apr 21 2008 11:47 AM
Re: Unused routines on program memory

Ben,

This is exactly what the perl script does. Only it does it in about 1.5 seconds, including the spawn time for the command window. The nice thing is, you don't have to worry about regenerating, because it'll only cost you another 1.5 seconds, not 30 minutes, when you have more than a few modules and more than one configuration.

Trust is another issue that must be decided by each.
Let the machines work for you, not the other way around.

Aaron


Filippo - ELMARC
(stranger)
Thu May 08 2008 05:01 AM
Re: Unused routines on program memory

Sorry me but I still have understood how to use the script.
With difficulty I downloaded perl but are suorce files (C files).
Someone can help me and explain the detailed instructions?
thank you

Filippo


mikerj
(Guru)
Thu May 08 2008 05:21 AM
Re: Unused routines on program memory

You can download a pre-compiled Perl release for numerous different platforms from http://www.activestate.com/.

Serhiy
(stranger)
Fri May 09 2008 12:53 PM
Re: Unused routines on program memory

Hello Ben,

You are right. But why HI-TECH compiler doesn't support the special Assembler derectives like Section. and Endsection. under ImageCraft compiler that allow the asm Dead-Code elimination specified between these directives?

The .SECTION directive must be followed by an exported global label. If there is no call to the global
label, the code will be eliminated and call offsets will be adjusted appropriately. The .ENDSECTION
directive ends the dead-code section.

Why the same mechanism of the Dead-Code Elimination isn't supported under HI-TECH compiler? Who know about it? Let me know.

Thanks.

Best Regards,
Serhiy


clydeAdministrator
(HI-TECH team member)
Fri May 09 2008 05:21 PM
Re: Unused routines on program memory

It's on the list to be added to the assembler/linker in a future version.

Serhiy
(stranger)
Mon May 12 2008 06:17 AM
Re: Unused routines on program memory

Hello Clyde!

Thank you for the great news. Could you inform me when it is planned to be realized and done? This information will be helpful for me for planning of the asm-functions library for the one of the PSoC tool.

Best Regards,
Serhiy Prudkyy



Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5