`` to set one.
383 | 1. ``yotta target`` to check that the target was set.
384 |
385 | 1. Installed dependencies:
386 | 1. ``yotta install mbed-drivers``.
387 |
388 | 1. Added application files to the ``source`` folder:
389 | 1. File copied from the example GitHub repository and renamed ``main.cpp``.
390 |
391 | 1. Built the module:
392 | 1. ``yotta build``.
393 |
394 | 1. Copied your binary to the board over micro-USB.
395 |
396 |
--------------------------------------------------------------------------------
/Docs/Full_Guide/contributing.md:
--------------------------------------------------------------------------------
1 | # Creating and publishing your own libraries and contributing to mbed OS
2 |
3 | This chapter covers the different aspects of developing your own libraries for use in mbed devices, as well as items to keep in mind during development, like licensing. It covers:
4 |
5 | 1. [The mbed OS code base](#contributing-to-the-mbed-os-code-base): Use GitHub to contribute additions and bug fixes to mbed OS itself.
6 |
7 | [//]: # (TODO add section about the index service when available)
8 |
9 | ### Licensing binaries and libraries
10 |
11 | When you write original code you own the copyright and can choose to make it available to others under a license of your choice. A license gives rights and puts limitations on the reuse of your code by others. Not having a license means others cannot use your code. We encourage you to choose a license that makes possible (and encourages!) reuse by others.
12 |
13 | If you create new software, such as drivers, libraries and examples, you can apply whatever license you like as the author and copyright holder of that code. Having said that, we encourage you to use a well known license such as one of the ones listed [on spdx.org](http://spdx.org/licenses/), preferably an [OSI-approved] (https://opensource.org/licenses/alphabetical), permissive open source software license. Specifically, we recommend the following:
14 |
15 | * For original source code, use the Apache 2.0 license.
16 |
17 | * For binary releases (for example, private source code you can’t or don’t want to release but want to share as a binary library and headers available for others to use), consider the [Permissive Binary License](https://www.mbed.com/licenses/PBL-1.0). This is designed to be compatible with Apache 2.0 and the mbed OS code base.
18 |
19 | * If your software incorporates or is derived from other third party open source code, please be sure to retain all notices and identify the license for the third party licensed code in the same manner as described below. Remember, you cannot change the license on someone else’s code, because you are not the copyright holder! Instead, choose a license that is compatible with the license used by the third party open source code, or use the same license as that code. For example, if your software is derived from GPL source code, GPL requires you to license the rest of your code in that software under the GPL too. Note that many commercial users won’t be able to use GPL source code in their products, so we don't recommend this license if you're not obligated to use it.
20 |
21 | You must either write all the code you provide yourself, or have the necessary rights to provide code written by someone else.
22 |
23 | In all cases, whatever license you use, please use an [SPDX](https://spdx.org/about-spdx/what-is-spdx) [license identifier](http://spdx.org/licenses/) to make it easier for users to understand and legally review licenses.
24 |
25 | #### When to use Apache 2.0
26 |
27 | Apache 2.0 is a permissive, free and open source software license that allows other parties to use, modify, and redistribute the code in source and binary form. Compared to the often used BSD license, Apache 2.0 provides an express patent grant from contributors to users.
28 |
29 | The full text of the license can be found on the [Apache website](http://www.apache.org/licenses/LICENSE-2.0). For more information about Apache 2.0, see [the FAQ](http://www.apache.org/foundation/license-faq.html).
30 |
31 | #### How to apply Apache 2.0 correctly
32 |
33 | In order to clearly reflect the Apache 2.0 license, please create two text files:
34 |
35 | * A *LICENSE* file with the following text:
36 |
37 | Unless specifically indicated otherwise in a file, files are licensed under the Apache 2.0 license,
38 | as can be found in: LICENSE-apache-2.0.txt
39 |
40 | * The full original [Apache 2.0 license text](http://www.apache.org/licenses/LICENSE-2.0) in *LICENSE-apache-2.0.txt*
41 |
42 | Each source header should *start with* your copyright line, the SPDX identifier and the Apache 2.0 header as shown here:
43 |
44 | ```
45 | Copyright (c) [First year]-[Last year], **Your Name or Company Here**, All Rights Reserved
46 | SPDX-License-Identifier: Apache-2.0
47 |
48 | Licensed under the Apache License, Version 2.0 (the "License");
49 | you may not use this file except in compliance with the License.
50 |
51 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
52 |
53 | Unless required by applicable law or agreed to in writing, software
54 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
55 | either express or implied.
56 |
57 | See the License for the specific language governing permissions and limitations under the License.
58 | ```
59 |
60 | #### When to use the Permissive Binary License
61 |
62 | The Permissive Binary License (PBL) is a permissive license based on BSD-3-Clause and designed specifically for binary blobs. It's minimal, but covers the basics, including an express patent grant.
63 |
64 | It allows you to share a binary blob and the relevant headers, and allows others to use that binary blob as part of their product - as long as they provide it with all the relevant dependencies and don't modify it or reverse engineer it.
65 |
66 | The full text can be found on [mbed.com](https://www.mbed.com/licenses/PBL-1.0).
67 |
68 | #### How to apply PBL correctly
69 |
70 | In order to clearly reflect the PBL license, please create three text files:
71 |
72 | * A *LICENSE* file with:
73 |
74 | Unless specifically indicated otherwise in a file, files are licensed under the Public Binary License,
75 | as can be found in: LICENSE-permissive-binary-license-1.0.txt
76 |
77 | * The full original [Public Binary License 1.0 text](https://www.mbed.com/licenses/PBL-1.0) in *LICENSE-permissive-binary-license-1.0.txt*.
78 |
79 | * A *DEPENDENCIES* file with the dependencies that this binary requires to work properly. This is to make sure that third parties integrating the binary in their own distribution are aware that they need to include the relevant dependencies. If your binary does not have any dependencies, the file should state so (that is, say “No dependencies”); don't omit this file.
80 |
81 | Each source header should *start with* your copyright line, the SPDX identifier and the BPL header:
82 |
83 | ```
84 | Copyright (c) [First year]-[Last year], **Your Name Here**, All Rights Reserved
85 | SPDX-License-Identifier: LicenseRef-PBL
86 |
87 | Licensed under the Permissive Binary License, Version 1.0 (the "License");
88 | you may not use this file except in compliance with the License.
89 |
90 | You may obtain a copy of the License at https://www.mbed.com/licenses/PBL-1.0
91 |
92 | See the License for the specific language governing permissions and limitations under the License.
93 | ```
94 |
95 | ### Using a different license
96 |
97 | If you decide to use a different license for your work, follow the same pattern:
98 |
99 | * Create a *LICENSE* file with a description of the license situation, following the pattern described in the sections above.
100 |
101 | * Put the full original license texts in separate documents named *LICENSE-XYZ.txt*, where XYZ is the corresponding [SPDX identifier](http://spdx.org/licenses/) for your license.
102 |
103 | * Begin each source header with your copyright line, the SPDX identifier and the standard header for the license that applies to that single file, if it has one.
104 |
105 | * If more than one license applies to the source file, then use an SPDX license expression (see Appendix IV in [this document](http://spdx.org/sites/spdx/files/SPDX-2.0.pdf)), to reflect the presence of multiple licenses in your *LICENSE* file and in each source file.
106 |
107 | ## Contributing to the mbed OS code base
108 |
109 | ### mbed OS principles
110 |
111 | mbed OS uses these same basic principles for its source code and library distributions. So source code we own is distributed under the Apache 2.0 license and binary blobs are released under the Permissive Binary License. Software parts from third parties that were already licensed under a different license are available under that original license.
112 |
113 | All the source code and binary blobs that end up in mbed OS are maintained in public GitHub repositories.
114 |
115 | ### Contributions
116 |
117 | All code changes and additions to mbed OS are handled through GitHub. If you want to contribute, either by adding features or by fixing bugs, please follow the guidelines for [new features](#contributing-new-features-to-mbed-os) and [bugs](#reporting-and-fixing-bugs), and in both cases please follow the [code style guide and GitHub pull request guidelines](Code_Style.md).
118 |
119 | ### Licensing
120 |
121 | If you want to contribute code to mbed OS, you must sign an mbed Contributor License Agreement (CLA). Please ask for a CLA before submitting any code (for example, while discussing the issue on GitHub), then wait for ARM to confirm acceptance of your CLA before making contributions.
122 |
123 | **Note:** If you publish a feature or a solution to a problem before signing the CLA, then find out that you are not able or allowed to sign the CLA, we will not be able to use your solution anymore. That may prevent us from solving the problem for you.
124 |
125 | When you ask for the CLA, we'll send you the agreement and ask you to sign it *before* we handle any pull request from you:
126 |
127 | * Individuals who want to contribute their own work must sign and return an Individual CLA.
128 |
129 | * Companies that want employees to contribute on its behalf must sign and return a Corporate CLA.
130 |
131 | The same agreement is then valid for all future pull requests from that GitHub username.
132 |
133 | ### Contributing new features to mbed OS
134 |
135 | Before contributing an enhancement (new feature, new port and so on) please [discuss it on the forums](https://developer.mbed.org/forum/) to avoid duplication of work, as we or others might be working on a related feature.
136 |
137 | Patch contributions can only be accepted through GitHub by creating a pull request from forked versions of our repositories. This allows us to review the contributions in a user friendly and reliable way, under public scrutiny.
138 |
139 | Please create separate patches for each concern; each patch should have a clear unity of purpose. In particular, separate code formatting and style changes from functional changes. This makes each patch’s true contribution clearer, and therefore quicker and easier to review.
140 |
141 | ### Reporting and fixing bugs
142 |
143 | Before submitting a bug report or a bug fix, please [discuss it on the forums](https://developer.mbed.org/forum/) to avoid duplication of work, as we or others might be working on it already.
144 |
145 | #### Bug reports (issues) on GitHub
146 |
147 | All mbed OS is on GitHub; please use GitHub's [issues mechanism](https://guides.github.com/features/issues/) to open a bug report directly against the relevant GitHub repository.
148 |
149 | #### Bug fixes
150 |
151 | Please refer to the [code contributions chapter](Code_Style.md).
152 |
153 | Bug fixes must be verified by a member of the mbed team before they're pulled into the main branch. You must therefore use GitHub to fork the repo, then submit a pull request with your changes.
154 |
155 | The last line in your commit message description should say “Fixes #deadbeef”, where “deadbeef” is the issue number in GitHub. This allows GitHub to automatically close the issue when the commit is merged into the default branch.
156 |
157 | ## Further reading
158 |
159 | Please see the [code contributions chapter](Code_Style.md) for the guidelines to GitHub pull requests and the coding style guide.
160 |
--------------------------------------------------------------------------------
/Docs/Full_Guide/mbed_tls.md:
--------------------------------------------------------------------------------
1 | # mbed TLS
2 |
3 | mbed TLS makes it trivially easy for developers to include cryptographic and SSL/TLS capabilities in their embedded products, with a minimal code footprint. It offers an SSL library with an intuitive API and readable source code.
4 |
5 | **Note:** The current release of mbed TLS for mbed OS is beta, and implements no secure source of random numbers, weakening its security. We therefore consider it an evaluation version, not a production version. If you want a production version, please consider the standalone available at [https://tls.mbed.org/](https://tls.mbed.org/)
6 |
7 | Currently the only supported yotta targets are:
8 |
9 | - `frdm-k64f-gcc`
10 | - `frdm-k64f-armcc`
11 | - `x86-linux-native`
12 | - `x86-osx-native`
13 |
14 | ## Differences between the standalone and mbed OS editions
15 |
16 | mbed TLS has a standalone edition for devices that are not running mbed OS. However, this guide focuses on the mbed OS integration. While the two editions share a code base, there are a number of differences, mainly in configuration and integration. You should keep those differences in mind when reading some articles in our [knowledge base](https://tls.mbed.org/kb), as currently all the articles are about the standalone edition.
17 |
18 | The key differences are:
19 |
20 | * To reduce its footprint, the mbed OS edition enables a smaller set of features in `config.h` by default. While the default configuration of the standalone edition puts more emphasize on maintaining interoperability with old peers, the mbed OS edition only enables the most modern ciphers and the latest version of TLS and DTLS.
21 |
22 | * The following components of mbed TLS are disabled in the mbed OS edition: `net.c` and `timing.c`. This is because mbed OS includes their equivalents.
23 |
24 | * The mbed OS edition comes with a fully integrated API for TLS and DTLS connections in a companion module: [mbed-tls-sockets](https://github.com/ARMmbed/mbed-tls-sockets). See ["Performing TLS and DTLS connections"](#Performing-TLS-and-DTLS-connections).
25 |
26 |
27 | ## Performing TLS and DTLS connections
28 |
29 | mbed TLS provides a high-level API for performing TLS and DTLS connections in mbed OS. The API is in a separate yotta module: [mbed-tls-sockets](https://github.com/ARMmbed/mbed-tls-sockets). We recommend using this API for TLS and DTLS connections. It is very similar to the API provided by the [``sockets``](https://github.com/ARMmbed/sockets) module for unencrypted TCP and UDP connections.
30 |
31 | The `mbed-tls-sockets` module includes a complete [example TLS client](https://github.com/ARMmbed/mbed-tls-sockets/blob/master/test/tls-client/main.cpp) with [usage instructions](https://github.com/ARMmbed/mbed-tls-sockets/blob/master/test/tls-client/README.md).
32 |
33 | ## Configuring mbed TLS features
34 |
35 | mbed TLS makes it easy to disable any feature during compilation, if that feature isn't required for a particular project. The default configuration:
36 |
37 | * Enables all modern and widely-used features, to meet the needs of new projects.
38 |
39 | * Disables all features that are older or less common, to minimize the code footprint.
40 |
41 | The list of compilation flags is available in the fully documented [``config.h`` file](https://github.com/ARMmbed/mbedtls/blob/development/include/mbedtls/config.h).
42 |
43 | If you need to adjust those flags, you can provide your own configuration-adjustment file:
44 |
45 | 1. Create a configuration file. You can name it freely.
46 | 1. Put the file in your application's ``include`` directory.
47 | 1. Add suitable `#define` and `#undef` statements in your file.
48 | 1. mbed TLS needs to know your file's name. To do that, you need to use yotta's [configuration system](http://docs.yottabuild.org/reference/config.html):
49 | - In your ``config.json`` file, under ``mbedtls``, fine the key ``user-config-file``.
50 | - Enter your filename as the value of that key.
51 |
52 | ``config.h`` includes your file between the default definitions and the sanity checks.
53 |
54 | For example, in an application called `myapp`, if you want to enable the EC J-PAKE key exchange and disable the CBC cipher mode, you can create a file named `mbedtls-config-changes.h` in the `myapp` directory containing the following lines:
55 |
56 | #define MBEDTLS_ECJPAKE_C
57 | #define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
58 |
59 | #undef MBEDTLS_CIPHER_MODE_CBC
60 |
61 | And then create a file named `config.json` at the root of your application with the following contents:
62 |
63 | {
64 | "mbedtls": {
65 | "user-config-file": "\"myapp/mbedtls-config-changes.h\""
66 | }
67 | }
68 |
69 | **Note:** You need to provide the exact name that you use in the `#include` directive, including the `<>` or quotes around the name.
70 |
71 | ## Getting mbed TLS from GitHub
72 |
73 | Like most components of mbed OS, mbed TLS is developed in the open and its source can be found on GitHub: [ARMmbed/mbedtls](https://github.com/ARMmbed/mbedtls). Unlike most other mbed OS components, however, you cannot just clone the repository and run `yotta build` from its root. This is because mbed TLS also exists as an independent component, so its repository includes things that are not relevant for mbed OS.
74 |
75 | If you want to use mbed TLS from the GitHub repo:
76 |
77 | 1. Create a local clone.
78 |
79 | 1. From the root of the clone, run the shell script:
80 |
81 | ```
82 | yotta/create-module.sh
83 | cd yotta/module
84 | ```
85 |
86 | You can then run any [yotta command](app_on_yotta.md) you would normally run, such as [`yotta build`] or [`yotta link`].
87 |
88 | ## Sample programs
89 |
90 | This release includes the following examples:
91 |
92 | 1. [**Self test:**](https://github.com/ARMmbed/mbedtls/blob/development/yotta/data/example-selftest) Tests different basic functions in the mbed TLS library.
93 |
94 | 2. [**Benchmark:**](https://github.com/ARMmbed/mbedtls/blob/development/yotta/data/example-benchmark) Measures the time taken to perform basic cryptographic functions used in the library.
95 |
96 | 3. [**Hashing:**](https://github.com/ARMmbed/mbedtls/blob/development/yotta/data/example-hashing) Demonstrates the various APIs for computing hashes of data (also known as message digests) with SHA-256.
97 |
98 | 4. [**Authenticated encryption:**](https://github.com/ARMmbed/mbedtls/blob/development/yotta/data/example-authcrypt) Demonstrates using the Cipher API for encrypting and authenticating data with AES-CCM.
99 |
100 | These examples are integrated as yotta tests, so they are built automatically when you build mbed TLS. Each of them comes with complete usage instructions as a Readme file in the repository.
101 |
102 | ## Other resources
103 |
104 | The [mbed TLS website](https://tls.mbed.org) contains many other useful resources for developers, such as [developer
105 | documentation](https://tls.mbed.org/dev-corner), [knowledge base articles](https://tls.mbed.org/kb), and a [support forum](https://tls.mbed.org/discussions).
106 |
107 | ## Contributing
108 |
109 | We gratefully accept bug reports and contributions from the community. There are some requirements we need to fulfill in order to be able to integrate contributions:
110 |
111 | * Simple bug fixes to existing code do not contain copyright themselves and we can integrate without issue. The same is true of trivial contributions.
112 |
113 | * For larger contributions, such as a new feature, the code can possibly fall under copyright law. We then need your consent to share in the ownership of the copyright. We have a form for this, which we will send to you in case you submit a contribution or pull request that we deem this necessary for.
114 |
115 | To contribute, please:
116 |
117 | * [Check for open issues](https://github.com/ARMmbed/mbedtls/issues) or [start a discussion](https://tls.mbed.org/discussions) around a feature idea or a bug.
118 |
119 | * Fork the [mbed TLS repository on GitHub](https://github.com/ARMmbed/mbedtls) to start making your changes. As a general rule, you should use the "development" branch as a basis.
120 |
121 | * Write a test that shows that the bug was fixed or that the feature works as expected.
122 |
123 | * Send a pull request and nag us until it gets merged and published. We will include your name in the ChangeLog.
124 |
--------------------------------------------------------------------------------
/Docs/Full_Guide/memory.md:
--------------------------------------------------------------------------------
1 | # Memory in mbed OS
2 | mbed OS provides memory allocation services that are based on a standard memory organization, described below. The memory allocation services provide for most use-cases in memory allocation, including heap allocation, pool allocation, and extendable pools.
3 |
4 | ## Memory organization in mbed OS
5 | In a conventional embedded system, there are four areas of memory: Code, Global Data, the heap, and the stack. Frequently, the heap and the stack are organized so that they occupy the same block of memory. In mbed OS, we add two additional areas of memory: uVisor memory and the never free heap. Memory is organized as below. Note that code generally lives in ROM, so it is not included in this diagram.
6 |
7 | ```
8 | Cortex-M3/M4 Cortex-M0/M+
9 | Largest RAM address Largest RAM address
10 | +-----------------+ +-----------------+
11 | | Never Free Heap | | Never Free Heap |
12 | | | | |
13 | | Heap | | Heap |
14 | +-----------------+ +-----------------+
15 | | Global Data | | Global Data |
16 | +-----------------+ +-----------------+
17 | | Stack | | Stack |
18 | +-----------------+ +-----------------+
19 | | uVisor Memory | Smallest RAM address
20 | +-----------------+
21 | Smallest RAM address
22 | ```
23 |
24 | ### uVisor Memory
25 | On Cortex-M3/M4, the uVisor reserves a small portion of memory at the beginning of RAM for itself and for secured features (boxes). The uVisor secures this area using the MPU. For more information on the uVisor, see [our main site](https://www.mbed.com/en/technologies/security/uvisor/)
26 |
27 | ### Stack
28 | The stack is placed at the bottom of the memory, and it grows downwards. This location is selected explicitly because it allows stack overflows to be easily caught. In a Cortex-M3/M4 system, where the uVisor is in use, the first access below the bottom of the stack will trigger a [MemManage](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Cihgggbh.html) exception, handled by the uVisor. In a Cortex-M0/M0+ system, it will trigger a [HardFault](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/Babcefea.html). This allows applications to recover from stack overflows, generally through a reset.
29 |
30 | This organization does mean that a stack must be sized to match the application. Currently, this is a value set in the target, but a future version will expose stack configuration through yotta config.
31 |
32 | ### Global Data
33 | Global Data is the typical ``.bss`` and ``.data`` sections generated by the compiler. This section's size depends on the application and requires no configuration.
34 |
35 | ### Heaps
36 | There are two kinds of heap in mbed OS. The heap grows upwards from the bottom of the heap section, while the never free heap grows downwards from the top.
37 |
38 | #### The standard heap
39 | The standard heap is a typical dlmalloc heap, which grows upwards from the bottom of the heap section using the ```sbrk``` function provided by the [core-util](https://github.com/ARMmbed/core-util) module.
40 |
41 | #### The never free heap
42 | The never free heap grows downwards from the end of memory. The never free heap is intended for use with data that need not be freed, such as memory pools. Memory is allocated from the never free heap using the reverse sbrk function (```krbs```) provided by the [core-util](https://github.com/ARMmbed/core-util) module.
43 |
44 | ## Memory Allocation in mbed OS
45 | mbed OS provides several memory allocation services, including a traits allocator, a typical dlmalloc heap, a never free heap, a pool allocator and an extendable pool allocator. These facilities are built on top of two trivial, but lock-free, allocators: ```sbrk()``` and ```krbs()``` (a reverse ```sbrk```).
46 |
47 | ### Usage Notes
48 | In general, you should use ```mbed_ualloc()``` where malloc-type allocation is necessary. Standard library functions, such as ```malloc()```, ```realloc()```, and ```calloc``` can also be used, but they are not as flexible as ```mbed_ualloc()```. You should avoid using ```sbrk()``` and ```krbs()``` where possible; these are low-level functions, intended for use by other memory allocators.
49 |
50 | Where memory is allocated in interrupt context, or similarly sized memory is used frequently, it can be advantageous to use ```PoolAllocator``` or ```ExtendablePoolAllocator```. ```malloc()```, ```realloc()```, and ```calloc``` should not be called from an interrupt context. ```mbed_ualloc()``` should only be called from an interrupt context with the ```UALLOC_TRAITS_NEVER_FREE``` trait set.
51 |
52 |
53 | ### ualloc traits allocator
54 | In mbed OS, all memory allocation is done through a traits allocator, [ualloc](https://github.com/ARMmbed/ualloc). ualloc provides features that support both the dlmalloc heap and the never free heap. Currently, only two traits are supported in ualloc: ```UALLOC_TRAITS_NEVER_FREE```, which allocates from the never-free region, and ```UALLOC_TRAITS_ZERO_FILL```, which zeros the allocated space prior to returning it, much like ```calloc```. ```ualloc``` hooks several of the standard library functions:
55 |
56 | * ```malloc```
57 | * ```calloc```
58 | * ```realloc```
59 | * ```free```
60 |
61 | This is to ensure that all allocations are done via ualloc, which in turn ensures that all compilers with all libc's will produce the same memory behavior. Using ualloc as a the channel for all memory allocations also provides a common point for memory allocation analysis. By analyzing calls to ualloc functions, it is possible to monitor all memory allocation behavior.
62 |
63 | For allocations with the ```UALLOC_TRAITS_NEVER_FREE``` trait, ualloc calls ```krbs()``` directly. Without the never-free trait, ualloc calls dlmalloc functions.
64 |
65 | ### The standard heap
66 | The standard heap is managed by [dlmalloc](https://github.com/ARMmbed/dlmalloc). For standard heap operations, ualloc forwards operations to dlmalloc. dlmalloc, in turn, uses ```sbrk()``` to obtain more memory.
67 |
68 | ### The pool allocator
69 | mbed OS provides a pool allocator in the [core-util](https://github.com/ARMmbed/core-util) module, called ```PoolAllocator```. This allocator divides its block of memory into 4-byte aligned regions of fixed size. The pool allocator is lock-free and very fast, so it is suitable for use in interrupt context. ```PoolAllocator``` can run out of memory, however, so for some operations, ```ExtendablePoolAllocator``` is more useful.
70 |
71 | ### The extendable pool allocator
72 | mbed OS also provides an extendable pool allocator in the [core-util](https://github.com/ARMmbed/core-util) module, called ```ExtendablePoolAllocator```. It is built on top of PoolAllocator, with the sole difference that, when ```ExtendablePoolAllocator``` runs out of pool elements to allocate, it can request more from the never free heap, using ```ualloc()```, with the ```UALLOC_TRAITS_NEVER_FREE``` flag set.
73 |
74 | ### sbrk
75 | sbrk is a trivial allocator implemented in the [core-util](https://github.com/ARMmbed/core-util) module. It supports linear allocation and deallocation. It is completely lock-free.
76 |
77 | ### krbs
78 | krbs is effectively the reverse of ```sbrk()```, allocating memory from the end of a section, rather than the beginning. The one exception in behavior is that ```krbs()``` does not support deallocation.
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Docs/Full_Guide/networking.md:
--------------------------------------------------------------------------------
1 | # Networking and connectivity
2 | mbed OS provides several facilities for networking and connectivity. For high level applications, mbed OS provides mbed Client, the C++ Socket API, and the BLE API. mbed Client is a high level communication mechanism designed for working directly with mbed Device Server over CoAP. The C++ Socket API is a fully non-blocking, event-based, object-oriented socket API. The BLE API is a C++ API for creating Bluetooth Low Energy applications. These APIs abstract several protocols, including Ethernet, 6LoWPAN over 802.15.4, and Bluetooth Low Energy.
3 |
4 | Using these three high level APIs, it is possible to create rich connected applications.
5 |
6 | ## Networking in mbed OS: the components
7 |
8 | Networking in mbed OS is broken down into several components:
9 |
10 | * The application.
11 |
12 | * (optionally) The mbed Client API.
13 |
14 | * The C++ Socket API.
15 |
16 | * The Socket Abstraction Layer (SAL).
17 |
18 | * The IP stack.
19 |
20 | * The network driver.
21 |
22 | * The network interface.
23 |
24 | 
25 |
26 | Some parts of this infrastructure are still in development but most of it is quite stable.
27 |
28 | ### The application
29 |
30 | The application is the user's program. The application layer is responsible for:
31 |
32 | * Initializing the IP stack (Note: when yotta supports module init, this requirement will be removed).
33 |
34 | * Initializing the network interface.
35 |
36 | * Sending data.
37 |
38 | * Reacting to received data.
39 |
40 | ### The C++ Socket API
41 |
42 | The C++ Socket API provides a number of state management facilities and convenience functions. The API also provides a mechanism for event demultiplexing, so that each class of event is dispatched to a separate handler. The C++ Socket API is built on top of the MINAR scheduler. This means that C++ Socket API callbacks do not execute in IRQ context, so complex computations, memory allocation and so on will not interfere with interrupt processing. More information on using the C++ socket API can be found in the sockets readme.
43 |
44 | The C++ Socket API is built on top of the Socket Abstraction Layer.
45 |
46 | __Known issues__
47 |
48 | Currently the C++ Socket API is responsible for scheduling the periodic callback of each underlying stack. However, it only supports calling the periodic callback of a single stack and so does not support two coexisting IP stacks.
49 |
50 | ### The Socket Abstraction Layer
51 |
52 | The Socket Abstraction Layer (SAL) provides a common C interface to all of the common features that an IP stack provides. Much of the SAL is implemented as wrappers around the structures provided by IP stacks. Some features of the SAL require that data types be converted to and from IP stack structures. The primary example of this is the ```struct socket_addr```: this structure is implemented as a 128-bit big-endian integer. This is so that the SAL can treat all IP addresses the same way, and so that the application can have some guarantees about how it accesses the IP addresses. In most stacks, the IP address is stored as a big-endian integer anyway, so this creates very little overhead.
53 |
54 | Typically, applications will not use SAL APIs directly. While it is possible to do this, the C++ Socket API provides a much more convenient interface, with very little overhead.
55 |
56 | The SAL has been designed to support multiple, coexisting IP stacks, running simultaneously. However, this feature is not currently supported by the C++ Socket API. The SAL is configured to use a maximum of two IP stacks. In a future version of the SAL, it will be possible to change the number of supported stacks.
57 |
58 | #### SAL development
59 |
60 | The SAL is not complete: an interface abstraction API is still in development. This abstraction is necessary because the stack needs to know about network interface state changes; it also needs to do IP address configuration, either through static configuration or through DHCP. Because these configuration options are largely stack-level, they require an API to control the stack, so the SAL forms a natural interface point.
61 |
62 | #### SAL dependencies
63 |
64 | The SAL contains very little code - it is mostly a set of API definitions. The SAL depends on an IP stack to implement its APIs. The IP stack is selected via the [yotta config mechanism](http://yottadocs.mbed.com/reference/config.html).
65 |
66 | For example, when using a Freescale FRDM-K64F, LwIP is enabled by default. If 6LoWPAN is the target for the application, then application-level config can override this choice in an application-supplied ```config.json```:
67 |
68 |
69 | ```JSON
70 | {
71 | "mbed-os": {
72 | "net": {
73 | "stacks": {
74 | "lwip":false,
75 | "nanostack": true
76 | }
77 | }
78 | }
79 | }
80 | ```
81 |
82 | ### The IP stack
83 |
84 | The IP stack is typically wrapped with a lightweight shim that implements the APIs of the SAL. Currently, there are two supported stacks: LwIP (IPv4 only), and nanostack (IPv6 only).
85 |
86 | Please note that some mbed C++ Socket API methods may not be available for the selected IP stack. Therefore, it is important to check the API method return value.
87 | ### The network driver
88 |
89 | This component provides the IP stack with the interface it needs to control the hardware. One driver is required for each combination of IP stack and network hardware.
90 |
91 | ### The network interface
92 |
93 | The network interface provides management functions for the interface hardware, such as power up/down and configuration. It is currently bound to the IP stack, but future development of the SAL will permit the network interface to be decoupled from the IP stack.
94 |
95 |
96 | ### Examples
97 |
98 | There are several complete examples provided in [mbed-example-network](https://github.com/ARMmbed/mbed-example-network). In addition to these examples, a plain DNS resolution is provided below.
99 |
100 | #### DNS example
101 |
102 | This is a simple example of resolving an address with DNS:
103 |
104 | ```C++
105 | #include "sockets/v0/UDPSocket.h"
106 | #include "sal-stack-lwip/lwipv4_init.h"
107 | #include "sal-iface-eth/EthernetInterface.h"
108 | using namespace mbed::Sockets::v0;
109 | class Resolver {
110 | private:
111 | UDPSocket _sock;
112 | public:
113 | Resolver() : _sock(SOCKET_STACK_LWIP_IPV4) {
114 | _sock.open(SOCKET_AF_INET4);
115 | }
116 | void onDNS(Socket *s, struct socket_addr addr, const char *domain) {
117 | (void) s;
118 | SocketAddr sa;
119 | char buf[16];
120 | sa.setAddr(&addr);
121 | sa.fmtIPv4(buf,sizeof(buf));
122 | printf("Resolved %s to %s\r\n", domain, buf);
123 | }
124 | socket_error_t resolve(const char * address) {
125 | printf("Resolving %s...\r\n", address);
126 | return _sock.resolve(address,
127 | UDPSocket::DNSHandler_t(this, &Resolver::onDNS));
128 | }
129 | };
130 |
131 | EthernetInterface eth;
132 | Resolver *r;
133 | void app_start(int argc, char *argv[]) {
134 | (void) argc;
135 | (void) argv;
136 | static Serial pc(USBTX, USBRX);
137 | pc.baud(115200);
138 | printf("Connecting to network...\r\n");
139 | eth.init();
140 | eth.connect();
141 | printf("Connected\r\n");
142 | lwipv4_socket_init();
143 | r = new Resolver();
144 | r->resolve("mbed.org");
145 | }
146 |
147 | ```
148 |
149 |
150 | ## IPv6 (6LoWPAN)
151 |
152 | The 6LoWPAN stack is a robust, scalable and self-healing mesh networking stack for low power, less complex constrained devices. The 6LoWPAN stack [documentation](http://docs.mbed.com/docs/arm-ipv66lowpan-stack/en/latest/) gives an overview of the 6LoWPAN technology and reference to the 6LoWPAN stack C API.
153 |
154 | In mbed OS, the 6LoWPAN stack should be used through [mbed-mesh-api](https://github.com/ARMmbed/mbed-mesh-api) and the [mbed C++ Socket API](https://github.com/ARMmbed/sockets/blob/master/README.md). The mbed mesh API is responsible for initializing the 6LoWPAN stack when used for the first time; applications must therefore connect to a wireless network by using the mbed-mesh-api before using any other method from the socket API.
155 |
156 | The mbed C++ Socket API is not fully supported by the 6LoWPAN adaptation layer. You can see the 6LoWPAN stack deviations from the mbed Socket C++ API in the [sal-iface-6lowpan](https://github.com/ARMmbed/sal-iface-6lowpan) documentation.
157 |
158 | The mbed-mesh-api is in an experimental state and uses static configuration. It does not provide API for selecting the node operating mode, security option, radio channel or other options that are needed for connecting to a 6LoWPAN network. Support for these configurations will be available in the future.
159 |
160 | ## Thread
161 |
162 | Thread support is built-in to the 6LoWPAN stack. See [Introduction to Thread](https://docs.mbed.com/docs/arm-ipv66lowpan-stack/en/latest/thread_overview/index.html) for more information.
163 |
164 | ## Bluetooth Low Energy (BLE)
165 |
166 | The BLE libraries in mbed OS abstract the BLE protocol, so that no matter which manufacturer’s stack you’re using, the API remains the same and you don’t need to rewrite your code. By moving to yotta, we have gained the ability to switch between API implementations depending on which target we select.
167 |
168 | To learn more about BLE on mbed OS, see our [BLE Intros](https://docs.mbed.com/docs/ble-intros/).
169 |
170 | ## Including networking headers in your code
171 |
172 | All mbed OS applications need ``mbed-drivers``, which includes most mbed OS functionality. However, for networking, you will have to explicitly include additional headers.
173 |
174 | __For IPv4:__
175 |
176 | ```c++
177 | #include "sal-iface-eth/EthernetInterface.h"
178 | #include "sockets/UDPSocket.h" //if you want UDP
179 | #include "sockets/TCPStream.h" //if you want a TCP Client
180 | #include "sockets/TCPListener.h" //if you want a TCP Server
181 | #include "sal-stack-lwip/lwipv4_init.h"
182 | ```
183 |
184 | And please ensure that you have the following call in your code:
185 |
186 | ```c++
187 | void app_start(int argc, char *argv[])
188 | {
189 | socket_error_t err = lwipv4_socket_init();
190 | ...
191 | }
192 | ```
193 |
194 | __For 6LoWPAN and Thread:__
195 |
196 | ```c++
197 | #include "mbed-mesh-api"
198 | #include "mbedclient.h"
199 |
200 | // if you are using network modules other than mbed Client:
201 | #include "sockets.h"
202 | ```
203 |
204 | You might need to include board specific drivers, for example ``#include "atmel-rf-driver"``.
205 |
206 | __For BLE:__
207 |
208 | ```c++
209 | #include "ble/BLE.h"
210 |
211 | // If you're using a standard service, include its header:
212 | #include "ble/services/iBeacon.h"
213 | ```
214 |
215 | __module.json updates__
216 |
217 | You will need to add these dependencies to your project's ``module.json`` file. The following example shows includes for 6LoWPAN:
218 |
219 | ```json
220 | "dependencies": {
221 | "mbed-drivers": "*",
222 | "mbed-client": "^1.0.0",
223 | "atmel-rf-driver": "^1.0.0",
224 | "mbed-mesh-api": "^1.0.0"
225 | }
226 | ```
227 |
228 | And these are for BLE:
229 |
230 | ```json
231 | "dependencies": {
232 | "mbed-drivers": "*",
233 | "ble": "^2.0.0"
234 | }
235 | ```
236 |
--------------------------------------------------------------------------------
/Docs/FurtherReading.md:
--------------------------------------------------------------------------------
1 | # Further reading and other links
2 |
3 | To learn more about mbed, see the [main site](http://mbed.com).
4 |
5 | ## Release notes
6 |
7 | All release notes for mbed OS and mbed Client are [in the mbed Release Documents project](https://docs.mbed.com/docs/release-documents/en/latest/).
8 |
9 | ## Software
10 |
11 | To learn about mbed [software](http://mbed.com/en/development/software/):
12 |
13 | * [The mbed OS device software](http://mbed.com/en/development/software/mbed-os/).
14 |
15 | * [The yotta build tool](http://mbed.com/en/development/software/tools/yotta/).
16 |
17 | * [The testing tools](http://mbed.com/en/development/software/tools/testing/).
18 |
19 | * Security with [mbed TLS and mbed OS uVisor](http://mbed.com/en/technologies/security/).
20 |
21 | ## Connectivity
22 |
23 | Learn about [connectivity on mbed](http://mbed.com/en/technologies/connectivity/) and [mbed cloud services](http://mbed.com/en/development/cloud/).
24 |
25 | You might want to pay special attention to [mbed Client](/http://mbed.com/en/development/cloud/mbed-client/), the software library that connects constrained devices to mbed Device Server.
26 |
27 | ## Hardware and production
28 |
29 | * The [mbed Enabled hardware list](http://mbed.com/en/development/hardware/).
30 |
31 | * Moving from [prototyping to production](http://mbed.com/en/development/hardware/prototyping-production/), including an introduction to the hardware development kit (HDK).
32 |
33 | ## APIs
34 |
35 | If you're interested in reviewig the APIs, [see the list here](https://docs.mbed.com/docs/api-documentation-list/en/latest/).
36 |
37 | ## Third party integeration
38 |
39 | Read about using mbed OS [with third party tools](https://docs.mbed.com/docs/third-party-integrations/en/latest/).
40 |
41 | ## mbed and the development community
42 |
43 | Learn how to [get help](http://mbed.com/en/development/community-help/) from other developers and on-line sources, and [engage with mbed](http://mbed.com/en/about-mbed/engage-with-us/).
44 |
45 | ## Partner program
46 |
47 | Learn about [our partners or become a partner](http://mbed.com/en/partners/).
48 |
--------------------------------------------------------------------------------
/Docs/GetTheCode.md:
--------------------------------------------------------------------------------
1 | # Code resources
2 |
3 | ## Example applications
4 |
5 | These example applications can help you get started with various functions of mbed OS.
6 |
7 | !{https://raw.githubusercontent.com/ARMmbed/Sample_List/master/Docs/index.md}
8 |
9 | ## Key yotta modules
10 |
11 | If your'e interested in specific yotta modules:
12 |
13 | * [``mbed-drivers``](https://www.mbed.com/en/development/software/mbed-yotta/search/result/module/mbed-drivers/) is the heart of mbed OS. You can [review its documentation here](https://docs.mbed.com/docs/mbed-drivers-api/en/latest/api/index.html).
14 |
15 | * [``mbed-client``](https://www.mbed.com/en/development/software/mbed-yotta/search/result/module/mbed-client/) is best explored through its [getting started guide](https://docs.mbed.com/docs/mbed-client-guide/en/latest/).
16 |
17 | * [``mbedtls``](https://www.mbed.com/en/development/software/mbed-yotta/search/result/module/mbedtls/) is the mbed connectivity security module, and explored in greater detail in [the user guide chapter covering its use in mbed OS](Full_Guide/mbed_tls.md).
18 |
19 | * Some other modules that might interest you are [``sockets``](https://www.mbed.com/en/development/software/mbed-yotta/search/result/module/sockets/), [``ble``](https://www.mbed.com/en/development/software/mbed-yotta/search/result/module/ble/) and [``sal-stack-nanostack``](https://www.mbed.com/en/development/software/mbed-yotta/search/result/module/sal-stack-nanostack/) for connectivity.
20 |
21 | You can search for other modules [on our main site](https://www.mbed.com/en/development/software/mbed-yotta/).
22 |
23 | ## Key code repositories
24 |
25 | For a list of key code repositories and the documentation they contain, see [our main site](http://mbed.com/en/development/getting-started/get-code/).
26 |
27 | To view all mbed repositories, you can go directly to our [GitHub list](https://github.com/ARMmbed).
28 |
--------------------------------------------------------------------------------
/Docs/GettingStartedmbedOS.md:
--------------------------------------------------------------------------------
1 | # mbed OS overview
2 |
3 | This section is a short introduction to mbed OS. It's followed by a sample application that you can build and run on your board.
4 |
5 | ## What's new with mbed: yotta build and registry
6 |
7 | We have created yotta: a command-line tool that takes care of building, assembling and distributing programs and libraries. It’s available on Mac, Windows and Linux. It will soon be integrated with popular desktop and cloud IDEs.
8 |
9 | yotta organises software into modules. A yotta module is a collection of source files with the addition of a file called ``module.json``. This file contains details such as the version, description, author, homepage, and a link to the repository containing the code. It also includes a list of other modules it depends on. You can use modules from many sources, including GitHub and other version control services.
10 |
11 | The yotta registry indexes public modules and you can search it for libraries from within the yotta command-line tool.
12 |
13 | To build a yotta program you can either create a new yotta executable or clone an existing one from a repository. Then set the target and run 'yotta build' from the command line. yotta pulls in the program’s dependencies from the web and generates the executable. Pretty cool, huh?
14 |
15 | For more information about yotta, see the [chapter about building mbed OS applications with yotta](Full_Guide/app_on_yotta/) or [a general review on our main site](http://mbed.com/en/development/software/tools/yotta/).
16 |
17 | ## Working with targets
18 |
19 | yotta can build the same application code for any supported target. So before you build anything with yotta, you select the target that you want to build for.
20 |
21 | The instructions for a particular development board tell you which target to use. You can also find target descriptions by searching the yotta registry. We review targets in more detail when we discuss [building mbed OS applications with yotta](Full_Guide/app_on_yotta/#yotta-targets).
22 |
23 | ## A first application
24 |
25 |
26 | Now that you've been briefed, you can jump on over to the next section and get started with [your first application](FirstProjectmbedOS.md).
27 |
28 |
--------------------------------------------------------------------------------
/Docs/Images/bb-sketch-btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARMmbed/GettingStartedmbedOS/12a5a0d5c1b8afadbe8e21be5906470ad7810bd3/Docs/Images/bb-sketch-btn.png
--------------------------------------------------------------------------------
/Docs/Images/bb-sketch-led.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARMmbed/GettingStartedmbedOS/12a5a0d5c1b8afadbe8e21be5906470ad7810bd3/Docs/Images/bb-sketch-led.png
--------------------------------------------------------------------------------
/Docs/Images/bb01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARMmbed/GettingStartedmbedOS/12a5a0d5c1b8afadbe8e21be5906470ad7810bd3/Docs/Images/bb01.png
--------------------------------------------------------------------------------
/Docs/Images/bb02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARMmbed/GettingStartedmbedOS/12a5a0d5c1b8afadbe8e21be5906470ad7810bd3/Docs/Images/bb02.png
--------------------------------------------------------------------------------
/Docs/Images/bb03.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARMmbed/GettingStartedmbedOS/12a5a0d5c1b8afadbe8e21be5906470ad7810bd3/Docs/Images/bb03.gif
--------------------------------------------------------------------------------
/Docs/Images/bb04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ARMmbed/GettingStartedmbedOS/12a5a0d5c1b8afadbe8e21be5906470ad7810bd3/Docs/Images/bb04.png
--------------------------------------------------------------------------------
/Docs/about_mbed_os.md:
--------------------------------------------------------------------------------
1 | # Overview of mbed OS
2 |
3 | mbed OS is the operating system we created for mbed-enabled boards. It allows your C++ applications to run on these boards by providing APIs that you can use from your application to control the hardware.
4 |
5 | ## Features
6 |
7 | We designed mbed OS specifically for constrained devices, so it works behind the scenes to automatically make the most of the limited hardware and network resources available:
8 |
9 | * It's modular: it has a code base that is common to all applications running on all hardware, and additional modules that extend functionality and create hardware-specific interfaces. The modules are only compiled if your application needs them; you don't need to waste memory on unused code.
10 |
11 | * It's single-threaded and event-driven, so you can use it even on small devices.
12 |
13 | * It abstracts the hardware, so that an application always "sees" the same interface, no matter which board it's running on. mbed OS then matches the interface to the actual hardware without you manually changing the code. This allows you to write the application once, then deploy it on any supported board. mbed OS also works seamlessly with peripherals and extension boards.
14 |
15 | * It efficiently manages power and schedules tasks, so that even demanding applications can operate on low-power devices.
16 |
17 | * It manages both device and communication security using mbed OS uVisor and mbed TLS, respectively.
18 |
19 | * It supports multiple networking options: Bluetooth Low Energy, Ethernet, WiFi (coming soon), Thread and 6LoWPAN.
20 |
21 | * It works with device management protocols - LWM2M and CoAP - so that you can perform large-scale remote updates.
22 |
23 | mbed OS also works with other ARM mbed tools, like our testing tool (Greentea) and mbed Device Server. To learn more about these tools, see the [main site](https://www.mbed.com/en/).
24 |
25 |
26 | ## Code base
27 |
28 | As explained above, mbed OS is modular. This section gives a short review of the main modules. Some of these will be reviewed in greater detail later.
29 |
30 | ### Core modules
31 |
32 | * [_compiler-polyfill_](https://github.com/ARMmbed/compiler-polyfill): Common compiler intrinsics and attributes made portable across toolchains.
33 |
34 | * [_core-util_](https://github.com/ARMmbed/core-util): Core data structures and primitives for the OS.
35 |
36 | * [_minar_](https://github.com/ARMmbed/minar): The mbed OS event scheduler.
37 |
38 | * [_ualloc_](https://github.com/ARMmbed/ualloc) and [_dlmalloc_](https://github.com/ARMmbed/dlmalloc): Memory allocation for mbed OS.
39 |
40 | * [_uvisor_](https://github.com/ARMmbed/uvisor): mbed OS uVisor is a supervisory kernel for security on mbed OS.
41 |
42 | ### Hardware abstraction and drivers
43 |
44 | * [_mbed-drivers_](https://github.com/ARMmbed/mbed-drivers): Abstract drivers for common hardware peripherals and communications interfaces such as SPI and I2C. Provides a higher level interface than the mbed HAL; these are the APIs that applications should use.
45 |
46 | * [_cmsis-core_](https://github.com/ARMmbed/cmsis-core): ARM's official low level hardware abstraction for Cortex-M.
47 |
48 | * [_mbed-hal_](https://github.com/ARMmbed/mbed-hal): The mbed Hardware Abstraction Layer (HAL).
49 |
50 | ### Networking and connectivity
51 |
52 | * [_ble_](https://github.com/ARMmbed/ble): APIs for using Bluetooth Low Energy.
53 |
54 | * [_mbed-mesh-api_](https://github.com/ARMmbed/mbed-mesh-api): APIs for initialising and using the mesh network.
55 |
56 | * [_mbedtls_](https://github.com/ARMmbed/mbedtls): mbed TLS, the SSL/TLS stack (including cryptographic and certificates handling functionality).
57 |
58 | * [_sal_](https://github.com/ARMmbed/sal): The mbed OS socket abstraction layer (SAL). Provides a common interface for networking stacks from ARM and partners.
59 |
60 | * [_sal-stack-nanostack_](https://github.com/ARMmbed/sal-stack-nanostack): Our IPv6/6LoWPAN stack.
61 |
62 | * [_sockets_](https://github.com/ARMmbed/sockets): High level portable socket layer (sitting on top of the SAL).
63 |
64 | ### mbed Client
65 |
66 | * [_mbed-client-c_](https://github.com/ARMmbed/mbed-client-c): Core library in C.
67 |
68 | * [_mbed-client_](https://github.com/ARMmbed/mbed-client): C++ API (use this one rather than the C one, as it's much easier to use correctly).
69 |
70 | * [_mbed-client-mbed-os_](https://github.com/ARMmbed/mbed-client-mbed-os): mbed OS-specific implementation for mbed Client.
71 |
72 | * [_mbed-client-mbedtls_](https://github.com/ARMmbed/mbed-client-mbed-tls): mbed TLS-specific implementation for mbed Client.
73 |
74 | ## mbed OS and yotta
75 |
76 | yotta is the build system we use for mbed OS. We'll get into the details of it [later](Full_Guide/app_on_yotta.md), but what you need to understand at this point is that mbed OS applications cannot be built without yotta.
77 |
78 | yotta combines our code (application) with the mbed OS code-base and any other module (reusable library) that we may need. To tell yotta what our application needs, we add a list of dependencies to each application we write. The easiest way to add mbed OS to our application when we build it is to describe the component ``mbed-drivers`` as a dependency of our application, because ``mbed-drivers`` has most other components as its own dependencies, so yotta will build what we need.
79 |
80 | **Tip:** Some components must be manually included; we'll tell you about that when we review them in this guide.
81 |
82 | What this all means is that to build applications that can run on top of mbed OS, you need:
83 |
84 | * yotta.
85 |
86 | * mbed OS modules and optional additional libraries, which yotta gets for you.
87 |
88 | * Your own application code.
89 |
90 |
91 | 
92 |
93 | **Note:** IDE support is not available yet. If you're interested in a particular IDE, talk to us on [the forum](http://forums.mbed.com).
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/Docs/docker_install.md:
--------------------------------------------------------------------------------
1 | # yotta in a Docker container
2 |
3 | Docker containers let you run an application such as yotta, with all of its dependencies (like Python), without installing anything directly on your machine. This protects you from version conflicts and other installation problems.
4 |
5 | We’ve built a yotta Docker container and a bash script (``yotta.sh``), which allows you to use the yotta Docker container to mimic a yotta installation on your system; yotta will be fully functional.
6 |
7 | ## Prerequisites
8 |
9 | [Please install Docker](https://www.docker.com/docker-toolbox).
10 |
11 | ## Installation
12 |
13 | 1. Start Docker.
14 |
15 | 1. In the prompt, run:
16 |
17 | docker pull mbed/yotta
18 |
19 | 1. Save the [yotta.sh script](https://github.com/ARMmbed/yotta-docker/blob/master/yotta.sh) on your computer. You’ll need to refer to its path when you use it in Docker later, so remember where it is.
20 |
21 | ## Using the yotta Docker and script to build projects
22 |
23 | There is one difference between a regular installation and a Docker Container: in Docker, you have to precede each yotta command with the path to the bash script you saved in the previous section. For example:
24 |
25 | ```shell
26 | ..//yotta.sh target frdm-k64f-gcc //sets the target
27 | ..//yotta.sh build //builds our project
28 | ```
29 |
30 | **Note:** If you saved your script under a name other than ```yotta.sh```, you may need to enter the script’s full name, including extension. Our example will become ``..// target frdm-k64f-gcc``.
31 |
32 | If you want to use yotta commands without specifying the full path to the script, you can add the yotta script’s path to your system’s ```path``` variable (Windows) or create a symbolic link (symlink) to your bin directory (Linux and Mac OS X). For example, to create a symlink:
33 |
34 | ```
35 | ln -s /usr/local/bin/yotta
36 | ```
37 |
38 | Now you can use yotta directly:
39 |
40 | ```
41 | git clone
42 | cd
43 | yotta target frdm-k64f-gcc
44 | yotta build
45 | ```
46 |
47 | ## Open Source
48 |
49 | The yotta Docker image is open source, so [feel free to fork it](https://github.com/ARMmbed/yotta-docker).
50 |
--------------------------------------------------------------------------------
/Docs/index.md:
--------------------------------------------------------------------------------
1 | # The mbed OS 3 User Guide
2 |
3 | Welcome to the ARM® mbed™ OS 3 user guide.
4 |
5 | For mbed OS 5, please [see here](https://docs.mbed.com/docs/mbed-os-handbook/en/5.1/).
6 |
7 | ## Getting started
8 |
9 | * [Set up your machine](installation.md): Installing yotta, the build tool for mbed OS.
10 |
11 | * [Build your first mbed OS application](FirstProjectmbedOS.md): A simple example to get you going.
12 |
13 | * [Extend the first application](Extended_LED.md) and review [other samples](GetTheCode).
14 |
15 | * [Learn about mbed OS](about_mbed_os.md): A quick review of mbed OS features and code base, as well as its use of yotta.
16 |
17 | ## Applications on mbed OS
18 |
19 | A general review of how to write applications for mbed OS:
20 |
21 | * [mbed OS applications with yotta](Full_Guide/app_on_yotta.md): The relationship between yotta and mbed OS, and how you can create yotta-based mbed OS applications.
22 |
23 | * [Writing applications for mbed OS](Full_Guide/app_on_mbed_os.md): Some general principles of mbed OS applications.
24 |
25 | ## mbed OS features
26 |
27 | These chapters explain how to work with the various mbed OS features:
28 |
29 | * [Interfacing to hardware](Full_Guide/Interfacing.md): How mbed OS controls different hardware.
30 |
31 | * [Debugging mbed OS applications](Full_Guide/Debugging.md): Debugging for applications built with ARMCC and GCC.
32 |
33 | * [Security with mbed TLS](Full_Guide/mbed_tls.md): Using mbed TLS for communication security in mbed OS.
34 |
35 | * [Asynchronous programming with MINAR](Full_Guide/MINAR.md): Using the mbed OS schedular MINAR for asynchronous programming.
36 |
37 | * [Memory in mbed OS](Full_Guide/memory.md): Memory management and allocation in mbed OS.
38 |
39 | * [Networking with mbed OS](Full_Guide/networking.md): Networking options and structure on mbed OS.
40 |
41 | * [Asynchronous I2C](Full_Guide/I2C.md): Two-wire serial bus protocol on mbed OS.
42 |
43 | ## Contributing to mbed OS and publishing modules
44 |
45 | * [Creating and publishing your own modules and contributing to mbed OS](Full_Guide/contributing.md): The process and legal requirements for publishing modules as stand-alone or as part of the mbed OS code base.
46 |
47 | * [Coding style and GitHub pull request guidelines](Full_Guide/Code_Style.md): Style guidelines for code and GitHub pull requests.
48 |
49 | ## What you need to know before reading the guide
50 |
51 | This guide assumes that you are familiar with C++. While we do discuss how we applied some concepts in mbed OS, we don't explain the background to these concepts in any great detail. If you know C but not C++, you might find this [Coursera module](https://www.coursera.org/course/cplusplus4c) helpful.
52 |
53 | The examples in this guide focus on the FRDM-K64F board. If you have another board, you'll have to check if it's already [supported on mbed OS](https://www.mbed.com/en/development/hardware/boards/) before you run the sample code. You should be able to follow the code and explanations even if you don't have compatible hardware.
54 |
55 | ### Additional sources
56 |
57 | * [Further reading sources](FurtherReading.md): other mbed tools, hardware, community and partners.
58 |
59 | * Links to [our main code repositories and their documentation, as well as examples](GetTheCode.md).
60 |
61 | **Tip:** For more details about mbed, [see our main site](http://mbed.com/en/about-mbed/what-mbed/).
62 |
63 |
64 |
--------------------------------------------------------------------------------
/Docs/installation.md:
--------------------------------------------------------------------------------
1 | # Installing mbed OS and yotta
2 |
3 | For mbed OS 5, please [see here](https://docs.mbed.com/docs/mbed-os-handbook/).
4 |
5 | Like many open source operating systems, mbed OS is distributed as source code. You use yotta to fetch all the modules that you require to build for your hardware. Once you’ve done that, yotta works as an offline build tool that combines mbed OS and your application code into a single executable. All this means that you don't install mbed OS on your computer - you simply install yotta, and let it work for you.
6 |
7 | There are three ways to install yotta:
8 |
9 | * [Our installers](#installers), which include the yotta dependencies.
10 |
11 | * [A Docker container](#docker-container), which includes the yotta dependencies.
12 |
13 | * [Manual installation](#manual-installation) of yotta and all its dependencies.
14 |
15 | ## Installers
16 |
17 | yotta has installers for OS X and Windows. They include an installation of all yotta dependencies.
18 |
19 | ### OS X installer
20 |
21 | 1. Download the latest [OS X yotta.app](https://www.mbed.com/en/development/software/mbed-yotta/#Installing_yotta).
22 |
23 | 1. Drag ``yotta.app`` from the disk image into your Applications folder.
24 |
25 | 1. When you run ``yotta.app``, it opens a terminal where you can use yotta commands.
26 |
27 | ### Windows installer
28 |
29 | 1. Download the latest [yotta Windows installer](https://www.mbed.com/en/development/software/mbed-yotta/#Installing_yotta).
30 |
31 | 1. Run the installer.
32 |
33 | 1. Click the ``Run Yotta`` shortcut on the desktop or in the start menu to run a session with the yotta path temporarily pre-pended to system path.
34 |
35 | ## Docker container
36 |
37 | [See the Docker container instructions](docker_install.md).
38 |
39 | ## Manual installation
40 |
41 | If you want to manually install yotta, please ensure you have your dependencies, then follow the instructions for your operating system.
42 |
43 | ### Dependencies
44 |
45 | Before installing yotta, make sure you have:
46 |
47 | * [Python 2.7](https://www.python.org/download/releases/2.7/). Python 3 support is experimental.
48 |
49 | * [pip](https://pypi.python.org/pypi/pip).
50 |
51 | ### Manual installation instructions
52 |
53 | * [OS X](http://yottadocs.mbed.com/#installing-on-osx).
54 |
55 | * [Windows](http://yottadocs.mbed.com/#installing-on-windows).
56 |
57 | * [Linux](http://yottadocs.mbed.com/#installing-on-linux).
58 |
59 | ## What's next?
60 |
61 | Try the [Blinky quick guide](FirstProjectmbedOS.md) to get a first sample application working, or see the [full list of samples](GetTheCode.md).
62 |
63 | You can also read the [full guide](Full_Guide/app_on_yotta.md) to understand how mbed OS and yotta work together.
64 |
--------------------------------------------------------------------------------
/mkdocs.yml:
--------------------------------------------------------------------------------
1 | site_name: mbed OS 3.0 Guides
2 |
3 | docs_dir: Docs
4 |
5 | pages:
6 | - ['index.md','Welcome to the mbed OS 3.0 User Guides']
7 | - ['about_mbed_os.md','Overview of mbed OS 3.0']
8 | - ['installation.md', 'Getting Started', 'Installation']
9 | - ['FirstProjectmbedOS.md', 'Getting Started', 'Blinky - your first application']
10 | - ['Extended_LED.md', 'Getting Started', 'Extending Blinky']
11 | - ['GetTheCode.md', 'Getting Started', 'Additional examples and code']
12 | - ['Full_Guide/app_on_yotta.md', 'Applications on mbed OS', 'mbed OS applications with yotta']
13 | - ['Full_Guide/app_on_mbed_os.md', 'Applications on mbed OS', 'Writing applications for mbed OS']
14 | - ['Full_Guide/Interfacing.md', 'mbed OS features', 'Interfacing to hardware']
15 | - ['Full_Guide/Debugging.md', 'mbed OS features', 'Debugging mbed OS applications']
16 | - ['Full_Guide/mbed_tls.md', 'mbed OS features', 'Security with mbed TLS']
17 | - ['Full_Guide/MINAR.md', 'mbed OS features', 'Asynchronous programming with MINAR']
18 | - ['Full_Guide/memory.md', 'mbed OS features', 'Memory in mbed OS']
19 | - ['Full_Guide/networking.md', 'mbed OS features', 'Networking in mbed OS']
20 | - ['Full_Guide/I2C.md', 'mbed OS features', 'Asynchronous I2C']
21 | - ['Full_Guide/contributing.md', 'Contributing and publishing', 'Module publishing guidelines']
22 | - ['Full_Guide/Code_Style.md', 'Contributing and publishing', 'Code style and GitHub']
23 | - ['FurtherReading.md', 'Additional Resources', 'Further reading']
24 |
25 |
--------------------------------------------------------------------------------