Skip to content

openthread: add support for radios compatible with SubMAC#14979

Merged
benpicco merged 3 commits into
RIOT-OS:masterfrom
jia200x:pr/openthread/cc2538_rf
Oct 22, 2020
Merged

openthread: add support for radios compatible with SubMAC#14979
benpicco merged 3 commits into
RIOT-OS:masterfrom
jia200x:pr/openthread/cc2538_rf

Conversation

@jia200x

@jia200x jia200x commented Sep 8, 2020

Copy link
Copy Markdown
Member

Contribution description

This PR adds OpenThread support for the radios compatible with the SubMAC
This work requires the netdev_ieee802154_submac_t interface of IEEE 802.15.4 SubMAC (#14950 ) to work.

This acts as a showcase for the IEEE 802.15.4 Radio HAL and SubMAC, since all APIs are hardware independent now. Thus, it's possible to transparently integrate OpenThread with any radio that implements the IEEE 802.15.4 Radio HAL.

In the future, we could drop the netdev_ieee802154_submac_t interface and implement the platform abstraction directly on top of the Radio HAL or SubMAC.

Testing procedure

Run make -C examples/openthread with any CC2538 based board (e.g remote-revb).

Issues/PRs references

Now this depends on #15237
#10045
#13376

@jia200x jia200x added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: pkg Area: External package ports State: waiting for other PR State: The PR requires another PR to be merged first labels Sep 8, 2020
@jia200x jia200x requested a review from aabadie September 8, 2020 13:28
@benpicco

benpicco commented Oct 2, 2020

Copy link
Copy Markdown
Contributor

Needs a rebase now 😃
Also the title is confusing. This should not have much to do with CC2538.

@benpicco benpicco removed the State: waiting for other PR State: The PR requires another PR to be merged first label Oct 2, 2020
@jia200x

jia200x commented Oct 2, 2020

Copy link
Copy Markdown
Member Author

Also the title is confusing. This should not have much to do with CC2538.

Yes, you are right. It was just because it was the only radio available at that time

@jia200x jia200x force-pushed the pr/openthread/cc2538_rf branch from 47d97e0 to 4ce7a84 Compare October 16, 2020 15:15
@jia200x jia200x requested a review from bergzand as a code owner October 16, 2020 15:15
@jia200x jia200x requested a review from a user October 16, 2020 15:15
@jia200x jia200x changed the title openthread/cc2538_rf: add support for CC2538 radios openthread: add support for radios compatible with SubMAC Oct 16, 2020
@jia200x

jia200x commented Oct 16, 2020

Copy link
Copy Markdown
Member Author

Done. I also updated the title to reflect the changes.

@jia200x jia200x added the State: waiting for other PR State: The PR requires another PR to be merged first label Oct 16, 2020
@benpicco benpicco removed the State: waiting for other PR State: The PR requires another PR to be merged first label Oct 20, 2020

@benpicco benpicco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a simple addition now - please rebase

Comment thread pkg/openthread/Makefile.dep Outdated
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 20, 2020
@jia200x jia200x force-pushed the pr/openthread/cc2538_rf branch from 4ce7a84 to 2b04a14 Compare October 21, 2020 09:17
@jia200x

jia200x commented Oct 21, 2020

Copy link
Copy Markdown
Member Author

done!

@aabadie

aabadie commented Oct 21, 2020

Copy link
Copy Markdown
Contributor

openthread will only work on boards that use uart as stdio. Some nrf52840 based boards (adafruit-clue at least) uses USB CDC ACM as stdio. Is it possible to use stdio_write instead of uart_write in the openthread port ? That could solve that issue.

@aabadie

aabadie commented Oct 21, 2020

Copy link
Copy Markdown
Contributor

For example, it's not possible to build examples/openthread on adafruit-clue with the current state of this PR:

Details
BUILD_IN_DOCKER=1 make BOARD=adafruit-clue -C examples/openthread --no-print-directory 
Launching build container using image "riot/riotbuild:latest".
docker run --rm --tty --user $(id -u) -v '/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro' -v '/work/riot/RIOT:/data/riotbuild/riotbase:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -e 'BUILD_DIR=/data/riotbuild/riotbase/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'      -e 'BOARD=adafruit-clue'  -w '/data/riotbuild/riotbase/examples/openthread/' 'riot/riotbuild:latest' make 'BOARD=adafruit-clue'    
Building application "openthread" for "adafruit-clue" with MCU "nrf52".

"make" -C /data/riotbuild/riotbase/pkg/openthread
"make" -C /data/riotbuild/riotbase/boards/adafruit-clue
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/cpu/nrf52
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common
"make" -C /data/riotbuild/riotbase/cpu/cortexm_common/periph
"make" -C /data/riotbuild/riotbase/cpu/nrf52/periph
"make" -C /data/riotbuild/riotbase/cpu/nrf52/radio/nrf802154
"make" -C /data/riotbuild/riotbase/cpu/nrf52/vectors
"make" -C /data/riotbuild/riotbase/cpu/nrf5x_common
"make" -C /data/riotbuild/riotbase/cpu/nrf5x_common/periph
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/netdev
"make" -C /data/riotbuild/riotbase/drivers/netdev_ieee802154_submac
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/pkg/openthread/contrib
"make" -C /data/riotbuild/riotbase/pkg/openthread/contrib/netdev
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/auto_init/usb
"make" -C /data/riotbuild/riotbase/sys/cpp11-compat
"make" -C /data/riotbuild/riotbase/sys/div
"make" -C /data/riotbuild/riotbase/sys/event
"make" -C /data/riotbuild/riotbase/sys/isrpipe
"make" -C /data/riotbuild/riotbase/sys/luid
"make" -C /data/riotbuild/riotbase/sys/net/link_layer/eui_provider
"make" -C /data/riotbuild/riotbase/sys/net/link_layer/ieee802154
"make" -C /data/riotbuild/riotbase/sys/net/link_layer/l2util
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/ps
"make" -C /data/riotbuild/riotbase/sys/random
"make" -C /data/riotbuild/riotbase/sys/random/tinymt32
"make" -C /data/riotbuild/riotbase/sys/timex
"make" -C /data/riotbuild/riotbase/sys/tsrb
"make" -C /data/riotbuild/riotbase/sys/usb/usbus
"make" -C /data/riotbuild/riotbase/sys/usb/usbus/cdc/acm
"make" -C /data/riotbuild/riotbase/sys/usb_board_reset
"make" -C /data/riotbuild/riotbase/sys/xtimer
/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /data/riotbuild/riotbase/examples/openthread/bin/adafruit-clue/openthread_contrib/platform_uart.o: in function `otPlatUartEnable':
/data/riotbuild/riotbase/pkg/openthread/contrib/platform_uart.c:83: undefined reference to `uart_init'
/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /data/riotbuild/riotbase/examples/openthread/bin/adafruit-clue/openthread_contrib/platform_uart.o: in function `otPlatUartSend':
/data/riotbuild/riotbase/pkg/openthread/contrib/platform_uart.c:97: undefined reference to `uart_write'
collect2: error: ld returned 1 exit status
/data/riotbuild/riotbase/Makefile.include:594: recipe for target '/data/riotbuild/riotbase/examples/openthread/bin/adafruit-clue/openthread.elf' failed
make: *** [/data/riotbuild/riotbase/examples/openthread/bin/adafruit-clue/openthread.elf] Error 1

@jia200x

jia200x commented Oct 21, 2020

Copy link
Copy Markdown
Member Author

openthread will only work on boards that use uart as stdio. Some nrf52840 based boards (adafruit-clue at least) uses USB CDC ACM as stdio. Is it possible to use stdio_write instead of uart_write in the openthread port ? That could solve that issue.

Yes! That should be possible. I will check

@jia200x

jia200x commented Oct 21, 2020

Copy link
Copy Markdown
Member Author

Yes! That should be possible. I will check

Would it be OK if I remove those boards and then adapt OpenThread for such changes? Since it involves stuff with the contrib files

@benpicco

Copy link
Copy Markdown
Contributor

Would it be OK if I remove those boards and then adapt OpenThread for such changes? Since it involves stuff with the contrib files

Just make a separate PR for it, we could probably merge that quick.

Comment thread examples/openthread/Makefile Outdated
Comment thread examples/openthread/Makefile Outdated
@aabadie

aabadie commented Oct 21, 2020

Copy link
Copy Markdown
Contributor

Just make a separate PR for it, we could probably merge that quick.

No need for a separate PR, the boards are whitelisted by this one so they should just be removed from the white list here.

@jia200x

jia200x commented Oct 21, 2020

Copy link
Copy Markdown
Member Author

done!

@aabadie

aabadie commented Oct 21, 2020

Copy link
Copy Markdown
Contributor

But it would be nice to have a follow-up PR that improves the situation with openthread + stdio on USB CDC ACM and enables them.

@benpicco

Copy link
Copy Markdown
Contributor

Feel free to squash.

@jia200x

jia200x commented Oct 21, 2020

Copy link
Copy Markdown
Member Author

done!

@jia200x jia200x force-pushed the pr/openthread/cc2538_rf branch from fdb49e9 to 6f70934 Compare October 21, 2020 12:50
Comment thread pkg/openthread/Makefile.dep Outdated
@jia200x

jia200x commented Oct 21, 2020

Copy link
Copy Markdown
Member Author

done!

@jia200x jia200x force-pushed the pr/openthread/cc2538_rf branch from 6f70934 to 8b689d6 Compare October 21, 2020 15:42
@benpicco

Copy link
Copy Markdown
Contributor

Murdock is not happy

@jia200x jia200x force-pushed the pr/openthread/cc2538_rf branch from 8b689d6 to e8489a3 Compare October 22, 2020 08:33
@jia200x

jia200x commented Oct 22, 2020

Copy link
Copy Markdown
Member Author

I added an extra commit to add netdev_default in openthread/examples (see edc4d1d). Someone has to pull the radio anyway.

@aabadie

aabadie commented Oct 22, 2020

Copy link
Copy Markdown
Contributor

I added an extra commit to add netdev_default in openthread/examples

Why in the application and not in the package ? Since OpenThread is network stack that lives directly on top of interfaces, that would make more sense and simplify the application Makefile.

@benpicco

benpicco commented Oct 22, 2020

Copy link
Copy Markdown
Contributor

netdev_default just says you want the default netdev for a board.
If you have a different radio connected to your board or want to try a different driver you would remove that and replace it with your other radio driver. (e.g. esp32 has esp_now as the default netdev, but but you might want to wire up a 802.15.4 radio and only use esp_wifi)

That's how examples/gnrc_networking does it too (and grep netdev_default examples/*/Makefile shows it's not the only one)
Yea that's gnrc_netdev_default, but that will just do

ifneq (,$(filter gnrc_netdev_default,$(USEMODULE)))
  USEMODULE += netdev_default
  USEMODULE += gnrc_netif
endif

Comment thread examples/openthread/Makefile Outdated
Comment thread examples/openthread/Makefile Outdated
@jia200x jia200x force-pushed the pr/openthread/cc2538_rf branch from e8489a3 to 383e1b1 Compare October 22, 2020 14:57
@benpicco benpicco merged commit d078488 into RIOT-OS:master Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants