-
Notifications
You must be signed in to change notification settings - Fork 2.1k
pkg/openthread: rework of FTD and MTD support #9336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2bf6d01
pkg/openthread: add FTD and NCP support
jia200x 74ec336
pkg/openthread: move dependencies to pkg Makefile.dep
jia200x b75ffb9
examples/openthread: move test to examples
jia200x 3a96652
pkg/openthread: replace sed by patch
jia200x 6541678
pkg/openthread: adapt to newer stdio uart header file
jia200x 0ea488e
examples/openthread: remove xtimer dependency
jia200x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| APPLICATION = openthread | ||
|
|
||
| # If no BOARD is found in the environment, use this default: | ||
| BOARD ?= samr21-xpro | ||
|
|
||
| # These are the boards that OpenThread stack has been tested on | ||
| BOARD_WHITELIST := samr21-xpro iotlab-m3 fox iotlab-a8-m3 | ||
|
|
||
| # This has to be the absolute path to the RIOT base directory: | ||
| RIOTBASE ?= $(CURDIR)/../.. | ||
|
|
||
| # Change this to 0 show compiler invocation lines by default: | ||
| QUIET ?= 1 | ||
|
|
||
| USEPKG += openthread | ||
| OPENTHREAD_TYPE ?= ftd | ||
| ifeq ($(OPENTHREAD_TYPE),mtd) | ||
| # MTD: A Minimal Thread Device does not have router functionality | ||
| # compiled in. As a result, it is not necessary to configure the | ||
| # routerrole on an MTD. At the same time, an MTD may or may not be sleepy. | ||
| USEMODULE += openthread-mtd | ||
| USEMODULE += openthread-cli-mtd | ||
| else | ||
| # ftd: A Full Thread Device has router functionality compiled in | ||
| USEMODULE += openthread-ftd | ||
| USEMODULE += openthread-cli-ftd | ||
| endif | ||
|
|
||
| #Define PANID, CHANNEL and UART_BAUDRATE used by default | ||
| OPENTHREAD_PANID ?= 0xbeef | ||
| OPENTHREAD_CHANNEL ?= 26 | ||
|
|
||
| CFLAGS += -DOPENTHREAD_PANID=$(OPENTHREAD_PANID) | ||
| CFLAGS += -DOPENTHREAD_CHANNEL=$(OPENTHREAD_CHANNEL) | ||
|
|
||
| ifneq (,$(filter samr21-xpro,$(BOARD))) | ||
| DRIVER := at86rf233 | ||
| endif | ||
| ifneq (,$(filter iotlab-m3 fox iotlab-a8-m3,$(BOARD))) | ||
| DRIVER := at86rf231 | ||
| endif | ||
|
|
||
| USEMODULE += $(DRIVER) | ||
|
|
||
| USEMODULE += random | ||
| USEMODULE += ps | ||
|
|
||
| #required for C++ compiling | ||
| CXXEXFLAGS += -fno-rtti | ||
| USEMODULE += cpp11-compat | ||
|
|
||
| include $(RIOTBASE)/Makefile.include |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| ## OpenThread on RIOT | ||
|
|
||
| This example demonstrates how to use the [OpenThread](https://github.com/openthread/openthread) | ||
| open source implementation of [Thread](https://threadgroup.org/) on RIOT. | ||
|
|
||
| The [Command Line Interface](https://github.com/openthread/openthread/blob/master/examples/apps/cli/README.md) of | ||
| OpenThread was ported. Please check the | ||
| [full documentation](https://github.com/openthread/openthread/blob/master/src/cli/README.md) | ||
| of the CLI for usage information. | ||
|
|
||
| You can either build a FTD or MTD firmware: | ||
| - MTD: A Minimal Thread Device does not have router functionality compiled in. | ||
| An MTD may or may not be sleepy. | ||
| - FTD: A Full Thread Device has router functionality compiled in. | ||
|
|
||
| ## Quick usage | ||
|
|
||
| With RIOT port, a node is auto-setup and ready to communicate with | ||
| this configuration: | ||
| ``` | ||
| OPENTHREAD_PANID=0xbeef | ||
| OPENTHREAD_CHANNEL=26 | ||
| ``` | ||
|
|
||
| You can pass the panid/channel independently when building the firmware: | ||
| ``` | ||
| make BOARD=<target> OPENTHREAD_PANID=0xaaaa OPENTHREAD_TYPE=ftd flash term | ||
| ``` | ||
| ``` | ||
| make BOARD=<target> OPENTHREAD_CHANNEL=20 OPENTHREAD_TYPE=ftd flash term | ||
| ``` | ||
|
|
||
| To try OpenThread in RIOT, you can do the following: | ||
|
|
||
| 1. Flash nodes with MTD or FTD functionality: | ||
| ``` | ||
| make BOARD=<target> clean all flash OPENTHREAD_TYPE=mtd | ||
| ``` | ||
| ``` | ||
| make BOARD=<target> clean all flash OPENTHREAD_TYPE=ftd | ||
| ``` | ||
|
|
||
| 2. Check the state of the node with `state`. In the beginning, it should be | ||
| `detached`, but after some seconds it should become `leader` | ||
|
|
||
| 3. Start another node and check that it becomes `router`. There is only one | ||
| leader in a Thread network. | ||
|
|
||
| 4. Get the mesh IP address of a node with `ipaddr`. | ||
| ``` | ||
| ipaddr | ||
| fdde:ad00:beef::ff:fe00:8000 | ||
| fe80::ff:fe00:8000 | ||
| fdde:ad00:beef:0:946a:c722:a5d9:8481 | ||
| fe80::3984:f4eb:d182:5dae | ||
| ``` | ||
| 5. Ping from another node with | ||
| ``` | ||
| ping fdde:ad00:beef:0:946a:c722:a5d9:848 | ||
| ``` | ||
|
|
||
| 6. You can try IEEE802.15.4 scan with `scan` command | ||
|
|
||
| 7. You can also check other commands with `help` | ||
|
|
||
|
|
||
| ## OpenThread port on RIOT status | ||
|
|
||
| OpenThread port on RIOT is stable. In case of any bug, please report via | ||
| [GitHub issue](https://github.com/RIOT-OS/RIOT/issues/new?template=bug_report.md&title=Bug). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| ifneq (,$(filter openthread,$(USEPKG))) | ||
| USEMODULE += openthread_contrib | ||
| USEMODULE += mbedcrypto | ||
| endif | ||
|
|
||
| ifneq (,$(filter openthread_contrib,$(USEMODULE))) | ||
| USEMODULE += openthread_contrib_netdev | ||
| USEMODULE += xtimer | ||
| FEATURES_REQUIRED += cpp | ||
| endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not keep the openthread shell ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the OpenThread shell. The flow is
OpenThread Core <-> Openthread CLI <-> UARTThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes but here it's removed, so how can the OT shell be used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I see what you mean. Now there's no "openthread_uart_run" simulator. It directly handles UART at interrupt level in the file platform_uart.c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, got it now !