Hello all, I am about to merge a PR (https://github.com/apache/mynewt-core/pull/1075) which eliminates the need to explicitly call `conf_load()`. Nothing bad will happen if your app continues to call `conf_load()`, but the call can be safely removed after the PR is merged.
Background- The `sys/config` package is used for persisting data across reboots. To restore all the persisted data from flash, an app had to manually call `conf_load()`, typically from `main()`. It would be preferable for the data to get loaded automatically during system initialization, but this is not possible; the underlying storage containing the config data is not ready for use until the application explicitly initializes it in `main()`. Typically, config data is stored in a flash circular buffer (fcb), something which sysinit and syscfg know nothing about, and which must be manually initialzed by the app. Thus, `conf_load()` during sysinit would fail. The PR referenced above causes `conf_load()` to be called automatically, but it delays the call until the default event queue begins being processed. Typically, the default event queue is processed in an infinite loop at the end of `main()`, so delaying the call to `conf_load()` to this point gives `main()` the opportunity to initialize FCBs and other storage first. Issue- Packages may attempt to access persisted data before `conf_load()` has been called. This issue has always existed, but the referenced PR exacerbates it. This issue can arise in a number of ways: (1) Package tries to use persisted data during sysinit. (2) High priority task tries to use persisted data as soon as it starts running. (3) Package that runs in the default task tries to use persisted data immediately after sysinit completes. (1) and (2) were always an issue. (3) is a new issue that arises if an app takes advantage of the automatic call to `conf_load()`. If your app uses a package which tries to use persisted data immediately on startup, then you may want to continue calling `conf_load()` from `main()`. Thanks, Chris