New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
target [sysinit | sysdown] commands #230
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ccollins476ad
force-pushed
the
target-sysinit
branch
2 times, most recently
from
October 25, 2018 20:47
04a7ac0
to
a175d9f
Compare
ccollins476ad
added a commit
to ccollins476ad/mynewt-core
that referenced
this pull request
Oct 26, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
ccollins476ad
added a commit
to ccollins476ad/mynewt-nimble
that referenced
this pull request
Oct 26, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
ccollins476ad
force-pushed
the
target-sysinit
branch
from
October 26, 2018 19:22
a175d9f
to
17efae5
Compare
This was referenced Oct 26, 2018
ccollins476ad
force-pushed
the
target-sysinit
branch
from
October 27, 2018 00:22
17efae5
to
1cd22d4
Compare
A setting can refer to another with the `MYNEWT_VAL(...)` notation. This commit extracts the code which detects such references and puts it into separate functions.
A package can define logs in its `syscfg.yml` file under the heading of `syscfg.logs`. During the build process, newt generates a C header file called `logcfg/logcfg.h` containing macros for using each generated log. Each entry in the `syscfg.logs` map has the following structure: <log-name>: module: <module> level: <level> guest: <true/false> (optional) For example: syscfg.logs: MY_LOG: module: MYNEWT_VAL(MY_LOG_MODULE) level: MYNEWT_VAL(MY_LOG_LEVEL) It is recommended, though not required, that the module and level fields refer to syscfg settings, as above. This allows the target to reconfigure a package's log without modifying the package itself. The above log definition generates the following code in `logcfg/logcfg.h` (assuming `MY_LOG_MODULE is set to LOG_LEVEL_ERROR (3)): #define MY_LOG_DEBUG(logcfg_lvl_, ...) IGNORE(__VA_ARGS__) #define MY_LOG_INFO(logcfg_lvl_, ...) IGNORE(__VA_ARGS__) #define MY_LOG_WARN(logcfg_lvl_, ...) IGNORE(__VA_ARGS__) #define MY_LOG_ERROR(logcfg_lvl_, ...) MODLOG_ ## logcfg_lvl_(MYNEWT_VAL(MY_LOG_MODULE), __VA_ARGS__) #define MY_LOG_CRITICAL(logcfg_lvl_, ...) MODLOG_ ## logcfg_lvl_(MYNEWT_VAL(MY_LOG_MODULE), __VA_ARGS__) If two or more logs have module values that resolve to the same number, newt aborts the build with an error: Error: Log module conflicts detected: Module=100 Log=MY_LOG Package=sys/coredump Module=100 Log=YOUR_LOG Package=sys/coredump Resolve the problem by assigning unique module IDs to each log, or by setting the "guest" flag of all but one. The "guest" flag, when set, allows a log to use the same module as another without generating an error.
Add two new newt commands: newt target logcfg show <target> newt target logcfg brief <target> Both commands produce a report of all the logs configured for the target. Example output: [SHOW] $ newt target logcfg show slinky-nrf52dk Log config for targets/slinky-nrf52dk: COREDUMP_LOG: Package: sys/coredump Module: 100 [COREDUMP_LOG_MODULE] Level: 3 (ERROR) [COREDUMP_LOG_LEVEL] Flags: SENSORS_LOG: Package: sys/coredump Module: 99 Level: 1 (INFO) [COREDUMP_LOG_LEVEL] Flags: [BRIEF] $ newt target logcfg brief slinky-nrf52dk Brief log config for targets/slinky-nrf52dk: LOG | MODULE | LEVEL | FLAGS -----------------+----------+--------------|---------- COREDUMP_LOG | 100 | 3 (ERROR) | SENSORS_LOG | 99 | 1 (INFO) |
ccollins476ad
force-pushed
the
target-sysinit
branch
from
November 1, 2018 00:56
1cd22d4
to
ed9d8cf
Compare
mkiiskila
approved these changes
Nov 1, 2018
@@ -0,0 +1,46 @@ | |||
package val |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apache license missing.
Prior to this commit, the sysinit and sysdown function lists were created on demand, when the corresponding C code is generated. This commit causes the sysinit and sysdown configurations to be generated at resolution time. This allows: * Better error reporting * CLI commands to access the sysinit / sysdown configuration
This commit adds four newt commands: newt target sysinit show <target> newt target sysinit brief <target> newt target sysdown show <target> newt target sysdown brief <target> Both sysinit commands produce a report of all the sysinit entries configured for the target. Example output: [SHOW] $ newt target sysinit show slinky-nrf52dk Log config for targets/slinky-nrf52dk: <snip> config_pkg_init: Package: @apache-mynewt-core/sys/config Stage: 50 [CONFIG_SYSINIT_1_STAGE] log_init: Package: @apache-mynewt-core/sys/log/full Stage: 100 [LOG_SYSINIT_STAGE] <snip> [BRIEF] $ newt target sysinit brief slinky-nrf52dk Brief sysinit config for targets/slinky-nrf52dk: FUNCTION | PACKAGE | STAGE <snip> config_pkg_init | @apache-mynewt-core/sys/config | 50 [CONFIG_SYSINIT_1_STAGE] log_init | @apache-mynewt-core/sys/log/full | 100 [LOG_SYSINIT_STAGE] <snip> The sysdown commands are similar; they show sysdown entries rather than sysinit entries.
Clean up `target_cmds.go` by moving the following commands to a new file: * target config * target logcfg * target sysinit * target sysdown
ccollins476ad
force-pushed
the
target-sysinit
branch
from
November 1, 2018 18:33
ed9d8cf
to
db826a3
Compare
ccollins476ad
added a commit
to ccollins476ad/mynewt-core
that referenced
this pull request
Nov 7, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
ccollins476ad
added a commit
to ccollins476ad/mynewt-nimble
that referenced
this pull request
Nov 19, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
ccollins476ad
added a commit
to ccollins476ad/mynewt-nimble
that referenced
this pull request
Nov 21, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
ccollins476ad
added a commit
to apache/mynewt-nimble
that referenced
this pull request
Nov 21, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
ccollins476ad
added a commit
to ccollins476ad/mynewt-core
that referenced
this pull request
Nov 28, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
ccollins476ad
added a commit
to ccollins476ad/mynewt-core
that referenced
this pull request
Dec 12, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
ccollins476ad
added a commit
to apache/mynewt-core
that referenced
this pull request
Dec 12, 2018
This allows the app or target to rearrange package initialization order via syscfg overrides. Note: This requires an updated version of newt (apache/mynewt-newt#230). Older versions of newt fail to parse the updated `pkg.yml` files.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: This PR includes #221. That PR should be reviewed before this one.
This PR adds four newt commands:
newt target sysinit show <target>
newt target sysinit brief <target>
newt target sysdown show <target>
newt target sysdown brief <target>
Both sysinit commands produce a report of all the sysinit entries configured for the target. The sysdown commands are similar; they show sysdown entries rather than sysinit entries.
This PR attempts to address two problems:
brief
commands allow this information to be visualized in a condensed table.Example output:
show