Hi Chris,

On 10 Dec 2016, at 13:37, Christopher Collins wrote:

Darn, you're right. I'm writing these emails from my phone, and I didn't
look at the code closely enough.  For other packages, the start event
only gets executed the first time the event queue gets used (as you
said).  I guess it has worked out in practice because the application
uses the package shortly after the OS starts.


Yeah, that’s what I noticed too. :-)

For now, it’s OK, I can just call my init from main() after the default event queue is set.

That's not so great.  Second stage initialization sounds good to me.
Alternatively, the system could keep track of packages that need an
event queue, and enqueue their start event when a default event queue is
set.  Earlier, we discussed using linker sections to accomplish this
without requiring any RAM. I looked into this, but concluded it wasn't
possible without modifying the linker scripts.


I think we should probably use this opportunity to (again) review system initialization, which is fast becoming our most circularly discussed topic :-) I’d throw in there whether or not to initialize components in the idle task (using up stack), and making sure that we map sysinit stages to the driver initialization stages as well.

As far as a proposal, what do you think of having 2 initialization stages:

- Before OS
- After OS

And we can break each stage into primary, secondary and tertiary order, so, in terms of number space we have:

- 0: first init order, before OS
- 1: second init order, before OS
- 2: third init order, before OS
- 3: first init order, after OS
- 4: second init order, after OS
- 5: third init order, after OS

I think we probably need to modify the package system configuration to specify both stage & order, e.g.

pkg.init_func_startup.name: XX
pkg.init_func_startup.order: 0
pkg.init_func_kernel.name: YY
pkg.init_func_kernel.order: 1

This should allow us to hook in at either of these stages.

I also think we probably need to give meaning to at least the primary and secondary init orders here, e.g. designate which services are available after each of these functions and come up with some documented nomenclature for it.

Sterling

Reply via email to