You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2016/11/28 21:19:20 UTC
[10/10] incubator-mynewt-site git commit: This closes #127. edits in
bletiny_project.md and tasks
This closes #127. edits in bletiny_project.md and tasks
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/3fdca23f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/3fdca23f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/3fdca23f
Branch: refs/heads/master
Commit: 3fdca23f33549196d0f896834a76254e067dfbbd
Parents: 054e387
Author: aditihilbert <ad...@runtime.io>
Authored: Mon Nov 28 11:57:13 2016 -0800
Committer: aditihilbert <ad...@runtime.io>
Committed: Mon Nov 28 12:08:17 2016 -0800
----------------------------------------------------------------------
docs/os/tutorials/bletiny_project.md | 8 +++----
docs/os/tutorials/tasks_lesson.md | 35 ++++++++++++++++++-------------
mkdocs.yml | 14 ++++---------
3 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/3fdca23f/docs/os/tutorials/bletiny_project.md
----------------------------------------------------------------------
diff --git a/docs/os/tutorials/bletiny_project.md b/docs/os/tutorials/bletiny_project.md
index 5a49339..495a8b3 100644
--- a/docs/os/tutorials/bletiny_project.md
+++ b/docs/os/tutorials/bletiny_project.md
@@ -143,13 +143,13 @@ $ newt load myble
### Establish serial connection
-You will now look for some BLE related stats over a serial connection and see the radio is actually working.
-If you haven't done so already, make sure you're familiar with the [Serial Port Setup and Configuration](../get_started/serial_access.md)
-section.
+You will now look for some BLE related stats over a serial connection and see the radio is actually working. The picture below shows a serial connector set up. Pin PA.08 is RX and pin PA.06 is TX. Make sure TX from the NRF52 goes to RX on your Serial board, and that RX on the NRF52 goes to TX on your Serial Board.
+
+
<br>
-You may use any terminal emulation program to communicate with the board. This tutorial shows a Minicom set up.
+You may use any terminal emulation program to communicate with the board. This tutorial shows a Minicom set up. You will have to find out what the usbserial port number is on your laptop, of course.
```
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/3fdca23f/docs/os/tutorials/tasks_lesson.md
----------------------------------------------------------------------
diff --git a/docs/os/tutorials/tasks_lesson.md b/docs/os/tutorials/tasks_lesson.md
index 39ff6ab..b3a21de 100644
--- a/docs/os/tutorials/tasks_lesson.md
+++ b/docs/os/tutorials/tasks_lesson.md
@@ -35,7 +35,7 @@ in main.c (located in apps/blinky/src):
struct os_task work_task;
```
-A task is represented by the [*os_task*](http://mynewt.apache.org/os/core_os/task/task/#data-structures)
+A task is represented by the [*os_task*](http://mynewt.apache.org/os/core_os/task/task/#data-structures)
struct which will hold the task\u2019s information (name, state, priority, etc.). A task is made up of two
main elements, a task function (also known as a task handler) and a task stack.
@@ -50,6 +50,7 @@ which are generally 32 bits, making our entire stack 1024 Bytes.
```c
#define WORK_STACK_SIZE OS_STACK_ALIGN(256)
+ os_stack_t work_stack[WORK_STACK_SIZE];
```
@@ -96,17 +97,13 @@ Let\u2019s set the priority of `work_task` to 0, because everyone knows that work i
### Initialization
To initialize a new task we use [*os_task_init()*](http://mynewt.apache.org/os/core_os/task/os_task_init/)
which takes a number of arguments including our new task function, stack, and priority. Much like `blinky_task`,
-we\u2019re going to initialize `work_task` inside `init_tasks` to keep our main function clean. We'll set the task stack here and pass it to the `os_task_init()` function as well.
+we\u2019re going to initialize `work_task` inside `init_tasks` to keep our main function clean.
```c
int
init_tasks(void)
{
/* \u2026 */
- os_stack_t *work_stack;
- work_stack = malloc(sizeof(os_stack_t)*WORK_STACK_SIZE);
-
- assert(pstack);
os_task_init(&work_task, "work", work_task_handler, NULL,
WORK_TASK_PRIO, OS_WAIT_FOREVER, work_stack,
WORK_STACK_SIZE);
@@ -154,7 +151,6 @@ os_task_init(&mytask, "mytask", mytask_handler, NULL,
```
##Task Priority, Preempting, and Context Switching
-
A preemptive RTOS is one in which a higher priority task that is *ready to run* will preempt (i.e. take the
place of) the lower priority task which is *running*. When a lower priority task is preempted by a higher
priority task, the lower priority task\u2019s context data (stack pointer, registers, etc.) is saved and the new
@@ -241,9 +237,9 @@ Set a new app location.
$ newt target set task_tgt app=apps/mynewt_tasks_lesson
```
-Now let\u2019s take a look at our new code. First, notice that we have abandoned blinking, instead
-choosing to use the [*console*](http://mynewt.apache.org/latest/os/modules/console/console/)
-and [*shell*](http://mynewt.apache.org/latest/os/modules/shell/shell/) to follow our tasks through execution.
+Now let\u2019s take a look at our new code. First, notice that we have abandoned blinking, instead choosing t
+o use the [*console*](http://mynewt.apache.org/latest/os/modules/console/console/) and [*shell*](http://mynewt.apache.org/latest/os/modules/shell/shell/)
+to follow our tasks through execution.
Additionally, we have a number of different tasks:
@@ -281,8 +277,20 @@ $ cd repos/mynewt_arduino_zero
$ git checkout develop
```
-You should already be familiar with the [Serial Port Setup and Configuration](../get_started/serial_access.md), but if
-you're not, you can go there now and then come back.
+Open a new terminal window and list your serial connections to find our Arduino.
+```c
+$ ls /dev/tty.*
+
+/dev/tty.Bluetooth-Incoming-Port /dev/tty.usbmodem14132
+```
+
+In the same window, connect to the serial port using a serial communication program.
+In this case I\u2019ll be using mincom as it can scroll through output.
+```c
+$ minicom -D /dev/tty.usbmodem14132 -b 115200
+```
+
+If you see minicom welcome you, you\u2019re ready to move on!
### Output Analysis
@@ -390,8 +398,7 @@ rate, Task B would take over a minute to finish one cycle.
Feel free to play around with the testing parameters to study the different changes yourself!
-###Conclusion
-
+##Conclusion
Moving forward, tasks are just the tip of the iceberg. The [*scheduler*](http://mynewt.apache.org/latest/os/core_os/context_switch/context_switch/),
[*event queues*](http://mynewt.apache.org/latest/os/core_os/event_queue/event_queue/),
[*semaphores*](http://mynewt.apache.org/latest/os/core_os/semaphore/semaphore/), and
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/3fdca23f/mkdocs.yml
----------------------------------------------------------------------
diff --git a/mkdocs.yml b/mkdocs.yml
index 8546fad..bd466ff 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -25,7 +25,6 @@ pages:
- 'Install Newt on Linux': 'newt/install/newt_linux.md'
- 'Install Cross Tools for ARM': 'os/get_started/cross_tools.md'
- 'Create Your First Project': 'os/get_started/project_create.md'
- - 'Serial Port Setup': 'os/get_started/serial_access.md'
- Concepts: 'os/get_started/vocabulary.md'
- Tutorials:
- toc: 'os/tutorials/tutorials.md'
@@ -40,18 +39,13 @@ pages:
- 'Run Blinky from SRAM, no bootloader': 'os/tutorials/blinky_sram_olimex.md'
- 'Work with repositories':
- toc: 'os/tutorials/repo/add_repos.md'
- - 'Upgrade a Repo': 'os/tutorials/repo/upgrade_repo.md'
- - 'Turn project into a Repo': 'os/tutorials/repo/create_repo.md'
- - 'Tasks and Priority Management': 'os/tutorials/tasks_lesson.md'
- - 'Enable Wi-Fi on Arduino Zero': 'os/tutorials/wi-fi_on_arduino.md'
+ - 'Upgrade a repo': 'os/tutorials/repo/upgrade_repo.md'
+ - 'Turn project into a repo': 'os/tutorials/repo/create_repo.md'
- 'Write a Test Suite for a Package': 'os/tutorials/unit_test.md'
- 'Air-quality Sensor project': 'os/tutorials/air_quality_sensor.md'
- 'Add task to manage multiple events': 'os/tutorials/event_queue.md'
- - 'Project Slinky for remote comms':
- - 'Slinky on sim device': 'os/tutorials/project-slinky.md'
- - 'Slinky on STM32 board': 'os/tutorials/project-target-slinky.md'
- - 'Enable newtmgr in any app': 'os/tutorials/add_newtmgr.md'
- - 'Enable the OS Shell and Console': 'os/tutorials/add_shell.md'
+ - 'Enable remote comms on sim device': 'os/tutorials/project-slinky.md'
+ - 'Enable remote comms on STM32 board': 'os/tutorials/project-target-slinky.md'
- 'BLE app to check stats via console': 'os/tutorials/bletiny_project.md'
- 'BLE peripheral project':
- toc: 'os/tutorials/bleprph/bleprph-intro.md'