Shop OBEX P1 Docs P2 Docs Learn Events
The structure of C on the propeller — Parallax Forums

The structure of C on the propeller

Jumping from SPIN to C on the prop, not quite sure where these questions should be posted... (here, because this is not 'blockyProp'??).

Anyhow, I notice many programs include the propeller.h file in addition to many other .h files. I can see in the /Learn/Simple Libraries/ directory there are many sub-directories that contain the .h files for specific libraries (such as fdserial.h file is contained in /Learn/Simple Libraries/TextDevices/libfdserial directory). However, I cannot see any place that the propeller.h file is listed, nor any source files for the actual c coding for the methods contained in propeller.h. I realize one can use the Help/Simple Library Reference menu from SimpleIDE and see the html file /SimpleIDE/Learn/Simple%20Libraries%20Index.html which shows the documentation of propeller.h (and actually use links on that page to see a html listing of the source code.)

So my question is, where exactly IS the propeller.h file and the corresponding propeller.c source code? Is this code already compiled to binary form and 'baked in' to the propellerGCC? Why are all the other Simple Libraries C source code available in sub-directories of /Learn/Simple Libraries/ ? Is this because the propeller.h file is always used, while any other library file may or may not be included/compiled when a project is built?

Thanks,
Nate

Comments

  • Heater.Heater. Posts: 21,230
    I'm sure searching for "propeller.h" with whatever file finding tools your operating system has will find it for you.
  • I think that's in the SimpleIDE workspace, which is in your user folder if you're on Windows. The sources are compiled into libraries and just linked to your code when you build, but they're also included so you can look through them, and there's still a good amount of code in the headers themselves. I'm not on a SimpleIDE system at the moment, but there's a menu item somewhere to show or open the workspace folder if I'm not mistaken. Search through that and you might find them.
  • homosapienhomosapien Posts: 147
    edited 2017-07-27 20:26
    It is in the root directory under /usr (in Linux). I am still somewhat new to Linux and my search expression ('sudo find . -iname propeller.h' rather than 'sudo find / -iname propeller.h') was only looking below my /home directory.

    It is somewhat weird that all the libraries seem to be listed in the /Learn folder, except for the propeller.h/c files...

    Nate
  • In SimpleIDE click on "Tools" and then "Properties". Then look at the "GCC Folders". The GCC include directory is located at the same level as the bin directory that contains the PropGCC executable. propeller.h is in the include directory. propeller.h is not part of the simple library, which is why you won't find it in the SimpleIDE/Learn sub-directories. I don't believe there is a propeller.c file. Anyhow, all of the standard PropGCC libraries are pre-built and distributed as binaries. The source if available on GitHub.
  • TorTor Posts: 2,010
    If you have 'locate' or 'mlocate' installed you can just do 'locate propeller.h' and it'll find any and all instances immediately.
  • On my Linux machine, the header files are located in /opt/parallax/propeller-elf/include.
  • Great answers, thanks. I think my main problem was seeing library folders in the /Learn folder and not realizing they were for reference.

    Not that this is an important detail, but when looking in the 'Simple Libraries Folder Index', I see a bunch of headings such as 'Audio', 'Convert', 'Display' and also 'Propeller GCC' where I see 'propeller.h' listed, but this is not part of the Simple Library? Does the term 'Simple Library' mean anything more than 'some useful libraries included with the SimpleIDE download'?
  • homosapien wrote: »
    Does the term 'Simple Library' mean anything more than 'some useful libraries included with the SimpleIDE download'?

    Quite specifically, it is https://github.com/parallaxinc/Simple-Libraries
  • They are helper libraries, intended to get beginners up and running on the Propeller, much like Arduino libraries make development for Atmel (and other) devices easier.
Sign In or Register to comment.