Linking and debugging custom runtime packages

I've written some custom runtime packages which work fine loaded at runtime.
I'd like to statically link them and to allow debugging into them.
How can it be done?

Thanx.
Jordi.