Updated system configuration Updated for new system configuration interface
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/05b828ca Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/05b828ca Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/05b828ca Branch: refs/heads/develop Commit: 05b828cac110eae39c492e2d89b3a6dc90f1308b Parents: 31d5631 Author: David G. Simmons <[email protected]> Authored: Fri Oct 28 12:22:29 2016 -0400 Committer: David G. Simmons <[email protected]> Committed: Fri Oct 28 12:22:29 2016 -0400 ---------------------------------------------------------------------- docs/os/get_started/vocabulary.md | 31 +++++++++++++++--- docs/os/tutorials/bleprph/bleprph-app.md | 6 ++-- docs/os/tutorials/bletiny_project.md | 45 ++++++++++++++++++--------- 3 files changed, 59 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/05b828ca/docs/os/get_started/vocabulary.md ---------------------------------------------------------------------- diff --git a/docs/os/get_started/vocabulary.md b/docs/os/get_started/vocabulary.md index f176d6a..729bf2e 100644 --- a/docs/os/get_started/vocabulary.md +++ b/docs/os/get_started/vocabulary.md @@ -140,15 +140,12 @@ Usage: newt target [command] Available Commands: + config View target system configuration copy Copy target create Create a target delete Delete target set Set target configuration variable show View target configuration variables - vars Show variable names - -Flags: - -h, --help help for target Global Flags: -l, --loglevel string Log level (default "WARN") @@ -160,3 +157,29 @@ Global Flags: Use "newt target [command] --help" for more information about a command. $ ``` + +###Configuration + +There are a lot of configuration options available when building your application in MyNewt. System Configuration options are set in +a file called `syscfg.yml` and you will find these configuration files throughout the MyNewt packages. While you can edit these +files directly to change some default settings, it is best to override the default settings in a `syscfg.yml` file in your project +directory rather than editing the package configurations directly. + +To see all **all** the system configuration settings, simply type + +```no-highlight +$ newt target config <target-name> +... +* PACKAGE: sys/stats + * Setting: STATS_CLI + * Description: Expose the "stat" shell command. + * Value: 0 + * Setting: STATS_NAMES + * Description: Include and report the textual name of each statistic. + * Value: 0 + * Setting: STATS_NEWTMGR + * Description: Expose the "stat" newtmgr command. + * Value: 0 +... +$ +``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/05b828ca/docs/os/tutorials/bleprph/bleprph-app.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/bleprph/bleprph-app.md b/docs/os/tutorials/bleprph/bleprph-app.md index a0a51c1..4a8cff3 100644 --- a/docs/os/tutorials/bleprph/bleprph-app.md +++ b/docs/os/tutorials/bleprph/bleprph-app.md @@ -32,15 +32,13 @@ $ newt target set myperiph app=@apache-mynewt-core/apps/bleprph Target targets/myperiph successfully set target.app to @apache-mynewt-core/apps/bleprph $ newt target set myperiph build_profile=optimized Target targets/myperiph successfully set target.build_profile to optimized -$ newt target set myperiph cflags=-DSTATS_NAME_ENABLE -Target targets/myperiph successfully set pkg.cflags to -DSTATS_NAME_ENABLE $ newt build blerph Building target targets/myperiph ... -Linking /Users/dsimmons/dev/nrf52dk/bin/targets/myperiph/app/apps/bleprph/bleprph.elf +Linking ~/dev/nrf52dk/bin/targets/myperiph/app/apps/bleprph/bleprph.elf Target successfully built: targets/myperiph $ newt create-image myperiph 1.0.0 -App image succesfully generated: /Users/dsimmons/dev/nrf52dk/bin/targets/myperiph/app/apps/bleprph/bleprph.img +App image succesfully generated: ~/dev/nrf52dk/bin/targets/myperiph/app/apps/bleprph/bleprph.img $ newt load myperiph Loading app image into slot 1 ``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/05b828ca/docs/os/tutorials/bletiny_project.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/bletiny_project.md b/docs/os/tutorials/bletiny_project.md index 51f4594..083393c 100644 --- a/docs/os/tutorials/bletiny_project.md +++ b/docs/os/tutorials/bletiny_project.md @@ -72,8 +72,6 @@ $ newt target set myble app=@apache-mynewt-core/apps/bletiny Target targets/myble successfully set target.app to @apache-mynewt-core/apps/bletiny $ newt target set myble build_profile=optimized Target targets/myble successfully set target.build_profile to optimized -$ newt target set myble cflags=-DSTATS_NAME_ENABLE -Target targets/myble successfully set pkg.cflags to DSTATS_NAME_ENABLE ``` Use the same `newt target set` command to set the following definition for the bootloader target -- again, make sure you use the correct value for the bsp based on which version of the board you have.. @@ -104,6 +102,21 @@ targets/nrf52_boot build_profile=optimized ``` +Since we're interested in seeing the stats, we'll need to enable the stats module for the target. By default, the stats module is not enabled, so we will have to override the default behavior. +To do this, you'll need to create a configuration file `syscfg.yml` in the app directory. from the target definition above, you can see that the app is in `apache-mynewt-core/apps/bletiny` +so that is where you'll put your configuration file. + +``` +# Package: apps/bletiny + +syscfg.vals: + SHELL_TASK: 1 + STATS_NAMES: 1 + STATS_CLI: 1 +``` + +The first configuration value turns on the Shell Task, and we'll need this to get to the shell. The next 2 enable the names for the various stats, and then turns on the stats CLI option. + ### Build targets Then build the two targets. @@ -194,6 +207,8 @@ prompt set > You'll notice that there is an ever-increasing counter before the prompt (and before any output to the terminal). This is just a counter kept by the MCU. +**Note**: If you want to have a shell prompt by default, simply add the line: `CONSOLE_PROMPT: 1` to your `syscfg.yml` file and it will be turned on by default. + <br> Try the `tasks` command. @@ -213,19 +228,19 @@ Tasks: Try specifying a BLE related stat, for example `ble_ll`. You should see some HCI (Host Controller Interface) command counts. ```hl_lines="1" -stat ble_ll -4986297:hci_cmds: 5 -4986297:hci_cmd_errs: 0 -4986299:hci_events_sent: 5 -4986301:bad_ll_state: 0 -4986303:bad_acl_hdr: 0 -4986306:rx_adv_pdu_crc_ok: 0 -4986308:rx_adv_pdu_crc_err: 0 -4986311:rx_adv_bytes_crc_ok: 0 -4986314:rx_adv_bytes_crc_err: 0 -4986317:rx_data_pdu_crc_ok: 0 -4986319:rx_data_pdu_crc_err: 0 -4986322:rx_data_bytes_crc_ok: 0 +241133: > stat ble_ll +hci_cmds: 11 +241888:hci_cmd_errs: 0 +241888:hci_events_sent: 11 +241890:bad_ll_state: 0 +241890:bad_acl_hdr: 0 +241891:no_bufs: 0 +241891:rx_adv_pdu_crc_ok: 0 +241892:rx_adv_pdu_crc_err: 0 +241893:rx_adv_bytes_crc_ok: 0 +241894:rx_adv_bytes_crc_err: 0 +241895:rx_data_pdu_crc_ok: 0 +241895:rx_data_pdu_crc_err: 0 <snip> ```
