Shop OBEX P1 Docs P2 Docs Learn Events
Catalina C: Creating and using a plugin — Parallax Forums

Catalina C: Creating and using a plugin

David BetzDavid Betz Posts: 14,516
edited 2010-07-30 02:26 in Propeller 1
I want to write a plugin to allow my LMM C program to read from the EEPROM. I've looked over a sample plugin (the RTC plugin) and how it's called from C code but what I don't understand is how to arrange for my plugin to be loaded and registered when my C program starts. It looks like the RTC plugin takes care of registering itself when it starts executing but how does it get loaded in the first place? I know that the Catalina C runtime code arranges for the HMI plugins to be loaded at startup but how to user written plugins get loaded?

Thanks,
David Betz

Post Edited (David Betz) : 7/30/2010 1:42:28 AM GMT

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2010-07-30 01:38
    Okay, I guess I can answer my own question. It looks like I need to add code to lmm_default_Input.spin to load and initialize my plugin. I should probably also add an option (#ifdef) to control whether the plugin is to be used in a particular program. Should I also add an EEPROM plugin type to include/catalina_plugins.h? Do the plugin names need to be three characters long or will EEPROM work?
  • RossHRossH Posts: 5,519
    edited 2010-07-30 02:26
    David,

    Correct. You need to define a symbol, then add #ifdef .. #endif sections in all the targets (lmm_xxxx, emm_xxxx, xmm_xxxx etc) - search for everywhere one of the current symbols is used in the target and target/input directories (e.g. search for "ifdef CLOCK" to find whererver the RTC plugin is used).

    However, EEPROM is not a good idea for the symbol name - this command line symbol it is already used to indicate that the EEPROM loader be used.

    I'd suggest something like EEREAD. The plugin type itself doesn't need to be 3 chars - that's just a convention I adopted since many of them were (HMI, RTC etc).

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
Sign In or Register to comment.