sys/stats: Allow stats to be registered before sysinit
sys/stats: Allow stats to be registered before sysinit

Some modules may want to register stats before sysinit, e.g. some BSP
can create os_dev in hal_bsp_init and corresponding driver will try to
register stats on device init which means before sysinit is called.

To make this possible, stats code was modified a bit so it will
automatically initialize itself on 1st register call in case it was not
yet initialized via sysinit. This is possible since it does not have any
extra dependencies.

To avoid using some new global variables which hold initialization state
we can just check stat for number of registered stats - it will be
non-zero after initialization since "stat" is always registered.

mlaz/mynewt-core,mlaz/mynewt-core,mlaz/mynewt-core,mlaz/mynewt-core,mlaz/mynewt-core