You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@mynewt.apache.org by "m-gorecki (via GitHub)" <gi...@apache.org> on 2026/02/02 10:57:52 UTC
[PR] newt/sysinit: Add possibility to override sysinit prio from target [mynewt-newt]
m-gorecki opened a new pull request, #615:
URL: https://github.com/apache/mynewt-newt/pull/615
This change allows overridding sysinit functions priority in
target.yml. Example:
pkg.init:
ble_transport_ll_init: 10
modlog_init: MYNEWT_VAL(MODLOG_SYSINIT_STAGE)
ble_transport_init: 202
Restrictions:
1. All sysinit functions included by the target must be explicitly
overridden in target.yml. Additional functions may be listed, but
they will be ignored if not included by the target.
2. The $before and $after keywords are not supported.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] newt/sysinit: Add possibility to override sysinit prio from target [mynewt-newt]
Posted by "andrzej-kaczmarek (via GitHub)" <gi...@apache.org>.
andrzej-kaczmarek commented on code in PR #615:
URL: https://github.com/apache/mynewt-newt/pull/615#discussion_r4309099017
##########
newt/sysinit/sysinit.go:
##########
@@ -233,7 +235,51 @@ func ResolveStageFuncsOrder(sfs []stage.StageFunc) ([]stage.StageFunc, error) {
return sfs, nil
}
-func Read(lpkgs []*pkg.LocalPackage, cfg *syscfg.Cfg) SysinitCfg {
+func getTargetStageFuncs(tCfg ycfg.YCfg, cfg *syscfg.Cfg) ([]stage.StageFunc, error) {
+ initMap, _ := tCfg.GetValStringMap("pkg.init", nil)
Review Comment:
target.sysinit
##########
newt/sysinit/sysinit.go:
##########
@@ -233,7 +235,51 @@ func ResolveStageFuncsOrder(sfs []stage.StageFunc) ([]stage.StageFunc, error) {
return sfs, nil
}
-func Read(lpkgs []*pkg.LocalPackage, cfg *syscfg.Cfg) SysinitCfg {
+func getTargetStageFuncs(tCfg ycfg.YCfg, cfg *syscfg.Cfg) ([]stage.StageFunc, error) {
+ initMap, _ := tCfg.GetValStringMap("pkg.init", nil)
+ var sfs []stage.StageFunc
+
+ for name, stageDef := range initMap {
+ stageStr := cast.ToString(stageDef)
+ sf, err := stage.NewStageFunc(name, stageStr, nil, cfg)
+ if err != nil {
+ return nil, err
+ }
+
+ sfs = append(sfs, sf)
+ }
+
+ return sfs, nil
+}
+
+func targetStageFuncsOverride(tStageFuncs []stage.StageFunc, pStageFuncs []stage.StageFunc) error {
+ indexByName := make(map[string]int, len(pStageFuncs))
+
+ for i := range pStageFuncs {
+ indexByName[pStageFuncs[i].Name] = i
+ }
+
+ for _, tSF := range tStageFuncs {
+ if idx, ok := indexByName[tSF.Name]; ok {
+ pStageFuncs[idx].Stage = tSF.Stage
+ delete(indexByName, tSF.Name)
+ }
+ }
+
+ missing := make([]string, 0, len(indexByName))
+ for name := range indexByName {
+ missing = append(missing, name)
+ }
+
+ if len(missing) != 0 {
+ sort.Strings(missing)
+ return util.NewNewtError("Missing pkg.init functions in target.yml:\n\t" + strings.Join(missing, "\n\t"))
Review Comment:
we could also add debug-only log indicating which functions are present on a list but not in build
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@mynewt.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org