View previous topic :: View next topic |
Author |
Message |
pickup
Joined: 22 Jun 2013 Posts: 9
|
Is it possible to make compiled library? |
Posted: Sun Oct 19, 2014 3:46 pm |
|
|
Hello,
Is it possible to create compiled library? For example mikroC PRO has an option as "Build all files as library".
Regards. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Mon Oct 20, 2014 12:38 am |
|
|
Yes, but don't.....
It is possible with the current compilers to generate a file, and link this.
Look at #EXPORT & #IMPORT, and particularly the relocatable option for this.
Historically this had problems, but does now work properly.
However CCS has a very efficient optimiser, and doing this, prevents quite a lot of the optimisation. Functions, and RAM space used in the module, which if it is compiled as source, with the main code, get optimised, do not get re-used in the same way if this is done.
I found on a project that compiled to 48Kwords (on a PIC33), took over 50Kwords if the main I/O functions were separately linked, and RAM use also grew by about 5%. |
|
|
pickup
Joined: 22 Jun 2013 Posts: 9
|
|
Posted: Mon Oct 20, 2014 11:27 am |
|
|
Aha Ttelmah!!!!! It's very good to get your answer . You are the guru of CCS. And you also helped me before. Thanks a lot.
Well, I did not understand how to make compiled library. But I shall read what you have mentioned and try to understand. An example or step by step guide would be very helpful. Just one simple function like
int add(int x, int y){
return(x + y);
}
Best regards. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Mon Oct 20, 2014 12:28 pm |
|
|
Look at the file mcu.zip in the examples directory. It contains a complete example of a set of routines, and loading these from the main code. Look in the manual at the linker section which tells you how to use this. |
|
|
pickup
Joined: 22 Jun 2013 Posts: 9
|
|
Posted: Tue Oct 21, 2014 3:25 pm |
|
|
Thanks a lot guru
Very interesting, I am reading.... I did not know about this file - mcu.zip.
Take care. |
|
|
|