Filippo - ELMARC
stranger
Reged: Apr 17 2008
Posts: 4
|
|
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
Reged: Aug 02 2007
Posts: 32
|
|
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
Edited by alager (Fri Apr 18 2008 11:27 AM)
|
bkropf
Cypress AE
Reged: Jul 12 2007
Posts: 11
|
|
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
Reged: Aug 02 2007
Posts: 32
|
|
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
Reged: Apr 17 2008
Posts: 4
|
|
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
  
Reged: Oct 19 2003
Posts: 1136
Loc: Devon, UK
|
|
You can download a pre-compiled Perl release for numerous different platforms from http://www.activestate.com/.
|
Serhiy
stranger
Reged: May 09 2008
Posts: 2
|
|
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
Edited by Serhiy (Fri May 09 2008 12:56 PM)
|
clyde
HI-TECH team member
   
Reged: Oct 16 2003
Posts: 470
|
|
It's on the list to be added to the assembler/linker in a future version.
|
Serhiy
stranger
Reged: May 09 2008
Posts: 2
|
|
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
|