Repository: incubator-mynewt-site Updated Branches: refs/heads/develop 51ea3d02f -> b32eed530
1) Updated Check stats on a BLE device tutorial - Removed versions and updated paths. - Rename BLE Device to NRF52 Board - Added build step for myble target - Used new b scan parameters 2) Add load bootloader section to BLE HCI Tutorial 3) Use "main" task instead of "default" task in Add Console and Shell to Blinky tutorial. 4) Remove what the cputime module might be used for 5) Updated Console doc: - Added description for minimal package - Added newline parameter to console_read function 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/7dcb0dcd Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/7dcb0dcd Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/7dcb0dcd Branch: refs/heads/develop Commit: 7dcb0dcd8b784a3dd20bae4ea7aec9d26d7d45b9 Parents: 51ea3d0 Author: cwanda <wa...@happycity.com> Authored: Fri Mar 31 11:35:19 2017 -0700 Committer: cwanda <wa...@happycity.com> Committed: Fri Mar 31 12:45:22 2017 -0700 ---------------------------------------------------------------------- docs/os/core_os/cputime/os_cputime.md | 2 +- docs/os/modules/console/console.md | 58 ++++++-- docs/os/modules/console/console_read.md | 7 +- docs/os/tutorials/blehci_project.md | 41 +++-- docs/os/tutorials/bletiny_project.md | 215 +++++++++++++++------------ docs/os/tutorials/blinky_console.md | 6 +- 6 files changed, 202 insertions(+), 127 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7dcb0dcd/docs/os/core_os/cputime/os_cputime.md ---------------------------------------------------------------------- diff --git a/docs/os/core_os/cputime/os_cputime.md b/docs/os/core_os/cputime/os_cputime.md index 1a6ce06..f724473 100644 --- a/docs/os/core_os/cputime/os_cputime.md +++ b/docs/os/core_os/cputime/os_cputime.md @@ -1,6 +1,6 @@ # CPU Time -The MyNewt `cputime` module provides high resolution time and timer support. This module is intended for use by BSPs, drivers, and network controllers. +The MyNewt `cputime` module provides high resolution time and timer support. ## Description http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7dcb0dcd/docs/os/modules/console/console.md ---------------------------------------------------------------------- diff --git a/docs/os/modules/console/console.md b/docs/os/modules/console/console.md index 43483b8..2463a57 100644 --- a/docs/os/modules/console/console.md +++ b/docs/os/modules/console/console.md @@ -10,15 +10,13 @@ Support is currently available for console access via the serial port on the har ###Description -In the Mynewt OS, the console library comes in two versions: +In the Mynewt OS, the console library comes in three versions: * The `sys/console/full` package implements the complete console functionality and API. - * The `sys/console/stub` package implements stubs for the API. +* The `sys/console/minimal` package implements minimal console functionality of reading from and writing to console. It implements the `console_read()` and `console_write()` functions and stubs for all the other console functions. -Both packages export the `console` API, and any package that uses -the console API must list `console` as a requirement. For example, the shell package defines the following `pkg.yml` -file: +All the packages export the `console` API, and any package that uses the console API must list `console` as a requirement its `pkg.yml` file: ```no-highlight @@ -32,10 +30,12 @@ pkg.req_apis: - console ``` +<br> +The project `pkg.yml` file also specifies the version of the console package to use. -The project `pkg.yml` file specifies the version of the console package to use. -A project that requires the full console capability must list the `sys/console/full` package as a dependency -in its `pkg.yml` file. +<br> +####Using the Full Console Package +A project that requires the full console capability must list the `sys/console/full` package as a dependency in its `pkg.yml` file. An example is the `slinky` application. It requires the full console capability and has the following `pkg.yml` file: @@ -54,15 +54,21 @@ pkg.deps: ... - sys/id ``` +<br> +####Using the Stub Console Package + +A project that uses console stub API must list the `sys/console/stub` package as a dependency in its `pkg.yml` file. -On the other hand, a project may not have a physical console (e.g. a UART port to connect a terminal to) -but may have a dependency on a package that has console capability. In this case, you use -the console stub API and list the `sys/console/stub` package as a dependency in its `pkg.yml` file. +Examples of when a project would use the console stubs might be: -An example is the bootloader project where we want to keep the size of the image small. It includes +* A project may not have a physical console (e.g. a UART port to connect a terminal to) +but may have a dependency on a package that has console capability. +* A bootloader project where we want to keep the size of the image small. It includes the `kernel/os` package that can print out messages on a console (e.g. if there is a hard fault). However, we do not want to use any console I/O capability in this particular bootloader project to -keep the size small. The project uses the console stub API and has the following `pkg.yml` file: +keep the size small. + +The project would use the console stub API and has the following `pkg.yml` file: ```no-highlight pkg.name: apps/boot @@ -72,7 +78,33 @@ pkg.deps: - sys/console/stub ``` +<br> + +####Using the Minimal Console Package + +There might be projects that need to read and write data on a serial connection but do not need the full console capability. An example might be a project that supports serial image upgrade but does not need full newtmgr capability. The project would use the console minimal API and has the following `pkg.yml` file: + +```no-highlight +pkg.name: apps/boot +pkg.type: app +pkg.description: Boot loader application. +pkg.author: "Apache Mynewt <d...@mynewt.incubator.apache.org>" +pkg.homepage: "http://mynewt.apache.org/" +pkg.keywords: + - loader + +pkg.deps: + - boot/bootutil + - kernel/os + - sys/console/stub + +pkg.deps.BOOT_SERIAL.OVERWRITE: + - sys/console/minimal + - boot/boot_serial + +``` +<br> Console has 2 modes for transmit; *blocking mode* and *non-blocking mode*. Usually the *non-blocking mode* is the active one; the output buffer is drained by getting TX completion interrupts from hardware, and more data is added based on these interrupts. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7dcb0dcd/docs/os/modules/console/console_read.md ---------------------------------------------------------------------- diff --git a/docs/os/modules/console/console_read.md b/docs/os/modules/console/console_read.md index 8ddc3d8..2f48ec8 100644 --- a/docs/os/modules/console/console_read.md +++ b/docs/os/modules/console/console_read.md @@ -1,7 +1,7 @@ ## <font color="#F2853F" style="font-size:24pt"> console_read </font> ```c -int console_read(char *str, int cnt) +int console_read(char *str, int cnt, int *newline) ``` Copies up to `cnt` bytes of received data to buffer pointed by `str`. Function tries to break the input into @@ -13,6 +13,8 @@ separate lines; once it encounters a newline character, it replaces that with en |-----------|-------------| | `str` | Buffer where data is copied to. | | `cnt` | Maximum number of characters to copy. | +| `newline` | Pointer to an integer variable that is set to 1 when an newline character is received and set to 0 otherwise. + #### Returned values @@ -29,12 +31,13 @@ task1_loop(void *arg) struct os_event *ev; char rx_msg[128]; int rx_len; + int newline; while (1) { ev = os_eventq_get(&task1_evq); assert(ev); if (ev->ev_type == CONS_EV_TYPE) { - rx_len = console_read(rx_msg, sizeof(rx_msg)); + rx_len = console_read(rx_msg, sizeof(rx_msg), &newline); if (rx_len) { if (!strncmp(rx_msg, "reset", rx_len)) { assert(0); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7dcb0dcd/docs/os/tutorials/blehci_project.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/blehci_project.md b/docs/os/tutorials/blehci_project.md index a8ad341..1824902 100644 --- a/docs/os/tutorials/blehci_project.md +++ b/docs/os/tutorials/blehci_project.md @@ -23,7 +23,7 @@ support native compiling to build the project this tutorial creates. ### Create a project -Use the Newt tool to create a new project directory containing a skeletal Mynewt framework. Change into the newly created directory. Make sure the downloaded version is 0.9.0 or later. +Use the Newt tool to create a new project directory containing a skeletal Mynewt framework. Change into the newly created directory. ``` $ newt new blehciproj @@ -32,11 +32,8 @@ Installing skeleton in blehciproj ... Project blehciproj successfully created. $ cd mblehciproj -$ newt install -v +$ newt install apache-mynewt-core -Downloading repository description for apache-mynewt-core... success! -... -apache-mynewt-core successfully installed version 0.9.0-none ``` <br> @@ -85,38 +82,50 @@ $ newt target show Then build the two targets. -``` +```no-highlight $ newt build nrf52_boot <snip> -App successfully built: ./bin/nrf52_boot/apps/boot/boot.elf +Linking ~/dev/blehciproj/bin/targets/nrf52_boot/app/apps/boot/boot.elf +Target successfully built: targets/nrf52_boot + $ newt build myble2 -Compiling hci_common.c -Compiling util.c -Archiving nimble.a -Compiling os.c <snip> +Linking ~/dev/blehciproj/bin/targets/myble2/app/apps/blehci/blehci.elf +Target successfully built: targets/myble2 +$ ``` + <br> ### Create the app image Generate a signed application image for the `myble2` target. The version number is arbitrary. -``` +```no-highlight $ newt create-image myble2 1.0.0 -App image succesfully generated: ./bin/makerbeacon/apps/bletiny/bletiny.img -Build manifest: ./bin/makerbeacon/apps/bletiny/manifest.json +App image succesfully generated: ~/dev/blehciproj/bin/targets/myble2/app/apps/bletiny/bletiny.img ``` <br> -### Load the image +### Load the bootloader and the application image Make sure the USB connector is in place and the power LED on the board is lit. Use the Power ON/OFF switch to reset the board after loading the image. +Load the bootloader: + +```no-highlight +$ newt load nrf52_boot +Loading bootloader +$ ``` -$ newt -v load myble +<br> +Load the application image: +```no-highlight +$ newt load myble2 +Loading app image into slot 1 +$ ``` <br> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7dcb0dcd/docs/os/tutorials/bletiny_project.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/bletiny_project.md b/docs/os/tutorials/bletiny_project.md index dd94791..b169d31 100644 --- a/docs/os/tutorials/bletiny_project.md +++ b/docs/os/tutorials/bletiny_project.md @@ -1,4 +1,4 @@ -## Check stats on a BLE device +## Check stats for a BLE Application the NRF52 Board <br> @@ -6,7 +6,7 @@ This tutorial explains how to run an example BLE app on a board and command it t <br> -### Pre-Requisites +### Prerequisites * Ensure you have installed [newt](../../newt/install/newt_mac.md) and that the newt command is in your system path. @@ -23,18 +23,14 @@ support native compiling to build the project this tutorial creates. Use the Newt tool to create a new project directory containing a skeletal Mynewt framework. Change into the newly created directory. -``` -$ newt new myapp1 +```no-highlight +$ newt new myproj Downloading project skeleton from apache/incubator-mynewt-blinky... -Installing skeleton in myapp1... -Project myapp1 successfully created. -$ cd myapp1 - -$ newt install -v -apache-mynewt-core -Downloading repository description for apache-mynewt-core... success! -... -apache-mynewt-core successfully installed version 0.7.9-none +Installing skeleton in myproj... +Project myproj successfully created. +$ cd myproj + +$ newt install ``` <br> @@ -43,7 +39,7 @@ apache-mynewt-core successfully installed version 0.7.9-none You will create two targets - one for the bootloader, the other for the application. -``` +```no-highlight $ newt target create myble Target targets/myble successfully created $ newt target create nrf52_boot @@ -65,7 +61,7 @@ Define the targets further. Note that you are using the example app `bletiny` fo <br> -``` +```no-highlight $ newt target set myble bsp=@apache-mynewt-core/hw/bsp/nrf52dk Target targets/myble successfully set target.bsp to @apache-mynewt-core/hw/bsp/nrf52dk $ newt target set myble app=@apache-mynewt-core/apps/bletiny @@ -76,7 +72,7 @@ Target targets/myble successfully set target.build_profile to optimized 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.. -``` +```no-highlight targets/nrf52_boot app=@apache-mynewt-core/apps/boot bsp=@apache-mynewt-core/hw/bsp/nrf52dk @@ -85,7 +81,7 @@ targets/nrf52_boot You should have the following targets by the end of this step. -``` +```no-highlight $ newt target show targets/my_blinky_sim app=apps/blinky @@ -95,7 +91,6 @@ targets/myble app=@apache-mynewt-core/apps/bletiny bsp=@apache-mynewt-core/hw/bsp/nrf52dk build_profile=optimized - cflags=-DSTATS_NAME_ENABLE targets/nrf52_boot app=@apache-mynewt-core/apps/boot bsp=@apache-mynewt-core/hw/bsp/nrf52dk @@ -106,7 +101,7 @@ Since we're interested in seeing the stats, we'll need to enable the stats modul 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. -``` +```no-highlight # Package: apps/bletiny syscfg.vals: @@ -121,28 +116,52 @@ The first configuration value turns on the Shell Task, and we'll need this to ge Then build the two targets. +Run the `newt build nrf52_boot` command to build the bootloader: + +```no-highlight +Building target targets/nrf52_boot +Compiling repos/apache-mynewt-core/boot/bootutil/src/image_ec.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/image_ec256.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/image_rsa.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/bootutil_misc.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/loader.c +Compiling repos/apache-mynewt-core/apps/boot/src/boot.c + +Archiving sys_sysinit.a +Archiving util_mem.a +Linking ~/myproj/bin/targets/nrf52_boot/app/apps/boot/boot.elf +Target successfully built: targets/nrf52_boot ``` -$ newt build nrf52_boot -<snip> -App successfully built: ./bin/nrf52_boot/apps/boot/boot.elf -$ newt build myble -Compiling hci_common.c -Compiling util.c -Archiving nimble.a -Compiling os.c -<snip> -``` - <br> +Run the `newt build myble` command to build the bletiny application: +```no-highlight + newt build myble +Building target targets/myble +Compiling repos/apache-mynewt-core/encoding/base64/src/base64.c +Compiling repos/apache-mynewt-core/encoding/base64/src/hex.c +Compiling repos/apache-mynewt-core/hw/bsp/nrf52dk/src/hal_bsp.c +Compiling repos/apache-mynewt-core/apps/bletiny/src/parse.c +Compiling repos/apache-mynewt-core/apps/bletiny/src/misc.c +Compiling repos/apache-mynewt-core/apps/bletiny/src/gatt_svr.c +Compiling repos/apache-mynewt-core/apps/bletiny/src/cmd.c +Compiling repos/apache-mynewt-core/apps/bletiny/src/main.c + +Archiving util_mem.a +Linking ~/dev/myproj/bin/targets/myble/app/apps/bletiny/bletiny.elf +Target successfully built: targets/myble +``` +<br> ### Create the app image -Generate a signed application image for the `myble` target. The version number is arbitrary. +Run the `newt create-image myble 1.0.0` command to generate a signed application image for the `myble` target. The version number is arbitrary. -``` -$ newt create-image myble 1.0.0 -App image succesfully generated: ./bin/makerbeacon/apps/bletiny/bletiny.img -Build manifest: ./bin/makerbeacon/apps/bletiny/manifest.json +```no-highlight +$newt create-image myble 1.0.0 +Compiling bin/targets/myble/generated/src/myble-sysinit-app.c +Archiving myble-sysinit-app.a +Linking ~/dev/myproj/bin/targets/myble/app/apps/bletiny/bletiny.elf +App image succesfully generated: ~/dev/myproj/bin/targets/myble/app/apps/bletiny/bletiny.img ``` <br> @@ -170,7 +189,7 @@ You may use any terminal emulation program to communicate with the board. This t ``` -$ minicom -D /dev/tty.usbserial-AJ03HAQQ -b 115200 +$ minicom -D /dev/tty.usbserial-1a12 -b 115200 ``` <br> @@ -181,15 +200,15 @@ When the Minicom screen comes up, type in `?` Welcome to minicom 2.7 OPTIONS: -Compiled on Nov 24 2015, 16:14:21. -Port /dev/tty.usbserial-AJ03HAQQ, 09:57:17 +Compiled on Mar 18 2016, 04:59:47. +Port /dev/tty.usbserial-1a12, 21:24:09 Press Meta-Z for help on special keys ? -4754:Commands: -4754: echo ? prompt tasks mempools date -4756: b +7471:Commands: +7471: stat echo ? prompt ticks tasks +7474: mempools date b ``` <br> @@ -214,13 +233,13 @@ This is just a counter kept by the MCU. Try the `tasks` command. ```hl_lines="1" -27365: > tasks -Tasks: -28330: idle (prio: 255, tid: 0, lcheck: 0, ncheck: 0, flags: 0x0, ssize: 64, susage: 34, cswcnt: 233, tot_run_time: 28330ms) -28333: ble_ll (prio: 0, tid: 1, lcheck: 0, ncheck: 0, flags: 0x0, ssize: 80, susage: 60, cswcnt: 11, tot_run_time: 0ms) -28336: shell (prio: 1, tid: 2, lcheck: 0, ncheck: 0, flags: 0x0, ssize: 512, susage: 115, cswcnt: 18, tot_run_time: 0ms) -28339: bletiny (prio: 1, tid: 3, lcheck: 0, ncheck: 0, flags: 0x0, ssize: 512, susage: 138, cswcnt: 456, tot_run_time: 0ms) -28342: > +> tasks +Tasks: +46682: task pri tid runtime csw stksz stkuse lcheck ncheck fg +46684: idle 255 0 46683 99 64 31 0 0 0 +46686: main 127 1 1 29 512 156 0 0 0 +46688: ble_ll 0 2 0 12 80 58 0 0 0 +46691: > ``` <br> @@ -228,40 +247,44 @@ Tasks: Try specifying a BLE related stat, for example `ble_ll`. You should see some HCI (Host Controller Interface) command counts. ```hl_lines="1" -241133: > stat ble_ll +113136: > 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> +155545:hci_cmd_errs: 0 +155545:hci_events_sent: 11 +155547:bad_ll_state: 0 +155547:bad_acl_hdr: 0 +155548:no_bufs: 0 +155548:rx_adv_pdu_crc_ok: 0 +155549:rx_adv_pdu_crc_err: 0 +155550:rx_adv_bytes_crc_ok: 0 +155551:rx_adv_bytes_crc_err: 0 +155552:rx_data_pdu_crc_ok: 0 + + ... + +155564:scan_req_txf: 0 +155565:scan_req_txg: 0 +155565:scan_rsp_txg: 0 +155566: > ``` <br> -For a more exciting output, try scanning your surroundings for BLE adverstisements. The HCI command shown below specifies a scan duration in ms, sets discovery mode to general (as opposed to limited), the filter to no-whitelist, and type of scan to passive. You should see some scan data flying by! +For a more exciting output, try scanning your surroundings for BLE advertisements. The HCI command shown below specifies a scan duration in ms, scan to passive, and no duplicates. You should see some scan data flying by! + ```hl_lines="1" -139088: > b scan dur=10000 disc=gen filt=no_wl type=passive -... -146055:received advertisement; event_type=0 addr_type=1 addr=6b:aa:49:b7:46:e6 length_data=24 rssi=-42 data=0x02:0x01:0x1a:0x14:0xff:0x4c:0x00:0x01:0x00:0x00:0x00:0x00:0x04:0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00 fields: -146061: flags=0x1a -146062: mfg_data=0x4c:0x00:0x01:0x00:0x00:0x00:0x00:0x04:0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00:0x00 -146065: -146065:received advertisement; event_type=0 addr_type=0 addr=ac:bc:32:ac:4f:e4 length_data=11 rssi=-36 data=0x02:0x01:0x06:0x07:0xff:0x4c:0x00:0x10:0x02:0x0b:0x00 fields: -146069: flags=0x06 -146070: mfg_data=0x4c:0x00:0x10:0x02:0x0b:0x00 -146071: -146072:scanning finished -... -<snip> +b scan dur=10000 passive=1 nodups=1 +37266:[ts=291140616ssb, mod=4 level=1] GAP procedure initiated: discovery; own_as + +37641: +38256:received advertisement; event_type=0 rssi=-48 addr_type=1 addr=59:cc:3d:a3: +38261: flags=0x1a: +38261: General discoverable mode +38262: uuids16(complete)=0x1802 +38263: name(complete)=Find Me +38264: +38551:scanning finished ``` <br> @@ -271,42 +294,50 @@ If you're still not seeing any output from the device, try running the debugger <br> ``` -$ newt debug myble -Debugging ./bin/myble/apps/bletiny/bletiny.elf -GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140731-cvs -Copyright (C) 2013 Free Software Foundation, Inc. - +$newt debug myble +[~/dev/myproj/repos/apache-mynewt-core/hw/bsp/nrf52dk/nrf52dk_debug.sh ~/dev/myproj/repos/apache-mynewt-core/hw/bsp/nrf52dk ~/dev/wanda/dev/myproj/bin/targets/myble/app/apps/bletiny/bletiny] +~/dev/myproj/repos/apache-mynewt-core/hw/scripts/common.sh: line 38: [: =: unary operator expected +Debugging ~/dev/myproj/bin/targets/myble/app/apps/bletiny/bletiny.elf +GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs +Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi". +Type "show configuration" for configuration details. For bug reporting instructions, please see: -<http://www.gnu.org/software/gdb/bugs/>... -Reading symbols from ./bin/myble/apps/bletiny/bletiny.elf...done. -0x00002f08 in ?? () +<http://www.gnu.org/software/gdb/bugs/>. +Find the GDB manual and other documentation resources online at: +<http://www.gnu.org/software/gdb/documentation/>. +For help, type "help". +Type "apropos word" to search for commands related to "word"... +Reading symbols from ~/dev/myproj/bin/targets/myble/app/apps/bletiny/bletiny.elf...done. +os_tick_idle (ticks=1920) + at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_os_tick.c:200 +200 if (ticks > 0) { (gdb) monitor reset Resetting target (gdb) c Continuing. ^C Program received signal SIGTRAP, Trace/breakpoint trap. -os_tick_idle (ticks=1000) at hal_os_tick.c:117 -117 if (ticks > 0) { +os_tick_idle (ticks=1907) + at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_os_tick.c:200 +200 if (ticks > 0) { (gdb) p g_os_time -$1 = 37991 +$1 = 13 (gdb) c Continuing. ^C Program received signal SIGTRAP, Trace/breakpoint trap. -os_tick_idle (ticks=1000) at hal_os_tick.c:117 -117 if (ticks > 0) { +os_tick_idle (ticks=1920) + at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/hal_os_tick.c:200 +200 if (ticks > 0) { (gdb) p g_os_time -$2 = 51888 -(gdb) c -Continuing. +$2 = 6611 +(gdb) ``` - <br> You should see the g_os_time advancing as above, as each os time tick is 1ms. If the system ticks aren't advancing, then nothing's actually running. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/7dcb0dcd/docs/os/tutorials/blinky_console.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/blinky_console.md b/docs/os/tutorials/blinky_console.md index 81c9afe..6e77963 100644 --- a/docs/os/tutorials/blinky_console.md +++ b/docs/os/tutorials/blinky_console.md @@ -49,14 +49,14 @@ syscfg.vals: <br> ### Use the OS Default Event Queue to Process Blinky Timer and Shell Events -Mynewt creates a default task that executes the application `main()` function. It also creates an OS default event queue that packages can use to queue their events. Shell uses the OS default event queue for Shell events, and `main()` can process the events in the context of the default task. +Mynewt creates a main task that executes the application `main()` function. It also creates an OS default event queue that packages can use to queue their events. Shell uses the OS default event queue for Shell events, and `main()` can process the events in the context of the main task. Blinky's main.c is very simple. It only has a `main()` function that executes an infinite loop to toggle the LED and sleep for one second. We will modify blinky: * To use os_callout to generate a timer event every one second instead of sleeping. The timer events are added to the OS default event queue. * To process events from the OS default event queue inside the infinite loop in `main()`. -This allows the default task to process both Shell events and the timer events to toggle the LED from the OS default event queue. +This allows the main task to process both Shell events and the timer events to toggle the LED from the OS default event queue. <br> ### Modify main.c @@ -170,7 +170,7 @@ Tutorial for more information on setting up your serial communication. ###Communicate with the Application -Once you have a connection set up, run ```minicom -D /dev/tty.usbmodem<port> -b 115200``` to connect to the application console. +Once you have a connection set up, run ```minicom -D /dev/tty.usbserial<port> -b 115200``` to connect to the application console. To test and make sure that the Shell is running, first just hit <return>: