Catalina C: Creating and using a plugin
David Betz
Posts: 14,516
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
Thanks,
David Betz
Post Edited (David Betz) : 7/30/2010 1:42:28 AM GMT
Comments
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