When your applications call the simpletools library’s pause function, the compiler doesn’t actually get anything from the .c file. Instead, it goes looking for a file named libsimpletools.a. The .a is short for archive, and the file is a binary image of the compiled C language source code. These files can help reduce the size of your program code.
Let's make the archive for your awesome library.
The Project Manager windowpane that opens up should look like this:
Propeller GCC is designed to work with several different memory models. In the Propeller C Learning System tutorials [1], we’ve been sticking with CMM (compact memory model). We’ll start by compiling the library for that memory model first.
Using a different board? Look for it by name in the Board Type list. If it's not there, click Help and look up Board Types in the SimpleIDE User Guide.
The next step is important; we need to configure the project to generate the library archive files.
After you have configured the project settings to create a project library and selected the memory model, you’re ready to build the project and create a library archive for the compact memory model.
After you do this, there’ll be a file named libawesome.a inside a cmm subfolder.
You can compile your code for other memory models. Let’s try LMM (large memory model), which executes the code faster, but also takes more memory for the same program (compared to compact memory model).
Memory models are different ways to store and execute the program code on the Propeller microcontroller and connected memory devices. The CMM Main Ram Compact memory model used most often the Propeller C Tutorials puts all the program code into a 32 KB file that gets loaded into the Propeller chip's main RAM, either directly or from an EEPROM chip like the one on the Activity Board (original or WX version). Other memory models might use a very large EEPROM, Flash memory, or just the memory in a single cog.
For more information on this advanced topic, see the user guide (click Help and select SimpleIDE User Guide).
SimpleIDE will have to be restarted before it can become aware of this library for use by other projects. After that, it’s a good idea to test and make sure a different project can use it.
/* Test Awesome Library.c */ #include "simpletools.h" // Include simple tools #include "awesome.h" // Include awesome library int main() // main function { print("Ken"); // Print a name awesome(); // Append with "is awesome!\n" print("Stephanie"); // Print another name epic(); // Append with "is epic!\n" }
Links
[1] https://learn.parallax.com/propellerc