Repository: incubator-mynewt-site Updated Branches: refs/heads/asf-site 6de9da2b5 -> 361462f42
This closes #136. Adds task handler to the blinky console tutorial 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/361462f4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/361462f4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/361462f4 Branch: refs/heads/asf-site Commit: 361462f427789dbdd1f544ece168fe1e4220aecf Parents: 6de9da2 Author: aditihilbert <[email protected]> Authored: Tue Dec 20 17:10:33 2016 -0800 Committer: aditihilbert <[email protected]> Committed: Tue Dec 20 17:10:33 2016 -0800 ---------------------------------------------------------------------- develop/mkdocs/search_index.json | 4 ++-- develop/os/tutorials/blinky_console/index.html | 17 +++++++++++++- develop/sitemap.xml | 24 +++++++++---------- latest/mkdocs/search_index.json | 4 ++-- latest/os/tutorials/blinky_console/index.html | 17 +++++++++++++- latest/sitemap.xml | 24 +++++++++---------- sitemap.xml | 26 ++++++++++----------- v0_9_0/sitemap.xml | 26 ++++++++++----------- 8 files changed, 86 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/361462f4/develop/mkdocs/search_index.json ---------------------------------------------------------------------- diff --git a/develop/mkdocs/search_index.json b/develop/mkdocs/search_index.json index 6121487..a55d558 100644 --- a/develop/mkdocs/search_index.json +++ b/develop/mkdocs/search_index.json @@ -887,7 +887,7 @@ }, { "location": "/os/tutorials/blinky_console/", - "text": "Enabling The Console and Shell for Blinky\n\n\n\n\nThis tutorial explains how to add the Console and Shell task to the blinky app so that you \ncan interact with it over a serial line connection.\n\n\n\n\nPre-Requisites\n\n\n\n\nEnsure you have installed \nnewt\n and that the \nnewt command is in your system path. \n\n\nYou must have Internet connectivity to fetch remote Mynewt components.\n\n\nYou must \ninstall the compiler tools\n to \nsupport native compiling to build the project this tutorial creates. \n\n\nYou must install the \nSegger JLINK package\n to \nload your project on the board.\n\n\nCable to establish a serial USB connection between the board and the laptop\n\n\n\n\n\n\nUse an existing project\n\n\nSince all we're doing is adding the shell and console capability to blinky, we assume \nthat you have worked through at least some of the other tutorials, and have an existing project.\nFor this example, we'll be modifying the \nblinky on nrf52\n proj ect to enable \nthe shell and console connectivity. Feel free to use whatever version of blinky you'd like though.\n\n\n\n\nModify the Dependencies and Configuration\n\n\nThe first thing you'll need to add is a few new dependencies for your app. To add shell support to \nyour app make sure the following \npkg.deps\n are defined in your target's pkg.yml file:\n\n\npkg.deps:\n - \n@apache-mynewt-core/sys/console/full\n\n - \n@apache-mynewt-core/sys/shell\n\n - \n@apache-mynewt-core/sys/sysinit\n\n\n\n\n\n\nThis lets the newt system know that it needs to pull in the code for the console and the shell.\n\n\nNow we'll need to modify the settings for the app to turn on the shell, etc. by modifying the\n\nsyscfg.yml\n file for your target. (Remember, these files are in the targets/\n directory.)\nIf there isn't a \nsyscfg.yml\n file in your target's directory, you will need to create one.\n\n\n# Package: apps/bletiny\n\nsyscfg.vals:\n # Enable the shell task.\n SHELL_TASK: 1 \n # Enable Console OS Ticks\n CONSOLE_TICKS: 1\n # Enable Console Prompt\n CONSOLE_PROMPT: 1 \n\n\n\n\n\nAdd an Event Queue\n\n\nBlinky is a small app that doesn't make use of tasks or an event queue as many other apps do, so\nwe'll have to modify the source for the app in order to add one. \n\n\n/* System event queue task handler */\n\n\n#define SYSEVQ_PRIO (1)\n\n\n#define SYSEVQ_STACK_SIZE OS_STACK_ALIGN(512)\n\n\nstatic\n \nstruct\n \nos_task\n \ntask_sysevq\n;\n\nos_stack_t\n \nsysevq_stack\n[\nSYSEVQ_STACK_SIZE\n];\n\n\n/* Event queue for events handled by the system (shell, etc.) */\n\n\nstatic\n \nstruct\n \nos_eventq\n \nsys_evq\n;\n\n\n\n\n\nWe define a new \nos_task\n a task stack (\nsysevq_stack\n) and new system event queue \n(\nsys_evq\n) so that the shell and console will have an event queue to run in.\n\n\nNext we go down to our \ninit_tasks()\n function and initialize it\n\n\nos_task_init\n(\ntask_sysevq\n, \nsysevq\n, \nsysevq_handler\n, \nNULL\n,\n \nSYSEVQ_PRIO\n, \nOS_WAIT_FOREVER\n, \nsysevq_stack\n, \nSYSEVQ_STACK_SIZE\n);\n\nos_eventq_init\n(\nsys_evq\n);\n\nos_eventq_dflt_set\n(\nsys_evq\n);\n\n\n\n\n\nThis will initialize the task, initialize the event queue, and then set the new event queue as\nthe default event queue. \n\n\nBuild targets\n\n\nWe're not going to build the bootloader here since we are assuming that you have already\nbuilt and loaded it during previous tutorials.\n\n\n$ newt build blinky\nArchiving cbmem.a\nCompiling crc16.c\nCompiling crc8.c\nArchiving crc.a\nCompiling mem.c\nArchiving mem.a\nLinking ~/dev/myproj/bin/targets/blinky/app/apps/blinky/blinky.elf\nTarget successfully built: targets/blinky\n\n\n\n\n\n\n\nCreate the app image\n\n\nGenerate a signed application image for the \nblinky\n target. The version number is arbitrary.\n\n\n$ newt create-image blinky 1.0.0\nApp image succesfully generated: ~/dev/myproj/bin/targets/blinky/app/apps/blinky/blinky.img\n\n\n\n\n\n\n\nLoad the i mage\n\n\nMake 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.\n\n\n$ newt load blinky\n\n\n\n\n\n\n\nSet up Serial connection\n\n\nYou'll need a Serial connection to see the output of your program. You can reference the \nSerial Port Setup\n \nTutorial for more information on setting up your serial communications.\n\n\n\n\nConnecting with your app\n\n\nOnce you have a connection set up, you can connect to your device with \nminicom -D /dev/tty.usbmodem\nport\n -b 115200\n to run connect\nto the console of your app. \n\n\nTo test and make sure that the Shell is running, first just hit \n:\n\n\n3534: \n\n\n\n\n\n\nRemember, we turned the CONSOLE_PROMPT and the CONSOLE_TICKS on earlier. You can try some commands now:\n\n\n3609: \n ?\nCommands:\n8841: echo ? prompt ticks tasks mempools\n8843: date b\n8844: \n ticks off\n Console Ticks off\n \n prompt off \n Prompt now off.\nticks on\n33383: Console Ticks on\n\n33568:\nprompt on\n39108: Prompt now on.\n39108: \n\n\n\n\n\n\nAnd there you have the Console and Shell working in an app that previously had no event queue!", + "text": "Enabling The Console and Shell for Blinky\n\n\n\n\nThis tutorial explains how to add the Console and Shell task to the blinky app so that you \ncan interact with it over a serial line connection.\n\n\n\n\nPre-Requisites\n\n\n\n\nEnsure you have installed \nnewt\n and that the \nnewt command is in your system path. \n\n\nYou must have Internet connectivity to fetch remote Mynewt components.\n\n\nYou must \ninstall the compiler tools\n to \nsupport native compiling to build the project this tutorial creates. \n\n\nYou must install the \nSegger JLINK package\n to \nload your project on the board.\n\n\nCable to establish a serial USB connection between the board and the laptop\n\n\n\n\n\n\nUse an existing project\n\n\nSince all we're doing is adding the shell and console capability to blinky, we assume \nthat you have worked through at least some of the other tutorials, and have an existing project.\nFor this example, we'll be modifying the \nblinky on nrf52\n proj ect to enable \nthe shell and console connectivity. Feel free to use whatever version of blinky you'd like though.\n\n\n\n\nModify the Dependencies and Configuration\n\n\nThe first thing you'll need to add is a few new dependencies for your app. To add shell support to \nyour app make sure the following \npkg.deps\n are defined in your target's pkg.yml file:\n\n\npkg.deps:\n - \n@apache-mynewt-core/sys/console/full\n\n - \n@apache-mynewt-core/sys/shell\n\n - \n@apache-mynewt-core/sys/sysinit\n\n\n\n\n\n\nThis lets the newt system know that it needs to pull in the code for the console and the shell.\n\n\nNow we'll need to modify the settings for the app to turn on the shell, etc. by modifying the\n\nsyscfg.yml\n file for your target. (Remember, these files are in the targets/\n directory.)\nIf there isn't a \nsyscfg.yml\n file in your target's directory, you will need to create one.\n\n\n# Package: apps/bletiny\n\nsyscfg.vals:\n # Enable the shell task.\n SHELL_TASK: 1 \n # Enable Console OS Ticks\n CONSOLE_TICKS: 1\n # Enable Console Prompt\n CONSOLE_PROMPT: 1 \n\n\n\n\n\nAdd an Event Queue\n\n\nBlinky is a small app that doesn't make use of tasks or an event queue as many other apps do, so\nwe'll have to modify the source for the app in order to add one. \n\n\n/* System event queue task handler */\n\n\n#define SYSEVQ_PRIO (1)\n\n\n#define SYSEVQ_STACK_SIZE OS_STACK_ALIGN(512)\n\n\nstatic\n \nstruct\n \nos_task\n \ntask_sysevq\n;\n\nos_stack_t\n \nsysevq_stack\n[\nSYSEVQ_STACK_SIZE\n];\n\n\n/* Event queue for events handled by the system (shell, etc.) */\n\n\nstatic\n \nstruct\n \nos_eventq\n \nsys_evq\n;\n\n\n\n\n\nWe define a new \nos_task\n a task stack (\nsysevq_stack\n) and new system event queue \n(\nsys_evq\n) so that the shell and console will have an event queue to run in.\n\n\nNext we go down to our \ninit_tasks()\n function and initialize it\n\n\nos_task_init\n(\ntask_sysevq\n, \nsysevq\n, \nsysevq_handler\n, \nNULL\n,\n \nSYSEVQ_PRIO\n, \nOS_WAIT_FOREVER\n, \nsysevq_stack\n, \nSYSEVQ_STACK_SIZE\n);\n\nos_eventq_init\n(\nsys_evq\n);\n\nos_eventq_dflt_set\n(\nsys_evq\n);\n\n\n\n\n\nThis will initialize the task, initialize the event queue, and then set the new event queue as\nthe default event queue. \n\n\nFinally, we need to add the task handler for the event queue:\n\n\n/**\n\n\n * This task serves as a container for the shell and newtmgr packages. These\n\n\n * packages enqueue timer events when they need this task to do work.\n\n\n */\n\n\nstatic\n \nvoid\n\n\nsysevq_handler\n(\nvoid\n \n*arg\n)\n{\n \nwhile\n (\n1\n) {\n \nos_eventq_run\n(\nsys_evq\n);\n }\n}\n\n\n\n\n\nBuild targets\n\n\nWe're not going to build the bootloader here since we are assuming that you have already\nbuilt and loaded it during previous tutorials.\n\n\n$ newt build blinky\nArchiving cbmem.a\nCompiling crc16.c\nCompiling crc8.c\nArchiving crc.a\nCompiling mem.c\nArchiving mem.a\nLinking ~/dev/ myproj/bin/targets/blinky/app/apps/blinky/blinky.elf\nTarget successfully built: targets/blinky\n\n\n\n\n\n\n\nCreate the app image\n\n\nGenerate a signed application image for the \nblinky\n target. The version number is arbitrary.\n\n\n$ newt create-image blinky 1.0.0\nApp image succesfully generated: ~/dev/myproj/bin/targets/blinky/app/apps/blinky/blinky.img\n\n\n\n\n\n\n\nLoad the image\n\n\nMake 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.\n\n\n$ newt load blinky\n\n\n\n\n\n\n\nSet up Serial connection\n\n\nYou'll need a Serial connection to see the output of your program. You can reference the \nSerial Port Setup\n \nTutorial for more information on setting up your serial communications.\n\n\n\n\nConnecting with your app\n\n\nOnce you have a connection set up, you can connect to your device with \nminicom -D /dev/tty.usbmodem\nport\n -b 115200\n to run connect\nto the console o f your app. \n\n\nTo test and make sure that the Shell is running, first just hit \n:\n\n\n3534: \n\n\n\n\n\n\nRemember, we turned the CONSOLE_PROMPT and the CONSOLE_TICKS on earlier. You can try some commands now:\n\n\n3609: \n ?\nCommands:\n8841: echo ? prompt ticks tasks mempools\n8843: date b\n8844: \n ticks off\n Console Ticks off\n \n prompt off\n Prompt now off.\nticks on\n33383: Console Ticks on\n\n33568:\nprompt on\n39108: Prompt now on.\n39108: \n\n\n\n\n\n\nAnd there you have the Console and Shell working in an app that previously had no event queue!", "title": "Add Console and Shell to Blinky" }, { @@ -912,7 +912,7 @@ }, { "location": "/os/tutorials/blinky_console/#add-an-event-queue", - "text": "Blinky is a small app that doesn't make use of tasks or an event queue as many other apps do, so\nwe'll have to modify the source for the app in order to add one. /* System event queue task handler */ #define SYSEVQ_PRIO (1) #define SYSEVQ_STACK_SIZE OS_STACK_ALIGN(512) static struct os_task task_sysevq ; os_stack_t sysevq_stack [ SYSEVQ_STACK_SIZE ]; /* Event queue for events handled by the system (shell, etc.) */ static struct os_eventq sys_evq ; We define a new os_task a task stack ( sysevq_stack ) and new system event queue \n( sys_evq ) so that the shell and console will have an event queue to run in. Next we go down to our init_tasks() function and initialize it os_task_init ( task_sysevq , sysevq , sysevq_handler , NULL ,\n SYSEVQ_PRIO , OS_WAIT_FOREVER , sysevq_stack , SYSEVQ_STACK_SIZE ); os_eventq_init ( sys_evq ); os_eventq_dflt_set ( sys_evq ); This will initialize the task, initialize the event queue, and then set the new event queue as\nthe default event queue.", + "text": "Blinky is a small app that doesn't make use of tasks or an event queue as many other apps do, so\nwe'll have to modify the source for the app in order to add one. /* System event queue task handler */ #define SYSEVQ_PRIO (1) #define SYSEVQ_STACK_SIZE OS_STACK_ALIGN(512) static struct os_task task_sysevq ; os_stack_t sysevq_stack [ SYSEVQ_STACK_SIZE ]; /* Event queue for events handled by the system (shell, etc.) */ static struct os_eventq sys_evq ; We define a new os_task a task stack ( sysevq_stack ) and new system event queue \n( sys_evq ) so that the shell and console will have an event queue to run in. Next we go down to our init_tasks() function and initialize it os_task_init ( task_sysevq , sysevq , sysevq_handler , NULL ,\n SYSEVQ_PRIO , OS_WAIT_FOREVER , sysevq_stack , SYSEVQ_STACK_SIZE ); os_eventq_init ( sys_evq ); os_eventq_dflt_set ( sys_evq ); This will initialize the task, initialize the event queue, and then set the new event queue as\nthe default event queue. Finally, we need to add the task handler for the event queue: /** * This task serves as a container for the shell and newtmgr packages. These * packages enqueue timer events when they need this task to do work. */ static void sysevq_handler ( void *arg )\n{\n while ( 1 ) {\n os_eventq_run ( sys_evq );\n }\n}", "title": "Add an Event Queue" }, { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/361462f4/develop/os/tutorials/blinky_console/index.html ---------------------------------------------------------------------- diff --git a/develop/os/tutorials/blinky_console/index.html b/develop/os/tutorials/blinky_console/index.html index 16f0787..1a1308a 100644 --- a/develop/os/tutorials/blinky_console/index.html +++ b/develop/os/tutorials/blinky_console/index.html @@ -591,7 +591,22 @@ we'll have to modify the source for the app in order to add one. </p> <p>This will initialize the task, initialize the event queue, and then set the new event queue as -the default event queue. </p> +the default event queue. </p> +<p>Finally, we need to add the task handler for the event queue:</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #177500">/**</span> +<span style="color: #177500"> * This task serves as a container for the shell and newtmgr packages. These</span> +<span style="color: #177500"> * packages enqueue timer events when they need this task to do work.</span> +<span style="color: #177500"> */</span> +<span style="color: #A90D91">static</span> <span style="color: #A90D91">void</span> +<span style="color: #000000">sysevq_handler</span>(<span style="color: #A90D91">void</span> <span style="color: #000000">*arg</span>) +{ + <span style="color: #A90D91">while</span> (<span style="color: #1C01CE">1</span>) { + <span style="color: #000000">os_eventq_run</span>(<span style="color: #000000">&sys_evq</span>); + } +} +</pre></div> + + <h3 id="build-targets">Build targets</h3> <p>We're not going to build the bootloader here since we are assuming that you have already built and loaded it during previous tutorials.</p> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/361462f4/develop/sitemap.xml ---------------------------------------------------------------------- diff --git a/develop/sitemap.xml b/develop/sitemap.xml index 4940126..fce0a95 100644 --- a/develop/sitemap.xml +++ b/develop/sitemap.xml @@ -4,7 +4,7 @@ <url> <loc>http://mynewt.apache.org/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -13,7 +13,7 @@ <url> <loc>http://mynewt.apache.org/pages/ble/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -22,7 +22,7 @@ <url> <loc>http://mynewt.apache.org/quick-start/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -30,7 +30,7 @@ <url> <loc>http://mynewt.apache.org/about/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -38,7 +38,7 @@ <url> <loc>http://mynewt.apache.org/talks/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -46,7 +46,7 @@ <url> <loc>http://mynewt.apache.org/download/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -54,7 +54,7 @@ <url> <loc>http://mynewt.apache.org/community/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -62,7 +62,7 @@ <url> <loc>http://mynewt.apache.org/events/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -71,7 +71,7 @@ <url> <loc>http://mynewt.apache.org/os/introduction/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -83,7 +83,7 @@ <url> <loc>http://mynewt.apache.org/os/get_started/vocabulary/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -123,13 +123,13 @@ <url> <loc>http://mynewt.apache.org/faq/how_to_edit_docs/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> <url> <loc>http://mynewt.apache.org/faq/answers/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/361462f4/latest/mkdocs/search_index.json ---------------------------------------------------------------------- diff --git a/latest/mkdocs/search_index.json b/latest/mkdocs/search_index.json index 6121487..a55d558 100644 --- a/latest/mkdocs/search_index.json +++ b/latest/mkdocs/search_index.json @@ -887,7 +887,7 @@ }, { "location": "/os/tutorials/blinky_console/", - "text": "Enabling The Console and Shell for Blinky\n\n\n\n\nThis tutorial explains how to add the Console and Shell task to the blinky app so that you \ncan interact with it over a serial line connection.\n\n\n\n\nPre-Requisites\n\n\n\n\nEnsure you have installed \nnewt\n and that the \nnewt command is in your system path. \n\n\nYou must have Internet connectivity to fetch remote Mynewt components.\n\n\nYou must \ninstall the compiler tools\n to \nsupport native compiling to build the project this tutorial creates. \n\n\nYou must install the \nSegger JLINK package\n to \nload your project on the board.\n\n\nCable to establish a serial USB connection between the board and the laptop\n\n\n\n\n\n\nUse an existing project\n\n\nSince all we're doing is adding the shell and console capability to blinky, we assume \nthat you have worked through at least some of the other tutorials, and have an existing project.\nFor this example, we'll be modifying the \nblinky on nrf52\n proj ect to enable \nthe shell and console connectivity. Feel free to use whatever version of blinky you'd like though.\n\n\n\n\nModify the Dependencies and Configuration\n\n\nThe first thing you'll need to add is a few new dependencies for your app. To add shell support to \nyour app make sure the following \npkg.deps\n are defined in your target's pkg.yml file:\n\n\npkg.deps:\n - \n@apache-mynewt-core/sys/console/full\n\n - \n@apache-mynewt-core/sys/shell\n\n - \n@apache-mynewt-core/sys/sysinit\n\n\n\n\n\n\nThis lets the newt system know that it needs to pull in the code for the console and the shell.\n\n\nNow we'll need to modify the settings for the app to turn on the shell, etc. by modifying the\n\nsyscfg.yml\n file for your target. (Remember, these files are in the targets/\n directory.)\nIf there isn't a \nsyscfg.yml\n file in your target's directory, you will need to create one.\n\n\n# Package: apps/bletiny\n\nsyscfg.vals:\n # Enable the shell task.\n SHELL_TASK: 1 \n # Enable Console OS Ticks\n CONSOLE_TICKS: 1\n # Enable Console Prompt\n CONSOLE_PROMPT: 1 \n\n\n\n\n\nAdd an Event Queue\n\n\nBlinky is a small app that doesn't make use of tasks or an event queue as many other apps do, so\nwe'll have to modify the source for the app in order to add one. \n\n\n/* System event queue task handler */\n\n\n#define SYSEVQ_PRIO (1)\n\n\n#define SYSEVQ_STACK_SIZE OS_STACK_ALIGN(512)\n\n\nstatic\n \nstruct\n \nos_task\n \ntask_sysevq\n;\n\nos_stack_t\n \nsysevq_stack\n[\nSYSEVQ_STACK_SIZE\n];\n\n\n/* Event queue for events handled by the system (shell, etc.) */\n\n\nstatic\n \nstruct\n \nos_eventq\n \nsys_evq\n;\n\n\n\n\n\nWe define a new \nos_task\n a task stack (\nsysevq_stack\n) and new system event queue \n(\nsys_evq\n) so that the shell and console will have an event queue to run in.\n\n\nNext we go down to our \ninit_tasks()\n function and initialize it\n\n\nos_task_init\n(\ntask_sysevq\n, \nsysevq\n, \nsysevq_handler\n, \nNULL\n,\n \nSYSEVQ_PRIO\n, \nOS_WAIT_FOREVER\n, \nsysevq_stack\n, \nSYSEVQ_STACK_SIZE\n);\n\nos_eventq_init\n(\nsys_evq\n);\n\nos_eventq_dflt_set\n(\nsys_evq\n);\n\n\n\n\n\nThis will initialize the task, initialize the event queue, and then set the new event queue as\nthe default event queue. \n\n\nBuild targets\n\n\nWe're not going to build the bootloader here since we are assuming that you have already\nbuilt and loaded it during previous tutorials.\n\n\n$ newt build blinky\nArchiving cbmem.a\nCompiling crc16.c\nCompiling crc8.c\nArchiving crc.a\nCompiling mem.c\nArchiving mem.a\nLinking ~/dev/myproj/bin/targets/blinky/app/apps/blinky/blinky.elf\nTarget successfully built: targets/blinky\n\n\n\n\n\n\n\nCreate the app image\n\n\nGenerate a signed application image for the \nblinky\n target. The version number is arbitrary.\n\n\n$ newt create-image blinky 1.0.0\nApp image succesfully generated: ~/dev/myproj/bin/targets/blinky/app/apps/blinky/blinky.img\n\n\n\n\n\n\n\nLoad the i mage\n\n\nMake 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.\n\n\n$ newt load blinky\n\n\n\n\n\n\n\nSet up Serial connection\n\n\nYou'll need a Serial connection to see the output of your program. You can reference the \nSerial Port Setup\n \nTutorial for more information on setting up your serial communications.\n\n\n\n\nConnecting with your app\n\n\nOnce you have a connection set up, you can connect to your device with \nminicom -D /dev/tty.usbmodem\nport\n -b 115200\n to run connect\nto the console of your app. \n\n\nTo test and make sure that the Shell is running, first just hit \n:\n\n\n3534: \n\n\n\n\n\n\nRemember, we turned the CONSOLE_PROMPT and the CONSOLE_TICKS on earlier. You can try some commands now:\n\n\n3609: \n ?\nCommands:\n8841: echo ? prompt ticks tasks mempools\n8843: date b\n8844: \n ticks off\n Console Ticks off\n \n prompt off \n Prompt now off.\nticks on\n33383: Console Ticks on\n\n33568:\nprompt on\n39108: Prompt now on.\n39108: \n\n\n\n\n\n\nAnd there you have the Console and Shell working in an app that previously had no event queue!", + "text": "Enabling The Console and Shell for Blinky\n\n\n\n\nThis tutorial explains how to add the Console and Shell task to the blinky app so that you \ncan interact with it over a serial line connection.\n\n\n\n\nPre-Requisites\n\n\n\n\nEnsure you have installed \nnewt\n and that the \nnewt command is in your system path. \n\n\nYou must have Internet connectivity to fetch remote Mynewt components.\n\n\nYou must \ninstall the compiler tools\n to \nsupport native compiling to build the project this tutorial creates. \n\n\nYou must install the \nSegger JLINK package\n to \nload your project on the board.\n\n\nCable to establish a serial USB connection between the board and the laptop\n\n\n\n\n\n\nUse an existing project\n\n\nSince all we're doing is adding the shell and console capability to blinky, we assume \nthat you have worked through at least some of the other tutorials, and have an existing project.\nFor this example, we'll be modifying the \nblinky on nrf52\n proj ect to enable \nthe shell and console connectivity. Feel free to use whatever version of blinky you'd like though.\n\n\n\n\nModify the Dependencies and Configuration\n\n\nThe first thing you'll need to add is a few new dependencies for your app. To add shell support to \nyour app make sure the following \npkg.deps\n are defined in your target's pkg.yml file:\n\n\npkg.deps:\n - \n@apache-mynewt-core/sys/console/full\n\n - \n@apache-mynewt-core/sys/shell\n\n - \n@apache-mynewt-core/sys/sysinit\n\n\n\n\n\n\nThis lets the newt system know that it needs to pull in the code for the console and the shell.\n\n\nNow we'll need to modify the settings for the app to turn on the shell, etc. by modifying the\n\nsyscfg.yml\n file for your target. (Remember, these files are in the targets/\n directory.)\nIf there isn't a \nsyscfg.yml\n file in your target's directory, you will need to create one.\n\n\n# Package: apps/bletiny\n\nsyscfg.vals:\n # Enable the shell task.\n SHELL_TASK: 1 \n # Enable Console OS Ticks\n CONSOLE_TICKS: 1\n # Enable Console Prompt\n CONSOLE_PROMPT: 1 \n\n\n\n\n\nAdd an Event Queue\n\n\nBlinky is a small app that doesn't make use of tasks or an event queue as many other apps do, so\nwe'll have to modify the source for the app in order to add one. \n\n\n/* System event queue task handler */\n\n\n#define SYSEVQ_PRIO (1)\n\n\n#define SYSEVQ_STACK_SIZE OS_STACK_ALIGN(512)\n\n\nstatic\n \nstruct\n \nos_task\n \ntask_sysevq\n;\n\nos_stack_t\n \nsysevq_stack\n[\nSYSEVQ_STACK_SIZE\n];\n\n\n/* Event queue for events handled by the system (shell, etc.) */\n\n\nstatic\n \nstruct\n \nos_eventq\n \nsys_evq\n;\n\n\n\n\n\nWe define a new \nos_task\n a task stack (\nsysevq_stack\n) and new system event queue \n(\nsys_evq\n) so that the shell and console will have an event queue to run in.\n\n\nNext we go down to our \ninit_tasks()\n function and initialize it\n\n\nos_task_init\n(\ntask_sysevq\n, \nsysevq\n, \nsysevq_handler\n, \nNULL\n,\n \nSYSEVQ_PRIO\n, \nOS_WAIT_FOREVER\n, \nsysevq_stack\n, \nSYSEVQ_STACK_SIZE\n);\n\nos_eventq_init\n(\nsys_evq\n);\n\nos_eventq_dflt_set\n(\nsys_evq\n);\n\n\n\n\n\nThis will initialize the task, initialize the event queue, and then set the new event queue as\nthe default event queue. \n\n\nFinally, we need to add the task handler for the event queue:\n\n\n/**\n\n\n * This task serves as a container for the shell and newtmgr packages. These\n\n\n * packages enqueue timer events when they need this task to do work.\n\n\n */\n\n\nstatic\n \nvoid\n\n\nsysevq_handler\n(\nvoid\n \n*arg\n)\n{\n \nwhile\n (\n1\n) {\n \nos_eventq_run\n(\nsys_evq\n);\n }\n}\n\n\n\n\n\nBuild targets\n\n\nWe're not going to build the bootloader here since we are assuming that you have already\nbuilt and loaded it during previous tutorials.\n\n\n$ newt build blinky\nArchiving cbmem.a\nCompiling crc16.c\nCompiling crc8.c\nArchiving crc.a\nCompiling mem.c\nArchiving mem.a\nLinking ~/dev/ myproj/bin/targets/blinky/app/apps/blinky/blinky.elf\nTarget successfully built: targets/blinky\n\n\n\n\n\n\n\nCreate the app image\n\n\nGenerate a signed application image for the \nblinky\n target. The version number is arbitrary.\n\n\n$ newt create-image blinky 1.0.0\nApp image succesfully generated: ~/dev/myproj/bin/targets/blinky/app/apps/blinky/blinky.img\n\n\n\n\n\n\n\nLoad the image\n\n\nMake 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.\n\n\n$ newt load blinky\n\n\n\n\n\n\n\nSet up Serial connection\n\n\nYou'll need a Serial connection to see the output of your program. You can reference the \nSerial Port Setup\n \nTutorial for more information on setting up your serial communications.\n\n\n\n\nConnecting with your app\n\n\nOnce you have a connection set up, you can connect to your device with \nminicom -D /dev/tty.usbmodem\nport\n -b 115200\n to run connect\nto the console o f your app. \n\n\nTo test and make sure that the Shell is running, first just hit \n:\n\n\n3534: \n\n\n\n\n\n\nRemember, we turned the CONSOLE_PROMPT and the CONSOLE_TICKS on earlier. You can try some commands now:\n\n\n3609: \n ?\nCommands:\n8841: echo ? prompt ticks tasks mempools\n8843: date b\n8844: \n ticks off\n Console Ticks off\n \n prompt off\n Prompt now off.\nticks on\n33383: Console Ticks on\n\n33568:\nprompt on\n39108: Prompt now on.\n39108: \n\n\n\n\n\n\nAnd there you have the Console and Shell working in an app that previously had no event queue!", "title": "Add Console and Shell to Blinky" }, { @@ -912,7 +912,7 @@ }, { "location": "/os/tutorials/blinky_console/#add-an-event-queue", - "text": "Blinky is a small app that doesn't make use of tasks or an event queue as many other apps do, so\nwe'll have to modify the source for the app in order to add one. /* System event queue task handler */ #define SYSEVQ_PRIO (1) #define SYSEVQ_STACK_SIZE OS_STACK_ALIGN(512) static struct os_task task_sysevq ; os_stack_t sysevq_stack [ SYSEVQ_STACK_SIZE ]; /* Event queue for events handled by the system (shell, etc.) */ static struct os_eventq sys_evq ; We define a new os_task a task stack ( sysevq_stack ) and new system event queue \n( sys_evq ) so that the shell and console will have an event queue to run in. Next we go down to our init_tasks() function and initialize it os_task_init ( task_sysevq , sysevq , sysevq_handler , NULL ,\n SYSEVQ_PRIO , OS_WAIT_FOREVER , sysevq_stack , SYSEVQ_STACK_SIZE ); os_eventq_init ( sys_evq ); os_eventq_dflt_set ( sys_evq ); This will initialize the task, initialize the event queue, and then set the new event queue as\nthe default event queue.", + "text": "Blinky is a small app that doesn't make use of tasks or an event queue as many other apps do, so\nwe'll have to modify the source for the app in order to add one. /* System event queue task handler */ #define SYSEVQ_PRIO (1) #define SYSEVQ_STACK_SIZE OS_STACK_ALIGN(512) static struct os_task task_sysevq ; os_stack_t sysevq_stack [ SYSEVQ_STACK_SIZE ]; /* Event queue for events handled by the system (shell, etc.) */ static struct os_eventq sys_evq ; We define a new os_task a task stack ( sysevq_stack ) and new system event queue \n( sys_evq ) so that the shell and console will have an event queue to run in. Next we go down to our init_tasks() function and initialize it os_task_init ( task_sysevq , sysevq , sysevq_handler , NULL ,\n SYSEVQ_PRIO , OS_WAIT_FOREVER , sysevq_stack , SYSEVQ_STACK_SIZE ); os_eventq_init ( sys_evq ); os_eventq_dflt_set ( sys_evq ); This will initialize the task, initialize the event queue, and then set the new event queue as\nthe default event queue. Finally, we need to add the task handler for the event queue: /** * This task serves as a container for the shell and newtmgr packages. These * packages enqueue timer events when they need this task to do work. */ static void sysevq_handler ( void *arg )\n{\n while ( 1 ) {\n os_eventq_run ( sys_evq );\n }\n}", "title": "Add an Event Queue" }, { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/361462f4/latest/os/tutorials/blinky_console/index.html ---------------------------------------------------------------------- diff --git a/latest/os/tutorials/blinky_console/index.html b/latest/os/tutorials/blinky_console/index.html index c3eb1d0..286d5f2 100644 --- a/latest/os/tutorials/blinky_console/index.html +++ b/latest/os/tutorials/blinky_console/index.html @@ -591,7 +591,22 @@ we'll have to modify the source for the app in order to add one. </p> <p>This will initialize the task, initialize the event queue, and then set the new event queue as -the default event queue. </p> +the default event queue. </p> +<p>Finally, we need to add the task handler for the event queue:</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"><span style="color: #177500">/**</span> +<span style="color: #177500"> * This task serves as a container for the shell and newtmgr packages. These</span> +<span style="color: #177500"> * packages enqueue timer events when they need this task to do work.</span> +<span style="color: #177500"> */</span> +<span style="color: #A90D91">static</span> <span style="color: #A90D91">void</span> +<span style="color: #000000">sysevq_handler</span>(<span style="color: #A90D91">void</span> <span style="color: #000000">*arg</span>) +{ + <span style="color: #A90D91">while</span> (<span style="color: #1C01CE">1</span>) { + <span style="color: #000000">os_eventq_run</span>(<span style="color: #000000">&sys_evq</span>); + } +} +</pre></div> + + <h3 id="build-targets">Build targets</h3> <p>We're not going to build the bootloader here since we are assuming that you have already built and loaded it during previous tutorials.</p> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/361462f4/latest/sitemap.xml ---------------------------------------------------------------------- diff --git a/latest/sitemap.xml b/latest/sitemap.xml index 4940126..fce0a95 100644 --- a/latest/sitemap.xml +++ b/latest/sitemap.xml @@ -4,7 +4,7 @@ <url> <loc>http://mynewt.apache.org/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -13,7 +13,7 @@ <url> <loc>http://mynewt.apache.org/pages/ble/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -22,7 +22,7 @@ <url> <loc>http://mynewt.apache.org/quick-start/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -30,7 +30,7 @@ <url> <loc>http://mynewt.apache.org/about/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -38,7 +38,7 @@ <url> <loc>http://mynewt.apache.org/talks/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -46,7 +46,7 @@ <url> <loc>http://mynewt.apache.org/download/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -54,7 +54,7 @@ <url> <loc>http://mynewt.apache.org/community/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -62,7 +62,7 @@ <url> <loc>http://mynewt.apache.org/events/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -71,7 +71,7 @@ <url> <loc>http://mynewt.apache.org/os/introduction/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -83,7 +83,7 @@ <url> <loc>http://mynewt.apache.org/os/get_started/vocabulary/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -123,13 +123,13 @@ <url> <loc>http://mynewt.apache.org/faq/how_to_edit_docs/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> <url> <loc>http://mynewt.apache.org/faq/answers/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/361462f4/sitemap.xml ---------------------------------------------------------------------- diff --git a/sitemap.xml b/sitemap.xml index 7708e06..067d90b 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,7 +4,7 @@ <url> <loc>http://mynewt.apache.org/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -13,13 +13,13 @@ <url> <loc>http://mynewt.apache.org/pages/ble/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> <url> <loc>http://mynewt.apache.org/pages/securitybullets/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -28,7 +28,7 @@ <url> <loc>http://mynewt.apache.org/quick-start/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -36,7 +36,7 @@ <url> <loc>http://mynewt.apache.org/about/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -44,7 +44,7 @@ <url> <loc>http://mynewt.apache.org/talks/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -52,7 +52,7 @@ <url> <loc>http://mynewt.apache.org/download/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -60,7 +60,7 @@ <url> <loc>http://mynewt.apache.org/community/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -68,7 +68,7 @@ <url> <loc>http://mynewt.apache.org/events/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -77,7 +77,7 @@ <url> <loc>http://mynewt.apache.org/os/introduction/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -89,7 +89,7 @@ <url> <loc>http://mynewt.apache.org/os/get_started/vocabulary/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -129,13 +129,13 @@ <url> <loc>http://mynewt.apache.org/faq/how_to_edit_docs/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> <url> <loc>http://mynewt.apache.org/faq/answers/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/361462f4/v0_9_0/sitemap.xml ---------------------------------------------------------------------- diff --git a/v0_9_0/sitemap.xml b/v0_9_0/sitemap.xml index 7708e06..067d90b 100644 --- a/v0_9_0/sitemap.xml +++ b/v0_9_0/sitemap.xml @@ -4,7 +4,7 @@ <url> <loc>http://mynewt.apache.org/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -13,13 +13,13 @@ <url> <loc>http://mynewt.apache.org/pages/ble/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> <url> <loc>http://mynewt.apache.org/pages/securitybullets/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -28,7 +28,7 @@ <url> <loc>http://mynewt.apache.org/quick-start/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -36,7 +36,7 @@ <url> <loc>http://mynewt.apache.org/about/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -44,7 +44,7 @@ <url> <loc>http://mynewt.apache.org/talks/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -52,7 +52,7 @@ <url> <loc>http://mynewt.apache.org/download/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -60,7 +60,7 @@ <url> <loc>http://mynewt.apache.org/community/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -68,7 +68,7 @@ <url> <loc>http://mynewt.apache.org/events/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -77,7 +77,7 @@ <url> <loc>http://mynewt.apache.org/os/introduction/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -89,7 +89,7 @@ <url> <loc>http://mynewt.apache.org/os/get_started/vocabulary/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> @@ -129,13 +129,13 @@ <url> <loc>http://mynewt.apache.org/faq/how_to_edit_docs/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url> <url> <loc>http://mynewt.apache.org/faq/answers/</loc> - <lastmod>2016-12-19</lastmod> + <lastmod>2016-12-20</lastmod> <changefreq>daily</changefreq> </url>
