Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Propeller C Library Studies

Propeller C Library Studies

Create and Test the Library

Create Library Archives

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.

  • Click the Show Project Manager button at the bottom left of the SimpleIDE window.

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, we’ve been sticking with CMM (compact memory model).  We’ll start by compiling the library for that memory model first.

  • Under the Project Options tab, make sure the Memory Model dropdown menu is set to CMM Main RAM Compact.
  • Make sure the Board Type is set to ACTIVITYBOARD. 

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.

  • Click the Project Manager pane’s Linker tab.
  • Put a checkmark in the Create Project Library checkbox (if there isn’t one already).
  • Make sure Tiny Lib and Pthread Lib are unchecked.

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.

  • Click the top toolbar’s Build Project icon.

After you do this, there’ll be a file named libawesome.a inside a cmm subfolder.

Try This – Another Memory Model

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). 

  • Set the Memory Model dropdown to LMM.
  • Click the Build project button.
  • Use your file browser to verify that libawesome now has two subfolders, and that each one has a libawesome.a binary archive.
  • Set the Compiler Type dropdown menu back to CMM and re-save the project.

 


Did You Know?

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).


 

Your Turn – Verify with a New Project

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.

  • Close and reopen SimpleIDE.  (Important! This step is required for SimpleIDE to be ready to use the new library you have created.)
  • Click New Project.
  • Save it as Test Awesome Library to the My Projects folder.
  • Paste the code below over the blank template code New Project gives you.
  • Click Run with Terminal, and verify that #include “awesome.h” now gives your program access to the awesome and epic functions.
/*
  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"
}

 


Printer-friendly version
Add Header and Source Files
Prev
Reduce Program Size with a Simple Library
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress