Compare commits

...

291 Commits

Author SHA1 Message Date
Yakun Xu 677d49b42e [posix-app] platform UDP (#3070)
This commit defines a set of platform APIs to integrate UDP layer of
OpenThread with that of the platform.

With this commit, services and applications developed upon OpenThread can
also be accessed through platform's own network interface, e.g. socket() on
POSIX.
2018-10-14 11:08:35 -07:00
Yakun Xu 8e7dba9e4a [posix-app] fix set radio spinel speed (#3157) 2018-10-14 10:59:23 -07:00
Abtin Keshavarzian 12fab0b98e [posix-app] exit on untimely RCP crash/reset (#3154) 2018-10-14 06:38:21 -07:00
Stuart Longland 7f6ecce258 [spinel] do not use glibc-internal header sys/cdefs.h (#3153)
The `sys/cdefs.h` is an internal header of `glibc` and is not meant to
be used by user code.  The macros needed from it can be trivially
implemented where required, relying on this header being present
excludes OpenThread from being used on systems where `glibc` is not the
used C library (e.g. OpenWRT, where `uclibc` or `musl` is standard).

https://wiki.musl-libc.org/faq.html#Q:-When-compiling-something-against-musl,-I-get-error-messages-about-%3Ccode%3Esys/cdefs.h%3C/code%3E
2018-10-14 06:36:26 -07:00
Abtin Keshavarzian 9bf8d8169a [mesh-forwarder] add log for retry attempts of indirect tx to sleepy nodes (#3151) 2018-10-12 22:19:06 -07:00
Yakun Xu 3ef4641b36 [posix-app] verify radio capabilities (#3148) 2018-10-12 22:18:20 -07:00
Abtin Keshavarzian 3c88ba28fb [docs] specify seconds as the unit for child timeout value (#3145) 2018-10-12 22:16:36 -07:00
rongli 4c470d7eea [doc] add note for 'parent' command (#3142) 2018-10-12 22:16:16 -07:00
Jonathan Hui 868934b114 [dtls] include server only with commissioner or coaps (#3139) 2018-10-12 22:13:08 -07:00
Yakun Xu 98457ea65e [posix-app] always reset radio when init (#3149) 2018-10-12 13:19:08 -07:00
Jonathan Hui d64b889f52 [travis] add python3 to continuous integration (#3146) 2018-10-12 11:10:18 -07:00
Jonathan Hui 22dd0e0f7d [tests] add python3 support (#3146) 2018-10-12 11:10:18 -07:00
Jing a2865b57a2 [thci] fix channel mask format issue in wpanctl commissioner command (#3150) 2018-10-12 10:53:21 -07:00
Abtin Keshavarzian e6df05b7eb [posix-app] check spinel version of RCP from RaioSpinel::Init() (#3141) 2018-10-12 10:41:17 -07:00
Abtin Keshavarzian 7c8a37263b [posix-app] get RCP (NCP in radio mode) version (#3140)
This commit contains the following changes:

- It adds `otPlatRadioGetVersionString()` as an optional radio
  platform API. If the radio platform does not implement this
  function, OpenThread core provides a default weak implementation
  of this function which return the OpenThread version.

- A public OpenThread API `otGetRadioVersionString()` is added which
  provides the radio version string.

- POSIX App is updated to get the version from its RCP and provide
  `otPlatRadioGetVersionString()`

- A new spinel capability `SPINEL_CAP_POSIX_APP` is added which
  corresponds to `ENABLE_POSIX_APP` configuration.

- A new spinel property `SPINEL_PROP_RCP_VERSION` (only available
  in POSIX_APP) is added which gets the RCP version.
2018-10-12 10:40:57 -07:00
Yakun Xu 2457aa1864 [posix-app] remove dependency on stty (#3138) 2018-10-12 10:39:14 -07:00
Abtin Keshavarzian 467ab24e9b [mesh-forwarder] update indirect message logs (#3135)
This commit makes the following changes in `MeshForwarder`:

- It separates the logging of sent direct and indirect messages,
  ensuring that for indirect messages the status (success/failure)
  is logged after all retry attempts.

- It updates the log message (status of transmission) for a larger
  message requiring fragmentation and multiple frame transmissions
  when `CONFIG_DROP_MESSAGE_ON_FRAGMENT_TX_FAILURE` is not enabled.

- It fixes managing of `IpCounters` to only account for messages
  with type `kTypeIp6`.
2018-10-11 10:07:11 -07:00
Jonathan Hui 739842d168 [travis] update to gcc-arm-none-eabi-7-2018-q2-update (#3134) 2018-10-11 10:06:11 -07:00
Yakun Xu 9ae76c1c67 [core] remove dependency on libstdc++ (#3130) 2018-10-11 10:05:51 -07:00
Zhanglong Xia 8e35bf1db8 [qos] reverse message priority level values (#3132) 2018-10-10 23:06:33 -07:00
Abtin Keshavarzian db3aa113cb [toranj] test-case to check child mode change and parent reset recovery (#3129) 2018-10-10 12:43:13 -07:00
Abtin Keshavarzian c5d611a366 [mle] save child info in settings on mode or timeout change (#3129)
This commit changes `MleRouter::HandleChildUpdateRequest()`:

- If the child entry is modified (i.e., timeout value or
  device mode changes) on an already attached child, the child
  info is updated and saved in the non-volatile settings.
  This ensures that after a parent reset the child can be
  recovered correctly.

- If the "Child Update Request" causes a mode change from rx-on
  to sleepy on a child in `kStateValid` (already attached), the
  source match controller is set to perform source address
  matching on the short address.

- This commit also adds a log to indicate mode change of a
  child.
2018-10-10 12:43:13 -07:00
Jeff Bumgardner e3a82139e3 [nrf52840] fix typo in log parameter (#3136) 2018-10-09 14:50:38 -07:00
Yakun Xu cddfda34cc [posix-app] map log level with syslog (#3133) 2018-10-09 11:15:00 -07:00
Yakun Xu 12171a1270 [meshcop] do not set joiner port in constructor (#3131) 2018-10-09 11:14:00 -07:00
Yakun Xu 2af44beb74 [posix-app] simplify saving settings (#3108) 2018-10-09 11:12:56 -07:00
rongli 5db4b0e295 [core] update first parent request with only R flag during downgrade (#3084)
This commit distinguishes the attach same process during downgrade from
the one caused by losing connectivity as for the former downgrade
scenario, there must be enough active routers to provide connectivity,
and additional benefits is to avoid the impact of possible flooding parent
responses if there are lots of REEDs in large scale thread network.
2018-10-09 10:55:51 -07:00
Jonathan Hui 2dea42cea6 [dhcp6] add dhcp6 server support to NCP (#3128) 2018-10-08 15:42:11 -07:00
Abtin Keshavarzian 461b1aec64 [toranj] adding test-026 for addition/removal of SLAAC IPv6 address (#3111) 2018-10-08 15:41:46 -07:00
Jonathan Hui 6282fcdeb0 [dtls] remove unnecessary member variable mClient (#3127) 2018-10-08 11:04:49 -07:00
Jonathan Hui a5dc13e3be [mbedtls] simplify config file (#3126) 2018-10-08 09:24:43 -07:00
Yakun Xu 92b9746787 [cli] fix initializing coap secure response (#3125) 2018-10-08 09:24:11 -07:00
Jonathan Hui b213628fd6 [travis] update to clang-6.0 (#3122) 2018-10-08 09:23:47 -07:00
Jonathan Hui 2f01fcc8d2 [configure] fix typo (#3121) 2018-10-08 09:23:36 -07:00
Abtin Keshavarzian ad3ea71c59 [posix-app] rename global variable to gNodeId (#3118)
This commit renames `NODE_ID` to `gNodeId` in posix app and  posix
platform example code. It also ensures to use correct encoding (byte
order) to calculate the `gNodeId` (as `uint64_t`) in posix app.
2018-10-08 09:23:13 -07:00
Abtin Keshavarzian 67f3880165 [spinel] add and use new capability NET_THREAD_1_1 (#3124) 2018-10-05 00:59:16 -07:00
Yakun Xu 3ac958441e [meshcop] add commissioner aloc (#3123) 2018-10-05 00:58:19 -07:00
Abtin Keshavarzian 94ac42eec9 [docs] fixing typos in comments/docs (#3120) 2018-10-05 00:56:55 -07:00
Abtin Keshavarzian abe64591c7 [posix-app] update the logging implementation (#3119) 2018-10-05 00:56:26 -07:00
Abtin Keshavarzian b8cfaa3afa [posix-app] remove unused global variables in system.c (#3117) 2018-10-03 23:22:35 -07:00
Abtin Keshavarzian 0c72bc426c [posix-app] remove unused debug_uart source file (#3115) 2018-10-03 23:21:53 -07:00
Abtin Keshavarzian d640d4a7f9 [link-raw] move the LinkRaw implementation to core from api folder (#3114) 2018-10-03 23:21:12 -07:00
rongli 97aafadf2c [thci] fix warning when set downgrade threshold for ncp device (#3113) 2018-10-03 23:20:24 -07:00
Jonathan Hui 1b200be545 [thci] fix IPv6 prefix format (#3116) 2018-10-02 23:12:38 -07:00
rongli 9f55322d36 [thci] fix preferred flag when config border router (#3112) 2018-10-02 02:34:58 -07:00
Jing a97b0c02af [thci] wpanctl thci firmeware validation and modify getGUA according to GRL change (#3106) 2018-10-01 23:52:06 -07:00
Jeff Bumgardner 3b3cca230a [docs] minor Doxygen fixes (#3110) 2018-10-01 23:13:41 -07:00
Jeff Bumgardner 1c9ddd8c15 [docs] update Windows 10 README (#3107) 2018-09-28 13:51:49 -07:00
Jonathan Hui 1ba69deb30 [coaps] add functional tests for psk and x509 (#3096) 2018-09-27 15:15:08 -07:00
Jonathan Hui 696a9441a9 [coaps] include coaps in make dist (#3096) 2018-09-27 15:15:08 -07:00
Abtin Keshavarzian 473c009879 [toranj] relax wpan state transition checks in test-100-mcu-power-state (#3103) 2018-09-27 13:35:53 -07:00
Yakun Xu eb2737189a [posix] add baudrate configuration for POSIX simulation (#3105) 2018-09-27 09:34:18 -07:00
Yakun Xu 2314a5603e [travis] fix typo of disable tests (#3104) 2018-09-27 09:33:40 -07:00
Jonathan Hui 5a489836cd [naming] rename FFD to FTD (#3102) 2018-09-27 09:33:03 -07:00
Abtin Keshavarzian 5e42a40911 [network-data] add MatchMode enumeration for how RLOC16 are matched (#3098) 2018-09-27 09:16:02 -07:00
Abtin Keshavarzian 00cac8002b [spinel] add spinel_command_to_cstr() and update strings (#3097) 2018-09-27 08:45:17 -07:00
Zhanglong Xia cc24aa8f76 [message] create new messages with priority (#3015) 2018-09-26 20:07:51 -07:00
Jing ea1b83a4e7 [thci] add SSH support for OpenThread wpanctl THCI (#3086) 2018-09-26 19:59:18 -07:00
Christian Stauffer be1641434b [cli] fix NULL pointer udp example cli, when udp called without args (#3101) 2018-09-26 07:23:44 -10:00
Yakun Xu 125991b566 [meshcop] verify border agent address is rloc (#3100) 2018-09-26 07:23:12 -10:00
Christian Stauffer 2ce47a8e9c [coaps] CoAP Secure Client/Server accessible through OT API (#2716) 2018-09-24 11:22:08 -10:00
Abtin Keshavarzian 5fe9038e33 [toranj] enable new mode "posix app and RCP" (#3091)
This commit updates `toranj` framework to allow a different mode of
operation where tests are run using posix-app along with an RCP (NCP
in radio only mode) build. This commit also adds a new job for the
new model in travis CI build matrix.
2018-09-24 09:43:19 -10:00
rongli 55bf9fc2fe [core] remove children when attached after receiving MLE Announce Messages (#3093) 2018-09-24 06:57:31 -10:00
Biswajit 06bff96310 [mle] API to provide MLE Parent Response information (#3027) 2018-09-21 18:28:41 -10:00
Yakun Xu 41d8e4a73b [ip6] revert allowing sending packet with hop limit 0 (#3092) 2018-09-21 12:31:13 -07:00
Abtin Keshavarzian 90178d3027 [toranj] add new test NetworkData timeout and entry removal (#3082) 2018-09-19 11:31:11 -10:00
Abtin Keshavarzian 75522066c1 [network-data] remove all matching entries from RemoveRloc methods (#3082)
This commit makes changes to ensure the `Leader::RemoveRloc` methods
remove all matching entries from a `BorderRouterTlv` or `HasRouteTlv`
It adds new methods to `BorderRouterTlv` and `HasRouteTlv` to get the
first entry or last entry and allow an easier way to iterate over all
the entries.
This commit also adds a new helper method `RlocMatch()` to simplify
the comparison of RLOC16 values (exact match vs router id match).
2018-09-19 11:31:11 -10:00
Abtin Keshavarzian b43d83f43f [network-data] check and validate received network data before registering (#3078)
This commit adds check in `Leader::RegisterNetworkData()`to validate
the received network data and ensure it only contains entries matching
the RLOC16 of the device registering the network data. It updates
`RlocLookup()` method to add a new mode to allow or not allow any
entries that do not match the given RLOC16.
2018-09-19 07:55:21 -10:00
Yakun Xu 8f03f2a714 [travis] fix android check for ndk upgrade (#3090) 2018-09-19 05:55:08 -10:00
Jeff Bumgardner 7f13a960a2 [docs] update OT logos for Test Harness use (#3088) 2018-09-18 20:06:22 -10:00
Jonathan Hui 5fb4423a6c [license] update license headers (#3081) 2018-09-18 06:44:58 -10:00
Yakun Xu 0a86cc99ef [posix] flash file permission to 600 (#3085) 2018-09-18 06:31:40 -10:00
Łukasz Duda 704511c96e [icmp6] pass Echo Request messages to user-defined callback (#3083) 2018-09-18 06:30:56 -10:00
Yakun Xu 136a444565 [ip6] allow hop limit 0 (#3077) 2018-09-18 06:29:50 -10:00
Kamil Sroka 7132effa91 [nrf52840] enable ECDSA in mbed TLS (#3080) 2018-09-17 06:30:37 -10:00
Abtin Keshavarzian b9d1cb3b20 [ncp] add support for SPINEL_PROP_PHY_RSSI property in radio only mode (#3075) 2018-09-15 11:42:55 -10:00
Abtin Keshavarzian f5c55c5e23 [poisx-app] fix delayed TxDone callback (#3074) 2018-09-15 11:42:33 -10:00
Yakun Xu a834a06dbd [posix-app] remove link file from posix-app (#3072) 2018-09-15 11:40:47 -10:00
Yakun Xu ed794337e7 [posix] enhance reset implementation to support code coverage (#3071) 2018-09-14 10:59:07 -10:00
Jonathan Hui a23f778e11 [tests] support python3 (#3068) 2018-09-14 10:58:40 -10:00
Abtin Keshavarzian 6618c5564d [toranj] new test to check partition formation and merging (#3066) 2018-09-14 10:58:26 -10:00
Yakun Xu 9c04586861 [posix-app] check energy scan capability (#3047) 2018-09-14 10:56:58 -10:00
Jonathan Hui 222acd1362 [windows] resolve uninitialized memory warning (#3073) 2018-09-12 22:26:45 -10:00
Yakun Xu 4ef65c1ccf [posix-app] add README for posix-app (#3052) 2018-09-12 20:27:03 -10:00
Jonathan Hui 39cd92c743 [build] conditionally build cli and ncp FTD/MTD/radio libs (#3067) 2018-09-12 20:17:17 -10:00
Shu Chen 5c08fb8e3b [diags] support platform specific diags in radio-only ncp (#3024) 2018-09-12 05:42:19 -10:00
Abtin Keshavarzian b510468c6e [toranj] disable OT logs in test-023 and test-015 (#3065) 2018-09-11 23:27:33 -10:00
Abtin Keshavarzian 6fb1e9f05f [dataset] do not use Channel Mask TLV as MAC's supported channel mask (#3058)
This commit changes the code to treat Channel Mask TLV from
Operational Dataset and the MAC layer supported channel mask as
two different (unrelated) network parameters. In particular:
- With this commit, the Channel Mask TLV value is ignored when
  applying a Dataset from `Dataset:ApplyConfiguration()`.
- However, when we create an Active Operational Dataset as leader in
  `ActiveDataset::GenerateLocal()` method, the MAC layer's supported
  channel mask is still used for the Dataset Channel Mask TLV value.
- This commit also adds a check in `Mle::SendAnnounce()` to ensure
  that MLE Announcements are not sent on channels that are are not
  included in the MAC layer's supported channel mask.
2018-09-11 21:58:07 -10:00
Yakun Xu c4f44ae0ca [udp] remove transport pointer (#3064) 2018-09-11 14:56:59 -10:00
Yakun Xu 8a093a3f83 [meshcop] stop coaps before restart (#3063) 2018-09-11 14:53:16 -10:00
Jiacheng Guo e53c8824ac [cc2538] fix wrong uart rx ioc config (#3062) 2018-09-11 14:52:01 -10:00
rongli 952542ae35 [mle] fix connectivity parse if default sed capacity is not included (#3061) 2018-09-11 14:49:47 -10:00
Abtin Keshavarzian cd6b9e835c [posix-app] clear and free mTxRadioTid from Receive (#3046) 2018-09-11 14:47:07 -10:00
Yakun Xu 311b9283c2 [tests] move test_diag into tests/scripts/thread-cert (#3049) 2018-09-11 01:22:42 -10:00
Abtin Keshavarzian 8c5775cbfc [mle] log Thread Mode change (#3059)
This commit adds a log line (at log level `OT_LOG_LEVEL_NOTE`) to
indicate the mode change and the new mode value.
2018-09-10 19:36:36 -10:00
Yakun Xu d9da4c2652 [udp] verify destination before binding (#3055) 2018-09-10 18:11:06 -10:00
Yakun Xu 26fab7399d [posix-app] get real rssi from NCP (#3051) 2018-09-10 18:03:42 -10:00
Yakun Xu 50d0de5792 [toranj] fix typo of toranj tests (#3050) 2018-09-10 18:00:34 -10:00
Yakun Xu 1cbfc66edf [tests] enable self tests (#3048) 2018-09-10 14:46:05 -10:00
Abtin Keshavarzian b7c0c8ed99 [posix-app] update timer implementation to handle speedup (#3045) 2018-09-10 14:42:20 -10:00
Abtin Keshavarzian 42e44e34f9 [radio] update definition of otRadioCaps and the related constants. (#3044) 2018-09-10 14:41:03 -10:00
Yakun Xu afb4d2e72a [travis] add code coverage flag (#3037) 2018-09-10 14:40:23 -10:00
Zhanglong Xia c573dafe8e [ncp] fix clearing unsecure ports (#3022) 2018-09-10 14:39:06 -10:00
Abtin Keshavarzian 0d0c04ece2 [posix-app] add $(OPENTHREAD_TARGET_DEFINES) to CPPFLAGS_COMMON in Makefiles. (#3041) 2018-09-07 07:21:04 -10:00
Abtin Keshavarzian 144a4e3e06 [mle] add MLE counters (#2982)
This commit adds support for a set of MLE counters (e.g., counters to
track number of times device entered different roles, or counters
tracking number of attach attempts, partition ID or parent changes).
2018-09-06 21:01:31 -10:00
Yakun Xu abfb16eb7f [posix-app] tmf proxy to udp proxy (#3039) 2018-09-06 20:58:21 -10:00
Shu Chen b795c729d3 [posix-app] support platform energy scan in posix-app (#3038) 2018-09-06 20:57:38 -10:00
Abtin Keshavarzian 045aa4f358 [travis] update "posix" and "posix-ncp-spi" targets to use new configure options (#3031) 2018-09-06 20:55:47 -10:00
Shu Chen 9a9da5124f [cli] support energy scan command (#3036) 2018-09-06 07:30:55 -10:00
Zhanglong Xia b83fa59914 [mesh-forwarder] add function to decompress IPv6 Header (#3014) 2018-09-06 07:28:08 -10:00
Abtin Keshavarzian 5d993e9868 [configure] add OpenThread example to output of configure script (#3028) 2018-09-06 07:18:23 -10:00
Abtin Keshavarzian accf58d965 [posix-app] include <util.h> on darwin target for forkpty (#3030) 2018-09-06 07:15:38 -10:00
Abtin Keshavarzian 4aefb910bc [posix-app] include <sys/prctl.h> only on Linux target (#3029) 2018-09-06 07:15:22 -10:00
Łukasz Duda 9119bd5e33 [nrf52840] suppress IAR error inside mbedtls (#3026) 2018-09-05 23:18:14 -10:00
Hubert Miś d05542dbf5 [nrf52840] use otSys prefix in the SoftDevice platform API (#3025) 2018-09-05 23:17:54 -10:00
Kamil Sroka 7917c7b1cc [nrf52840] enable ECDH in mbed TLS (#3023) 2018-09-05 23:17:23 -10:00
Yakun Xu b45cc3cd63 [posix-app] get radio caps from NCP (#3021) 2018-09-05 23:17:00 -10:00
Yakun Xu f227bbe7f2 [posix-app] fix alarm issue (#3035) 2018-09-05 23:16:33 -10:00
Shu Chen e34b0f3437 [posix-app] fix bug in posix-app initialization with real hardware (#3034) 2018-09-05 20:04:00 -10:00
Yakun Xu bdffbe5671 [posix-app] enhance virtual time for posix app (#3016) 2018-09-05 18:08:36 -07:00
Abtin Keshavarzian 2742886134 [posix-app] address integer conversions (#3018) 2018-09-05 00:44:27 -07:00
Abtin Keshavarzian 8c333e6e07 [posix-app] change GetReceiveSensitivity() return value to int8_t (#3017) 2018-09-05 00:43:26 -07:00
Shu Chen 3174c590c3 [utils] implement a common method for command line parsing (#3001) 2018-09-05 00:40:02 -07:00
Jonathan Hui a638442df8 [configure] separate example apps and ftd/mtd/radio in build config (#3010) 2018-09-05 00:35:52 -07:00
Jing 11014739f2 [thci] OpenThread wpanctl THCI bug fix (#3012) 2018-08-31 17:56:33 -07:00
rongli 9f9d76b8bc [ncp] fix no reply issue for ping to RLOC/ALOC (#3011) 2018-08-31 17:55:32 -07:00
Abtin Keshavarzian fdd770b8fc [mle] inline simple getter methods (#3007) 2018-08-31 08:57:54 -07:00
Yakun Xu 5016af4cde [tests] increase child timeout (#3000)
* fix calculate default poll period

* add default child timeout in config.py

* define FAILED_CHILD_TRANSMISSIONS
2018-08-30 11:58:32 -07:00
hjian2017 cb63295975 [coap] improve readability (#3008) 2018-08-30 10:18:13 -07:00
Hubert Miś 4665732e81 [nrf52840] fix millisecond alarm trigger condition (#3009) 2018-08-30 10:17:29 -07:00
Jonathan Hui 1aa0a9b5d8 [diags] fix build error introduced in 2d0baf8 (#3006) 2018-08-29 13:10:15 -07:00
Giedrius b5ce567ffd [api] add return code to otCoapHeaderSetPayloadMarker (#3004) 2018-08-29 09:59:02 -07:00
Hubert Miś c2f32e3df8 [nrf52840] update drivers to SDK 15.1.0 (#3003) 2018-08-29 09:58:29 -07:00
Shu Chen 2d0baf8fc5 [ncp] remove diags module from radio only ncp (#3002)
The diags module runs on host side, radio only ncp will only act as
transceiver and support platform specific diags features.
2018-08-29 09:57:46 -07:00
Jeff Bumgardner b133a194fb [docs] revise THCI README (#3005) 2018-08-28 20:50:20 -07:00
rongli 54bf9ef0e0 [dataset] fix issue in applying pending dataset when delaytimer expires (#2988) 2018-08-28 11:52:02 -07:00
Yakun Xu 2e89aa0ad3 [tests] add missing simulator parameter (#2999) 2018-08-28 09:28:14 -07:00
rongli d103797ba0 [tests] fix unstable Cert_5_3_03 (#2998) 2018-08-28 09:26:45 -07:00
Jonathan Hui bf3c081843 [tests] update pycryptodome version to 3.6.6 (#2997) 2018-08-28 09:24:46 -07:00
Shu Chen 026badad96 [diags] use temporary buffer for diag output (#2992) 2018-08-28 09:24:23 -07:00
Abtin Keshavarzian 2f605e9953 [toranj] test covering multicast traffic over multi-hop (#2983)
This commit adds a test-case under `toranj` covering multicast
traffic exchange over a multi-hop network to the following multicast
IPv6 addresses: link-local/mesh-local all-nodes address, link-local
/mesh-local all-routers address, link-local/mesh-local all-thread-
nodes address, and user-specified multicast address.
2018-08-27 16:00:11 -07:00
Jing 48cbbfd32a [thci] add OpenThread Border Router support (#2947) 2018-08-27 10:51:03 -07:00
Shu Chen 315b7e4f9f [posix] make posix settings path configurable (#2993)
configure settings path on andriod to "/data/thread" as default, which will persist after reboot.
2018-08-27 10:44:30 -07:00
Jonathan Hui d54abf8c63 [travis] fix scan-build (#2990) 2018-08-27 09:41:32 -07:00
Kamil Sroka 693bf015f3 [nrf52840] add support for USB bootloader on PCA10059 (#2994) 2018-08-27 08:57:21 -07:00
Kamil Sroka 1b25bf1238 [nrf52840] add crypto to all platform lib variants (#2995) 2018-08-27 08:53:48 -07:00
rongli 5b7e49f21d [dataset] update active/pending dataset based on existing active dataset (#2991) 2018-08-24 19:14:06 -07:00
Hubert Miś dd3916c404 [nrf52840] fix TimeToTicks function in the alarm port (#2986) 2018-08-24 08:44:30 -07:00
Abtin Keshavarzian 20ccd55c16 [makefile] add missing files to libopenthread-radio source list (#2989) 2018-08-23 11:16:15 -07:00
Jonathan Hui eba708f018 [mbedtls] simplify source file listing in Makefile.am (#2984) 2018-08-23 10:34:10 -07:00
Abtin Keshavarzian d1a0b80a53 [toranj] multicast IPv6 addresses on routers/FED/SED (#2979)
The new test covers the following:
- Verify all nodes (routers/FED/SED) subscribe to:
   * Link-local all nodes, realm-local all nodes,
   * Link-local all Thread nodes, realm-local all Thread nodes,
   * All MPL forwarder realm-local.
- Verify routers also subscribe to:
   * Link-local all routers, realm-local all nodes.
- Verify adding/removing multicast addresses on all devices.
2018-08-23 10:27:51 -07:00
jciupis 36e238453f [nrf52840] add missing radio driver source file to appropriate Makefile (#2987) 2018-08-22 16:11:11 -07:00
Abtin Keshavarzian 024cf82ab0 [toranj] add test-case for address cache table (#2972)
This test verifies the behavior of `AddressResolver` module and
entries in address cache table. It also tests the behavior of nodes
when there are topology changes in the network (e.g., a child switches
parent). In particular, the test covers the address cache update
through snooping.
2018-08-22 13:30:54 -07:00
Abtin Keshavarzian abecb07ba1 [tools] add bash script git-squash-merge (#2962)
This commit adds a new script `git-squash-merg` which can help with
performing squash merge of a branch into another. The commit message
includes the list of squashed commits. This script is helpful for
synchronization of git repositories that work with gerrit.
2018-08-22 13:30:14 -07:00
Abtin Keshavarzian 6ab5c63435 [toranj] update form/join tests to cover new wpanctl capabilities (#2978)
This commit updates the `toranj` tests related to forming/joining
a network to cover newly added capabilities to wpanctl `form`/`join`
commands (allowing all parameters to be given as part of the
command itself).
2018-08-21 09:41:45 -07:00
Abtin Keshavarzian cae716acc3 [toranj] update test-001 to get and set more wpan properties (#2976) 2018-08-21 09:40:03 -07:00
Yakun Xu af2bfc1cc4 [test] save packets as pcap file in thread-cert tests (#2965) 2018-08-20 09:27:04 -07:00
Abtin Keshavarzian e731babedb [mle] simplify device role checks using IsAttached method (#2975) 2018-08-18 18:04:33 -07:00
Abtin Keshavarzian f993ba5f89 [toranj] add test-case for router table (#2970)
This commit adds a test-case under `toranj` to verify router table
entries on a network with 4 routers: {r1, r2, r3} forming a loop
with r4 connecting to r3.
2018-08-17 14:36:05 -07:00
Yakun Xu 0cea4bc738 [cli] return number of bytes in ping reply (#2973) 2018-08-17 11:53:54 -07:00
Yakun Xu e7de6eafa3 [test] enhance android build check (#2974) 2018-08-17 11:49:35 -07:00
Seth Rickard ef31de69c1 [cc13x2_cc26x2] fix runtime issue with RF patching (#2971) 2018-08-17 09:34:13 -07:00
Hubert Miś 8d2184a4e7 [nrf52840] update nRF52840 radio driver to version 1.2.0 (#2968) 2018-08-17 09:03:55 -07:00
Jonathan Hui c116441212 [api] change type from uint8_t * to otMeshLocalPrefix (#2966) 2018-08-17 08:59:37 -07:00
Abtin Keshavarzian 37b5a9655c [toranj] Child Supervision test (#2951)
This commit adds a new test-case under `toranj` for Child Supervision
feature.

This test uses MAC whitelisting to emulate the situation where a child
is removed from parent's child table while the child continues to stay
attached to the parent (since data polls from child are acked at radio
platform layer). Specifically the test verifies that once supervision
check is enabled on the child, the child detects that it is no longer
in the parent's table and tries to re-attach. The test verifies the
behavior of both the parent and the child when supervision is enabled.
It verifies that the parent is periodically sending supervision
messages to the child and that the child is monitoring the messages
from parent. This test also indirectly verify the child timeout
behavior on a parent.
2018-08-15 15:47:50 -07:00
Abtin Keshavarzian 3ff432f152 [spi-hdlc-adapter] update README.md (fix typos) (#2961) 2018-08-15 12:48:31 -07:00
Abtin Keshavarzian ce48bf1819 [toranj] test behavior of "inform previous parent" feature (#2964)
This commit adds a new test-case under `toranj` frame-work to verify
the behavior of devices under the "inform previous parent" feature.

With this feature enabled, when a child attaches to a new parent, it
will send an IP message (with empty payload) to its previous parent.
Upon receiving this message the previous parent would immediately
remove the child from its child table.

The test network topology consists of two routers/parents and a single
sleepy child. The child is first attached a parent and is then forced
to switch its parent. It's then verified that the child is removed
from first parent's child table.
2018-08-15 10:27:52 -07:00
Jonathan Hui 920197398b [api] change type from uint8_t* to otExtendedPanId (#2960) 2018-08-15 10:12:49 -07:00
Abtin Keshavarzian ae5421ecbd [toranj] reduce number of routers/children in test-016-neighbor-table (#2963) 2018-08-15 10:12:00 -07:00
Yakun Xu 0c07c53ce3 [platform] attach timestamp in promiscuous mode (#2954) 2018-08-10 09:26:11 -07:00
Yakun Xu d2e59fd645 [posix-app] fix getting tx power (#2957) 2018-08-10 01:16:00 -07:00
Jonathan Hui c8d06c402e [efr32] fix em_system.h include (#2956) 2018-08-09 18:31:34 -07:00
Yakun Xu 101e243372 [nrf52840] fix default parameters of FEM (#2945) 2018-08-08 18:30:30 -07:00
Jonathan Hui 9d585edc46 [types] move types into specific headers (#2946) 2018-08-08 11:19:41 -07:00
rongli 90ee0a4d66 [ncp] add joiner spinel support (#2877) 2018-08-08 11:18:53 -07:00
Yakun Xu e181f1f98e [posix-app] fix diag issues of radio only mode (#2948) 2018-08-07 19:15:14 -07:00
Jing 492f0c3b10 [harness-automation] update read method for TopologyConfig.txt format change (#2950) 2018-08-07 10:47:01 -05:00
Yakun Xu 8efb3c50e5 [meshcop] implement commissioning UDP proxy (#2926) 2018-08-06 14:50:41 -05:00
Abtin Keshavarzian a9d32b7bef [ncp] add support for Commissioner APIs in spinel and NCP (#2911)
This commit adds support for Commissioner related APIs in spinel and
NCP including starting/stopping Commissioner, setting Provisioning
URL, adding/removing Joiners, and sending Announce Begin, Energy Scan
Query, PAN ID Query, MGMT_GET/MGMT_SET messages.
2018-08-06 14:46:01 -05:00
Jonathan Hui f089fc8e25 [gcc8] resolve compiler errors (#2944)
This commit resolves compiler errors generated by gcc8.

This commit also adds gcc8 build checks to travis.
2018-08-03 14:14:41 -05:00
Jonathan Hui f0bb0982ee [examples] change example platform namespacing (#2927) 2018-08-03 14:13:47 -05:00
Abtin Keshavarzian 1ca81fbb16 [ncp] add support for child supervision in spinel/NcpBase (#2939) 2018-08-02 17:21:11 -05:00
Abtin Keshavarzian c551e30350 [posix] handle signals SIGHUP or SIGTERM and exit (#2930)
This commit adds signal handler in posix example platform for
signals SIGHUP and SIGTERM. Upon receiving either signal the
process is terminated using `exit(0)`.
2018-08-02 17:17:40 -05:00
Abtin Keshavarzian 44e583a554 [toranj] add new method to finalize all nodes at end of each test (#2930)
This commit adds a new method `finalize_all_node()` in `wpan.Node`
class to finalize all previously created instances of `wpan.Node`. It
terminates the associated `wpantund` process and wait.
2018-08-02 17:17:40 -05:00
Abtin Keshavarzian d67c4e2f6b [ncp] include prop set support for THREAD_CHILD_TIMEOUT in MTD build (#2943) 2018-08-02 00:55:35 -05:00
Yakun Xu 601b99b394 [android] use spi instead of uart (#2942) 2018-08-02 00:54:48 -05:00
Jonathan Hui ba4b238a00 [link-quality] explicitly clear link quality for new child/router (#2941)
The child/router entries are generally cleared using `memset()` to avoid
explicitly setting all fields to zero.  As a result, it is necessary to
explicitly clear the link quality state to properly initialize the last
RSSI reading.  The user-specific constructors are also removed.
2018-08-01 10:33:03 -05:00
Jonathan Hui 412f9740b0 [tlv] remove unnecessary user-specified constructor (#2940) 2018-08-01 10:32:46 -05:00
Jonathan Hui bcfa7edff1 [ip6] ensure slaac addresses are added back after reset (#2938)
This commit makes the following changes:

1. A child that is resynchronizing with its parent after reset always
   requests the network data to ensure that it has the latest version.

2. When autoconfiguring SLAAC addresses in response to a network data update
   always attempt to add the netif address buffer in case the netif
   structure was removed (e.g. due to reset).
2018-08-01 10:32:27 -05:00
Jonathan Hui 7be61df6ec [message-info] remove unnecessary memset initialization (#2937) 2018-07-31 14:10:02 -05:00
Jonathan Hui c097cd2d3b [mle] remove unused LeaderDataTlv from HandleChildUpdateRequest (#2936) 2018-07-31 14:09:48 -05:00
Abtin Keshavarzian a9932027fa [toranj] test case for adding IPv6 addresses with same prefix on multiple nodes (#2915)
This commit adds a new test script for `toranj` test frame-work
covering the situation when IPv6 addresses with same prefix are
added/removed on multiple nodes. The test verifies that the on-mesh
prefix list on all nodes stays consistent and updated as the addresses
are added/removed and nodes are reset.
2018-07-31 12:38:40 -05:00
Abtin Keshavarzian 2aa335144c [mle] fix logging at NOTE level (#2933)
This commit fixes the issue when building at `LOG_LEVEL_NOTE`
ensuring methods such as `AttachModeToString` are included.
2018-07-31 11:18:12 -05:00
Abtin Keshavarzian 3acd900bdf [message] update comment/documentation (#2903) 2018-07-31 10:41:26 -05:00
Abtin Keshavarzian 68535657df [toranj] test case to verify child restoration after parent reset (#2935)
This commit adds a new test-case under `toranj`. The test covers
the following situation:

- A single parent node with three sleepy and two rx-on children.
- Parent node is reset.
- It is verified that all children are recovered and are present
  in the parent's child table after reset.
- It is also verified that all children are restored on parent
  through "Child Update" exchange process and none of them get
  detached.
2018-07-30 16:04:58 -05:00
Abtin Keshavarzian 1c7f811b32 [mle] fix issue with saving child info to non-volatile (#2935)
This commit addresses an bug where the child info was not being
saved in non-volatile settings. It fixes the following cases in
the code where a child id was used to search for a child (using
`FindChild()`) instead of the RLOC16 address:

- `StoreChild()` is changed to accept a `const Child &` as input
  parameter avoiding the need to look up the child by ID or RLOC16.
- `SendChildIdResponse()` and `GetChildInfoById()` are updated to
  perform the search for a child using its RLOC16.
2018-07-30 16:04:58 -05:00
Jonathan Hui ffff5f3f6f [travis] remove lib32z1 from arm-gcc-6/7 build checks (#2928) 2018-07-30 10:46:28 -05:00
Jonathan Hui d24b02ea79 [github] update issue templates (#2920) 2018-07-30 10:46:10 -05:00
Jonathan Hui d3b5b8fa60 [flash] move example flash driver from c++ to c (#2919) 2018-07-30 10:45:50 -05:00
Jonathan Hui b6c2a2b06e [kw41z] load bytes into TX Packet Buffer in order (#2882)
The MKW41Z Reference Manual Section 44.6.2.7 states:
- "The 802.15.4 Link Layer software prepares data to be transmitted, by
  loading the octets, in order, into the Packet Buffer."

This commit maintains a separate buffer for building the transmit frame
then copies the buffer just before the transmit frame is submitted to the
radio.
2018-07-30 10:45:24 -05:00
Jonathan Hui f824343f8c [config] add check for OPENTHREAD_CONFIG_DISABLE_CCA_ON_LAST_ATTEMPT (#2925) 2018-07-26 02:17:29 -05:00
Abtin Keshavarzian 7978810afe [config] update comment/docs for MAX_TX_ATTEMPTS_INDIRECT_POLLS (#2924) 2018-07-26 02:17:16 -05:00
Tomas Cerskus 2b8e2362b7 [efr32] do not use CCA/CSMA when it is disabled (#2923) 2018-07-26 02:16:44 -05:00
Jonathan Hui f5aa83cad7 [mac] fix build failure with CONFIG_DISABLE_CSMA_CA_ON_LAST_ATTEMPT (#2922) 2018-07-26 02:15:47 -05:00
Kamil Burzynski c7e62553e5 [mle] support for long routes (#2775)
This commit introduces changes necessary to support long routes (i.e. route
cost >= 16).

This is an experimental feature that requires changes to the route
information communicated in MLE messages.  As a result, it is not compatible
with the Thread 1.1 specification.

This feature is disabled by default.
2018-07-26 02:14:49 -05:00
Abtin Keshavarzian bb064cd074 [toranj] add test-case for "Thread:NeighborTable" (#2917) 2018-07-25 04:26:16 -05:00
Abtin Keshavarzian 3796b33e6a [commissioner] add new API to get Provisioning URL (#2884) 2018-07-25 04:20:41 -05:00
Jonathan Hui 14a1f49011 [efr32] update to Gecko SDK v2.3 (#2909) 2018-07-24 03:59:33 -05:00
Yakun Xu f22cddb9ee [core] move border agent into thread_netif (#2893) 2018-07-23 09:14:23 -05:00
Abtin Keshavarzian 9d7a9f1e21 [core-config-check] add CONFIG_MAX_TX_ATTEMPTS_DIRECT to list of replaced options (#2910) 2018-07-23 09:10:32 -05:00
Yakun Xu e220197b6b [meshcop] allow MBEDTLS_ERR_SSL_WANT_WRITE from mbedtls_ssl_write() (#2906)
* increase message buffers to pass meshcop check
2018-07-23 09:08:51 -05:00
rongli dcc3eac579 [network-data] clean stale child's server info when its parent is removed (#2905) 2018-07-23 09:06:38 -05:00
Abtin Keshavarzian 6269da241b [mle] fix retransmission of Data Request messages (#2895)
This commit renames the timer used for Child Update transmissions  to
`mMessageTransmissionTimer` and allow it to be used for retx of MLE
Data Request messages when there is no pending or active MLE Child
Update Request. It also adds logic to ensure that the device gets
detached after some number of MLE Data Request attempts with no
response.
2018-07-23 09:03:49 -05:00
Abtin Keshavarzian ffc2b972ab [toranj] perform a subprocess.poll() on wpantund instance during init of nodes (#2901)
This allows the underlying wpantund process associated with a `Node`
instance to be executed while we are waiting for it to be initialized.
It also protects against any unexpected termination of an instance.
This change would help with speed of initialization of all nodes
mainly when there are many instances running in parallel.
2018-07-20 14:41:24 -05:00
Abtin Keshavarzian 8e28b626a9 [spinel] add a section for MeshCop properties and update documentation (#2885)
This commit updates the documentation of spinel property sections
and also adds a new range 0x080 - 0x08F, 0x1800 - 0x18FF allocated
for MeshCop related properties.
2018-07-20 13:50:09 -05:00
Yakun Xu d50e3713c3 [meshcop] fix handling commissioner keep alive (#2907) 2018-07-20 10:47:35 -05:00
Jeff Bumgardner 7586509525 [docs] update API menu for new APIs (#2902) 2018-07-19 23:53:24 -05:00
Abtin Keshavarzian 3ee31ec562 [commissioner] update comments and method documentations (#2900) 2018-07-19 23:43:08 -05:00
Jonathan Hui 1075e35327 [code-style] remove multiple return statements per free function or method (#2891)
There should be one return statement per free function or method at the end
of the free function or method.
2018-07-19 20:09:07 -05:00
Robert Lubos 9b211b76c6 [nrf52840] prevent linker from dicarding strong nrf5CryptoInit implementation (#2899)
Linker will discard libmbedcrypto_a-cc310_mbedtls.o when searching
mbedTLS library, if it finds weak implementation of
nrf5CryptoInit/Deinit before strong ones. Adding additional
symbols to this file will prevent this behavior and make linker
to search libmbedcrypto_a-cc310_mbedtls.o even after weak
implementations are found.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-07-19 16:49:30 -05:00
Shu Chen c863a35662 [nrf52840] don't reinitialize cc310 during pseudo reset (#2897)
The device hangs when reinitialize cc310.
2018-07-19 16:47:50 -05:00
Abtin Keshavarzian 758e647d91 [dataset] update dataset SendMgmtGet APIs and add support in spinel/NCP (#2866)
This commit updates the APIs `otDatasetSendMgmtActiveGet` and
`otDatasetSendMgmtPendingGet` to be similar to MgmtSet APIs and use an
`otOperationalDatasetComponents` as input to specify the Dataset
components to be requested. The implementation of APIs in
`DatasetManager` and their use in in CLI is also updated.

It also defines new spinel properties `MGMT_GET_ACTIVE_DATASET` and
`THREAD_MGMT_GET_PENDING_DATASET` (with their set handlers) to add
support for sending `MGMT_GET` meshcop command for Active/Pending
Operational Dataset. It also renames the existing properties used for
sending `MGMT_SET` (include `MGMT_SET` in the property name).

It also adds a new property to allow an optional destination IPv6
address to be specified (for sending `MGMT_GET` command) as part of
spinel dictionary representation of Dataset instance.
2018-07-19 16:33:49 -05:00
Jonathan Hui 7ba8f348dc [mac] separate configs for macMaxCSMABackoffs and macMaxFrameRetries (#2881)
This commit aligns the MAC CSMA backoff and retransmit configuration more
closely with IEEE 802.15.4-2006.
2018-07-19 16:32:45 -05:00
Yakun Xu 0645a3ae65 [travis] fix cert 5-2-05 address query (#2894) 2018-07-16 11:28:21 -05:00
Yakun Xu 564d57ec07 [travis] fix Cert_6_3_02_NetworkDataUpdate of posix-ncp check (#2892) 2018-07-16 11:26:12 -05:00
Kamil Sroka 3cd6fad5aa [travis] update UDP_PROXY flag (#2890) 2018-07-13 14:10:12 -05:00
Yakun Xu f2268fadbc [core] inline instance getters (#2889) 2018-07-13 12:23:41 -05:00
Kamil Sroka d7f8a5b631 [ncp] remove unused variable from ncp_base_mtd.cpp (#2887) 2018-07-13 11:35:47 -05:00
Abtin Keshavarzian d68ac05bae [toranj] update wpan.init_all_nodes to allow wait time per node (#2886)
This commit also moves the disabling of the log within the `try`
region to ensure it is retried in case wpantund instance is not
yet ready.
2018-07-13 11:34:50 -05:00
Shu Chen ae58f6cc06 [build] separate Header IE feature from time sync code (#2876)
Add a configure option to enable/disable Header IE support: OPENTHREAD_CONFIG_HEADER_IE_SUPPORT

So then the Header IE generation and parsing feature could be enabled separately.
2018-07-13 11:33:22 -05:00
Yakun Xu ae4e5171ef [posix-app] fix bugs of posix apps (#2888)
1. avoid possibility of reentrant to Hdlc::Decode
2. do not send unwanted ACK to core stack
2018-07-13 10:50:14 -05:00
rongli 51a1a5f12b [core] update Child Update Request aggregation feature (#2874) 2018-07-12 23:51:00 -05:00
Abtin Keshavarzian 0d0c4ceaea [ncp] increase ChangedPropsSet max supported entries to 64 (#2883)
This commit increases the maximim number of entries that can be
supported by `Ncp::ChangePropsSet` to 64 by using `uint64_t` to
save the flags instead of `uint32_t`.
2018-07-12 21:49:00 -05:00
Abtin Keshavarzian eee83a0d38 [toranj] disable OT/NCP logs (by default) during initialization of nodes (#2880)
This commit changes `wpan.init_all_nodes()` to disable OT/logs on
all nodes as the default behavior.
2018-07-12 10:49:20 -05:00
Abtin Keshavarzian f065438111 [ncp] add UDP_PROXY_STREAM to dispatcher list and update documents (#2879) 2018-07-11 20:16:56 -05:00
Zhanglong Xia b5dd84222f [mac] enable broadcast message retransmission in MAC layer (#2815) 2018-07-11 16:03:19 -05:00
Shu Chen c0454408a8 [nrf52840] reinitialize all peripherals except uart for pseudo reset (#2878)
There are some problems if radio is not reinitialized during pseudo reset:
* It may trigger unexpected otPlatRadioTxDone(), and cause the device to hang;
* The uncleared radio timer queue is invalid, it may block the new added timer which has a larger targer time.

Note: The clock init/deinit is disabled during radio init/deinit.
2018-07-11 14:21:48 -05:00
Stuart Longland 36ea84e06b [cc2538] avoid possible deadlock in otPlatRadioTransmit (#2371)
* [cc2538] Add definitions for FSMSTAT0 and RFERRF bits.

This adds a register definition for `RFCORE_XREG_FSMSTAT0` and defines
the bits in `RFCORE_SFR_RFERRF`.

* [cc2538] Check for error conditions on transmit.

The transmit code first waits for an existing transmission to finish,
then sets things up for the next transmission and waits for the radio to
go into receive mode before proceeding.

If, the radio receive buffer overflows during this time, the radio will
enter a RX overflow state (state 0x11 in `FSMSTAT0`) and will block
there until the RX FIFO is flushed.

In such cases, the CC2538 hard-locks due to the while loop waiting for
the `RX_ACTIVE` bit to be set.  While waiting for `RX_ACTIVE`, we need
to check for these overflow conditions, handle them, then re-try our
transmitter set-up.

* [cc2538] Re-try transmit set-up on IDLE

If we enter the idle state, then rather than just setting the channel,
re-try our transmitter set-up since we should be in the correct state
to do this at this point.
2018-07-11 14:10:52 -05:00
Kamil Sroka 9cb7c4b634 [travis] add link raw to nrf52840 build checks (#2875) 2018-07-10 16:22:53 -05:00
Jonathan Hui a05fcb6e1d [travis] add cc1352 build checks (#2873) 2018-07-10 15:56:23 -05:00
Jonathan Hui af0e3f19fa [tlv] change GetSize() return type to uint16_t to avoid overflow (#2870)
Credit to OSS-Fuzz.
2018-07-10 14:13:16 -05:00
Abtin Keshavarzian 8c8a953d29 [toranj] adding verify_within and updating test-014-ip-address-add. (#2871)
This commit adds a new function `verify_within` in `toranj` wpan
library. This function verifies that certain conditions (given as
function handler) pass within a given wait time interval. The
`verify` function is also changed to raise an exception (instead
of immediate `exit(1)`).

The new function is then used in `test-014` to allow faster checks
after device reset while giving longer wait time for test to pass.
2018-07-10 12:13:11 -05:00
Jonathan Hui b8181ce76d [android] fix removal of tmf_proxy.cpp in Android.mk (#2872) 2018-07-09 22:15:19 -05:00
Seth Rickard 5fc1788d37 [cc1352] add support for Texas Instruments CC1352 (#2863) 2018-07-09 15:28:41 -05:00
Yakun Xu 96a7e2d5a5 [meshcop] move border agent into core (#2771)
This commit moves the border agent service into OpenThread core.

Border agent, commissioner, and joiner shares a single secure CoAP agent,
because they will not be active at the same time.

Other changes include:
- Replaced TMF proxy with UDP proxy, which is more generalized.
- Changed OT_ERROR_NONE string to "OK".
- Defined a special interface id -1 to differentiate packets received by
  host side.
2018-07-09 15:25:23 -05:00
Kamil Sroka 8555513247 [build] fix errors and warnings when building on IAR and Keil (#2868) 2018-07-09 11:17:46 -05:00
Yakun Xu 93bb67024f [posix-app] add Makefile for building with android build system (#2864) 2018-07-09 11:15:43 -05:00
Shu Chen cdc772759e [nrf52840] avoid unexpected transmit done callback after pseudo reset (#2862)
Introduce a nrf5RadioPseudoReset() method, it will put the radio to sleep mode,
and clear the pending events during pseudo reset. So to avoid unexpected transmit
done callback after pseudo reset, which may cause the device to hang.
2018-07-09 11:05:45 -05:00
rongli 19c73f8b66 [core] update tmf rules to allow link local multicast address as dest (#2865) 2018-07-06 23:43:32 -05:00
Yakun Xu d54076ea97 [api] fix reset for radio only mode (#2859) 2018-07-04 22:46:26 -05:00
Yakun Xu 42e590a8fc [posix-app] add missing check for spinel radio (#2855) 2018-07-04 22:45:53 -05:00
Abtin Keshavarzian 52354e73c7 [ncp] add new fields (age, rssi, etc) to PARENT spinel property (#2854)
This commit appends new fields to format of `PROP_THREAD_PARENT`
spinel property. The new fields provide age, avrerage RSSI and
last RSSI, etc. This commit also updates the spinel documentation.
2018-07-04 15:40:40 -05:00
Abtin Keshavarzian 4e6e1bc568 [toranj] test-case for adding IPv6 addresses (#2853)
This commit adds a `toranj` test for adding/removing IPv6 addresses
on routers, FEDs, and SEDs (on network interface).

The test then covers the following:
- Verify "IPv6:AllAddresses" wpantund property.
- Verify that prefixes are present in network data corresponding
  to added addresses (on all nodes).
- Verify that a SED does register the address with its parents
  ("Thread:ChildTable:Addresses" wpantund property).
- Verify that addresses/prefixes are retained by wpantund over
  NPC resets.
- Verify that when an address is removed on network interface
  its corresponding prefix is also removed (on all nodes).
2018-07-04 00:14:55 -05:00
Abtin Keshavarzian da9d0df373 [toranj] add support for add-prefix and remove-prefix (#2852)
This commit updates `wpan.py` module to include newly added wpanctl
commands `add-prefix` and `remove-prefix` and include new `stable`
parameter for `add-route`. It also updates `test-10` to test the
behavior of the new commands.
2018-07-04 00:11:30 -05:00
Abtin Keshavarzian 751c92821a [mle-router] update the route table log message (#2839)
This commit changes the code such that the logs are emitted only if
the route table is updated. It also changes the log format.
2018-07-04 00:10:21 -05:00
Shu Chen 0c537d8c0e [nrf52840] set initialized state to false in nrf_drv_clock_uninit() (#2850)
Fix an issue that application could not reinitialize the clock again after nrf_drv_clock_uninit().
2018-07-04 00:05:48 -05:00
Abtin Keshavarzian 92282bffa7 [ip6] fix forwarding of off-mesh traffic on FED (#2847)
This commit addresses an issue with forwarding of off-mesh traffic
on FED. It also adds a `toranj` test-case to test adding of off-mesh
routes (on routers and FEDs) and traffic flow to off-mesh addresses.
2018-07-02 20:53:54 -05:00
Shu Chen 4aee236c6b [nrf52840] avoid endless "otPlatUartSendDone" log when using usb-cdc (#2849) 2018-07-02 13:08:02 -05:00
Abtin Keshavarzian d79bf6f268 [toranj] limit the logs during init of all nodes (#2848) 2018-07-02 10:48:17 -05:00
Jonathan Hui 6bd04ddcda [mesh-forwarder] retransmit on CCA errors (#2846)
This commit changes the way the mesh forwarder layer handles transmit
attempt failures due to CCA failures.  Prior to this commit, the mesh
forwarder layer would simply drop the packet.  This commit keeps the
packet in the queue so that it can be retransmitted at a later time.  This
applies to both direct and indirect transmissions.
2018-07-02 10:44:50 -05:00
Jonathan Hui 10666f5c1e [mac] ensure frame validation checks occur before reading FCF (#2845)
Credit to OSS-Fuzz.
2018-07-02 10:44:28 -05:00
Jonathan Hui 30222e8538 [radio] rename CcaEnabled to CsmaCaEnabled (#2844) 2018-07-02 10:44:09 -05:00
Abtin Keshavarzian 31698ecaf7 [mac] tracking supported channel mask (#2838)
This commit contains the following changes:
- Adds new logic to `Mac` to track supported channel mask along
  get/set methods.
- Adds public OT APIs `otLinkGetSupportedChannelMask()` and
 `otLinkSetSupportedChannelMask()` to get/set the channel mask.
- Ensures supported channel mask from `Mac` is included in Dataset
  TLVs when a local Dataset is generated.
- Ensures the channel mask at `Mac` gets updated when a new Dataset
  configuration is applied.
- Adds `OT_CHANGED` notification for signaling channel mask changes.
- Updates `NcpBase` and `PHY_CHAN_SUPPORTED` spinel property get/set
  handlers to adopt the new public APIs.
- Updates `NcpBase` to emit async `PHY_CHAN_SUPPORTED` updated on
  OT_CHANGED channel mask notification.
2018-07-02 10:43:45 -05:00
Abtin Keshavarzian fdb3d0ef58 [mesh-forwarder] update LogMessage to use NOTE level for failure/error cases (#2836)
This commit also contains
- Adding `Instance::GetLogLevel()` to get current log level on
  device.
- Adding new `otLogMac()` macro to log at MAC region with a run-time
  given log level.
2018-06-29 13:00:53 -05:00
Abtin Keshavarzian 38e7b30ef7 [ncp] update/add comments and re-order handler lookup (#2841) 2018-06-29 12:34:04 -05:00
Abtin Keshavarzian 60fc0ac05f [logging] change some log messages from INFO level to NOTE level (#2835)
This commit changes some of the log messages in `mle`, `ip6`,
`address_resolver` and `router_table` from INFO level to NOTE level.

It also adds missing `otLogNote<>` implementation for windows.
2018-06-28 16:20:24 -05:00
Kamil Sroka c925b42941 [link-raw] split software retransmit to retransmit and backoff (#2840) 2018-06-28 09:56:28 -07:00
Yakun Xu 8ccf1386de [ncp] adjust defining NCP handlers (#2829) 2018-06-28 11:26:31 -05:00
Abtin Keshavarzian e25570fb93 [settings] do not log setting delete operation with NOT_FOUND error (#2834) 2018-06-28 11:26:08 -05:00
Shu Chen f5d895c812 [posix] fix a bug when updating time info for time synchronization (#2837) 2018-06-27 11:41:44 -05:00
Jonathan Hui c325ab8a39 [ncp] add dhcp6 client support (#2833) 2018-06-26 22:26:36 -05:00
Shu Chen e69019f962 [time-sync] network-wide time synchronization service (#2618)
OpenThread network-wide time synchronization service is an experimental feature, not part of the standard Thread protocol.

Feature Overview:
 * All the nodes in the same Thread partition sync to the same Thread network-wide time;
 * Microsecond level time synchronization precision;
 * Flexible time accuracy and time sync period configuration;
 * APIs for application layer use case, support both CLI and NCP version.

The feature is wrapped by OPENTHREAD_CONFIG_ENABLE_TIME_SYNC, there's no change to current Thread 1.1
implementation if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is not enabled.

If OPENTHREAD_CONFIG_ENABLE_TIME_SYNC is enabled, the node could:
 * Attach to a time sync enabled network, otherwise
 * Attach to a standard Thread 1.1 network, otherwise
 * Form a new time sync enabled network

In addition, if OPENTHREAD_CONFIG_TIME_SYNC_REQUIRED is also enable, the node could only:
 * Attach to a time sync enabled network, otherwise
 * Form a new time sync enabled network

Note:
Currently, the feature is only supported on nRF52840 and posix platforms. And the network time
is only synced among Routers and REEDs, the SEDs will be supported later as an optional feature.
2018-06-26 13:46:32 -05:00
Jeff Bumgardner 292349c4d3 [docs] add missing Doxygen comments for radio (#2832) 2018-06-26 11:21:45 -05:00
Jonathan Hui e22f391af2 [da15000] resolve compiler warnings (#2831) 2018-06-26 11:20:10 -05:00
Tomas Cerskus 6b80574d10 [efr32] fix building errors on boards without FEM (#2830) 2018-06-26 11:19:04 -05:00
Yakun Xu 1b14a36a35 [posix] radio only host side driver (#2690) 2018-06-25 16:32:32 -07:00
Abtin Keshavarzian 17eace65e2 [child-table] fix typo in constant name (#2826) 2018-06-25 12:03:12 -07:00
Abtin Keshavarzian 2d973955a9 [child/router-table] overload ++ operator to advance iterators (#2828) 2018-06-25 07:04:55 -07:00
Abtin Keshavarzian d99a2cea8f [mesh-forwarder] limit mesh header message logging to FTD build (#2827)
This commit moves the methods related to logging mesh header
messages in `mesh_forwarder_ftd.cpp` and limit their scope to FTD
build. This helps reduce the code size of MTD build with logs
enabled.
2018-06-25 07:01:45 -07:00
Abtin Keshavarzian 8cc6848d67 [mac] simplify Mac::SetNetworkName(string) (#2825) 2018-06-25 06:44:04 -07:00
Abtin Keshavarzian 8f15ef3fbb [mle] reset the attach counter and restart backoff on "mode" change (#2824)
This changes addresses the situation where we have a single device
in network configured as sleepy end-device going through attach
backoff intervals and then user changes the device mode to be
non-sleepy and FTD. This change ensures that device become leader
quickly.
2018-06-25 06:43:36 -07:00
Abtin Keshavarzian 9ce38e0161 [notifier] always signal changed state/config for the first time (#2818)
This commit adds new logic in `Notifier` class (and how it is used) to
ensure when state/configuration is changed, each of the OT_CHANGED_*
events (e.g., channel, network name) is signaled for the first time
(even in case new set value is same as before).

This change addresses an issue where if user sets a parameter (using
OpenThread public APIs) before starting Thread operation the event
indicating the change would not be emitted.

This commit also defines `otChangedFlags` and `Notifier::Flags`
types, and updates the logging in `Notifier` to use `String` class.
2018-06-22 15:09:18 -07:00
Kamil Sroka d5797546e1 [link-raw] handle mIsCcaEnabled flag with software retransmit (#2821) 2018-06-22 09:23:50 -07:00
Kamil Sroka aa48f4d7b7 [nrf52840] fix building with link raw enabled (#2820) 2018-06-22 09:23:12 -07:00
Kamil Sroka a7b3ac780a [nrf52840] fix frames handling with disabled CCA (#2819) 2018-06-22 09:22:54 -07:00
Shu Chen 0616997957 [mac] separate aes ccm process from ProcessTransmitSecurity() method (#2810)
Create a new ProcessTransmitAesCcm() method, which is safe to be called in
interrupt context.
2018-06-21 08:45:19 -07:00
Jonathan Hui 4241b87800 [router-table] clear router table when changing partitions (#2809) 2018-06-21 08:44:09 -07:00
Yakun Xu b8333732fa [ncp] make NCP sources pretty (#2811) 2018-06-20 13:15:13 -07:00
Abtin Keshavarzian 9e2d7181ae [mesh-forwarder] add logs for forwarded MeshHeader messages (#2783)
This commit adds a new method `MeshForwarder::LogMeshMessage()` to log
info about messages with `MeshHeader` (messages that are forwarded by
device). The new logs indicate  when a message is received/sent or
possibly dropped. The immediate source and destination for the
received or sent frame is logged. The new logs include info from
`MeshHeader` such as mesh source, mesh destination, number of hops
left. If the message is fragmented, info from fragment header such as
datagram tag and offset is included in the logs. For a non-fragmented
or a  first fragment, `LogMeshMessage()` will also decompress the IPv6
and transport (UDP/TCP) headers and provide info from them such as
IPv6 source/destination addresses, UDP/TCP checksum, source/destination
port numbers.

In addition to the new logs, this commit add the following changes:
- Adds `\t` to log lines which are grouped (make it easier to read).
- Adds `const` qualifiers to some methods in `Lowpan::MeshHeader`.
- Adds new method in `FragmentHeader` to init it from a `Message`.
- Refactors/updates some methods in `Lowpan` class (e.g., adding new
  public method to decompress LOWPAN_NHC UDP header).
2018-06-19 12:22:29 -07:00
Kamil Burzynski 403723dc82 [mle] minor TLV and route table cleanup (#2807) 2018-06-19 09:59:13 -07:00
Yakun Xu b5f22dcb5d [posix] remove duplicated definition in Makefile-posix (#2808) 2018-06-19 08:41:14 -07:00
1340 changed files with 336119 additions and 152157 deletions
+1 -1
View File
@@ -42,13 +42,13 @@ REM Copy the relavant include headers
copy include\openthread\commissioner.h release\include\openthread
copy include\openthread\dataset.h release\include\openthread
copy include\openthread\error.h release\include\openthread
copy include\openthread\instance.h release\include\openthread
copy include\openthread\ip6.h release\include\openthread
copy include\openthread\joiner.h release\include\openthread
copy include\openthread\link.h release\include\openthread
copy include\openthread\message.h release\include\openthread
copy include\openthread\netdata.h release\include\openthread
copy include\openthread\openthread.h release\include\openthread
copy include\openthread\thread.h release\include\openthread
copy include\openthread\types.h release\include\openthread
copy include\openthread\platform\toolchain.h release\include\openthread\platform
+2 -6
View File
@@ -1,7 +1,3 @@
GitHub Issues are for bugs and feature requests. To make bugs and feature requests more easy to find and organize, we close issues that are deemed out of scope for GitHub Issues.
GitHub Issues are for bugs and feature requests. To make bugs and feature requests more easy to find and organize, we close issues that are deemed out of scope for GitHub Issues.
Usage questions? Post questions to [Stack Overflow](http://stackoverflow.com/) using the [[openthread] tag](http://stackoverflow.com/questions/tagged/openthread). We also use Google Groups for discussion and announcements:
* [openthread-announce](https://groups.google.com/forum/#!forum/openthread-announce) - subscribe for release notes and new updates on OpenThread
* [openthread-users](https://groups.google.com/forum/#!forum/openthread-users) - the best place for users to discuss OpenThread and interact with the OpenThread team
* [openthread-devel](https://groups.google.com/forum/#!forum/openthread-devel) - team members discuss the on-going development of OpenThread
The openthread-users Google Group is the recommended place for users to discuss OpenThread and interact directly with the OpenThread community. https://groups.google.com/forum/#!forum/openthread-users
+24
View File
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Information to reproduce the behavior, including:
1. Git commit id
2. IEEE 802.15.4 hardware platform
3. Build steps
4. Network topology
**Expected behavior**
A clear and concise description of what you expected to happen.
**Console/log output**
If applicable, add console/log output to help explain your problem.
**Additional context**
Add any other context about the problem here.
+17
View File
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+45 -14
View File
@@ -26,7 +26,8 @@
# POSSIBILITY OF SUCH DAMAGE.
#
language: generic
language: python
python: "3.6"
sudo: required
dist: trusty
@@ -47,17 +48,31 @@ after_success:
matrix:
include:
- env: BUILD_TARGET="posix-distcheck" CC=clang-5.0 CXX=clang++-5.0 VERBOSE=1 VIRTUAL_TIME=1
- env: BUILD_TARGET="posix-app-cli" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
- env: BUILD_TARGET="posix-app-ncp" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
- env: BUILD_TARGET="posix-app-pty" VERBOSE=1
os: linux
compiler: gcc
- env: BUILD_TARGET="android-build" VERBOSE=1
os: linux
python: "2.7"
- env: BUILD_TARGET="posix-distcheck" CC=clang-6.0 CXX=clang++-6.0 VERBOSE=1 VIRTUAL_TIME=1
os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
- llvm-toolchain-trusty-6.0
- ubuntu-toolchain-r-test
packages:
- clang-5.0
- clang-6.0
- env: BUILD_TARGET="posix-32-bit" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
python: "2.7"
- env: BUILD_TARGET="posix-ncp" VERBOSE=1 VIRTUAL_TIME=1
os: linux
compiler: gcc
@@ -72,34 +87,36 @@ matrix:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
- env: BUILD_TARGET="scan-build" CC="clang" CXX="clang++"
- env: BUILD_TARGET="scan-build" CC="clang-6.0" CXX="clang++-6.0"
os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
- llvm-toolchain-trusty-6.0
- ubuntu-toolchain-r-test
packages:
- clang-5.0
- env: BUILD_TARGET="arm-gcc49"
- clang-6.0
- env: BUILD_TARGET="arm-gcc-4"
os: linux
compiler: gcc
- env: BUILD_TARGET="arm-gcc54"
- env: BUILD_TARGET="arm-gcc-5"
os: linux
compiler: gcc
- env: BUILD_TARGET="arm-gcc63"
- env: BUILD_TARGET="arm-gcc-6"
os: linux
compiler: gcc
- env: BUILD_TARGET="arm-gcc7"
- env: BUILD_TARGET="arm-gcc-7"
os: linux
compiler: gcc
- env: BUILD_TARGET="posix" CC=clang-5.0 CXX=clang++-5.0
- env: BUILD_TARGET="posix" CC=clang-6.0 CXX=clang++-6.0
os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
- llvm-toolchain-trusty-6.0
- ubuntu-toolchain-r-test
packages:
- clang-5.0
- clang-6.0
- env: BUILD_TARGET="posix" CC="gcc-5" CXX="g++-5"
os: linux
compiler: gcc
@@ -130,9 +147,23 @@ matrix:
packages:
- gcc-7
- g++-7
- env: BUILD_TARGET="posix" CC="gcc-8" CXX="g++-8"
os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-8
- g++-8
- env: BUILD_TARGET="posix-ncp-spi" VERBOSE=1
os: linux
compiler: gcc
- env: BUILD_TARGET="toranj-test-framework" VERBOSE=1
os: linux
compiler: gcc
- env: BUILD_TARGET="toranj-test-framework" VERBOSE=1 TORANJ_POSIX_APP_RCP_MODEL=1
os: linux
compiler: gcc
python: "2.7"
+50 -16
View File
@@ -39,24 +39,60 @@ cd /tmp || die
[ $TRAVIS_OS_NAME != linux ] || {
sudo apt-get update || die
[ $BUILD_TARGET != posix-distcheck -a $BUILD_TARGET != posix-32-bit -a $BUILD_TARGET != posix-mtd -a $BUILD_TARGET != posix-ncp ] || {
pip install --user --upgrade pip || die
pip install --user -r $TRAVIS_BUILD_DIR/tests/scripts/thread-cert/requirements.txt || die
[ $BUILD_TARGET != posix-ncp ] || {
[ $BUILD_TARGET != posix-distcheck -a $BUILD_TARGET != posix-32-bit -a $BUILD_TARGET != posix-app-cli -a $BUILD_TARGET != posix-mtd -a $BUILD_TARGET != posix-ncp -a $BUILD_TARGET != posix-app-ncp ] || {
pip install --upgrade pip || die
pip install -r $TRAVIS_BUILD_DIR/tests/scripts/thread-cert/requirements.txt || die
[ $BUILD_TARGET != posix-ncp -a $BUILD_TARGET != posix-app-ncp ] || {
# Packages used by ncp tools.
pip install --user git+https://github.com/openthread/pyspinel || die
pip install git+https://github.com/openthread/pyspinel || die
}
}
[ $BUILD_TARGET != android-build ] || {
sudo apt-get install -y bison gcc-multilib g++-multilib
(
cd $HOME
wget https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip
unzip android-ndk-r17c-linux-x86_64.zip > /dev/null
mv android-ndk-r17c ndk-bundle
) || die
}
[ $BUILD_TARGET != pretty-check ] || {
clang-format --version || die
}
[ $BUILD_TARGET != posix-app-pty ] || {
sudo apt-get install socat expect libdbus-1-dev autoconf-archive || die
JOBS=$(getconf _NPROCESSORS_ONLN)
(
WPANTUND_TMPDIR=/tmp/wpantund
git clone --depth 1 https://github.com/openthread/wpantund.git $WPANTUND_TMPDIR
cd $WPANTUND_TMPDIR
./bootstrap.sh
./configure --prefix= --exec-prefix=/usr --disable-ncp-dummy --enable-static-link-ncp-plugin=spinel
make -j $JOBS
sudo make install
) || die
(
LIBCOAP_TMPDIR=/tmp/libcoap
mkdir $LIBCOAP_TMPDIR
cd $LIBCOAP_TMPDIR
wget https://github.com/obgm/libcoap/archive/bsd-licensed.tar.gz
tar xvf bsd-licensed.tar.gz
cd libcoap-bsd-licensed
./autogen.sh
./configure --prefix= --exec-prefix=/usr --with-boost=internal --disable-tests --disable-documentation
make -j $JOBS
sudo make install
) || die
}
[ $BUILD_TARGET != scan-build ] || {
sudo apt-get install clang || die
}
[ $BUILD_TARGET != arm-gcc49 ] || {
[ $BUILD_TARGET != arm-gcc-4 ] || {
sudo apt-get install lib32z1 || die
wget https://launchpad.net/gcc-arm-embedded/4.9/4.9-2015-q3-update/+download/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2 || die
@@ -64,16 +100,15 @@ cd /tmp || die
arm-none-eabi-gcc --version || die
}
[ $BUILD_TARGET != arm-gcc54 ] || {
[ $BUILD_TARGET != arm-gcc-5 ] || {
sudo apt-get install lib32z1 || die
wget https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update/+download/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 || die
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/5_4-2016q3/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-5_4-2016q3/bin:$PATH || die
arm-none-eabi-gcc --version || die
}
[ $BUILD_TARGET != arm-gcc63 ] || {
sudo apt-get install lib32z1 || die
[ $BUILD_TARGET != arm-gcc-6 ] || {
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-6-2017-q2-update/bin:$PATH || die
@@ -85,11 +120,10 @@ cd /tmp || die
arc-elf32-gcc --version || die
}
[ $BUILD_TARGET != arm-gcc7 ] || {
sudo apt-get install lib32z1 || die
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-7-2017-q4-major/bin:$PATH || die
[ $BUILD_TARGET != arm-gcc-7 ] || {
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 || die
tar xjf gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2 || die
export PATH=/tmp/gcc-arm-none-eabi-7-2018-q2-update/bin:$PATH || die
arm-none-eabi-gcc --version || die
}
@@ -102,7 +136,7 @@ cd /tmp || die
sudo apt-get install llvm-3.4-runtime || die
}
[ $BUILD_TARGET != posix -o $CC != clang ] || {
[ $BUILD_TARGET != posix -o "$CC" != clang ] || {
sudo apt-get install clang || die
}
+107
View File
@@ -0,0 +1,107 @@
#!/bin/sh
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#
# Run this command on parent directory of openthread
#
set -e
set -x
#######################################
# Prepare android build system
# Globals:
# None
# Arguments:
# None
# Returns:
# None
#######################################
android_prepare_build_system()
{
# Android build system
(mkdir build && cd build && git init && git pull --depth 1 https://android.googlesource.com/platform/build 2db32730e79cafcf13e1f898a7bee7f82b0449d6)
ln -s build/core/main.mk Makefile
# Workarounds for java checking
export ANDROID_JAVA_HOME=/usr/lib/jvm/java-8-oracle
mkdir bin
cat > bin/java <<EOF
#!/bin/sh
echo java version \"1.6\"
EOF
cat > bin/javac <<EOF
echo javac \"1.6\"
EOF
chmod a+x bin/java bin/javac
export PATH=$(pwd)/bin:$PATH
# Files for building ndk
mkdir -p system/core/include/arch/linux-arm
touch system/core/include/arch/linux-arm/AndroidConfig.h
mkdir -p system/core/include/arch/linux-x86
touch system/core/include/arch/linux-x86/AndroidConfig.h
ANDROID_NDK_PATH=$HOME/ndk-bundle
mkdir -p bionic/libc/
cp -r $ANDROID_NDK_PATH/sysroot/usr/include bionic/libc/include
mv bionic/libc/include/arm-linux-androideabi/asm bionic/libc/include/asm
mkdir -p out/target/product/generic/obj/
cp -r $ANDROID_NDK_PATH/platforms/android-27/arch-arm/usr/lib out/target/product/generic/obj/
mkdir -p bionic/libstdc++
cp -r $ANDROID_NDK_PATH/sources/cxx-stl/gnu-libstdc++/4.9/include bionic/libstdc++
cp -r $ANDROID_NDK_PATH/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include/* bionic/libstdc++/include
# The default libstdc++.so does not contain full stl implementation, see https://developer.android.com/ndk/guides/cpp-support
cp -r $ANDROID_NDK_PATH/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_shared.so out/target/product/generic/obj/lib/libstdc++.so
# Build spec
cat > buildspec.mk <<EOF
TARGET_PRODUCT := generic
TARGET_BUILD_VARIANT := eng
TARGET_BUILD_TYPE := release
TARGET_TOOLS_PREFIX := $ANDROID_NDK_PATH/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
EOF
}
main() {
android_prepare_build_system
make showcommands ot-core
make showcommands ot-cli
make showcommands ot-ncp
test -x out/target/product/generic/system/bin/ot-cli
test -x out/target/product/generic/system/bin/ot-ncp
}
main "$@"
+115
View File
@@ -0,0 +1,115 @@
#!/bin/bash
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
set -e
set -x
die() {
echo " *** ERROR: " $*
exit 1
}
at_exit() {
EXIT_CODE=$?
sudo killall wpantund || true
killall socat || true
exit $EXIT_CODE
}
build() {
./bootstrap
COVERAGE=1 make -f examples/Makefile-posix
COVERAGE=1 make -f src/posix/Makefile-posix PLATFORM_UDP=1
}
check() {
trap at_exit INT TERM EXIT
SOCAT_OUTPUT=/tmp/ot-socat
socat -d -d pty,raw,b115200,echo=0 pty,raw,b115200,echo=0 > /dev/null 2> $SOCAT_OUTPUT &
while true; do
if test $(head -n2 $SOCAT_OUTPUT | wc -l) = 2; then
RADIO_PTY=$(head -n1 $SOCAT_OUTPUT | grep -o '/dev/.\+')
CORE_PTY=$(head -n2 $SOCAT_OUTPUT | tail -n1 | grep -o '/dev/.\+')
break
fi
echo 'Waiting for socat ready...'
sleep 1
done
echo 'RADIO_PTY' $DEVICE_PTY
echo 'CORE_PTY' $CORE_PTY
RADIO_NCP_PATH="$(pwd)/$(ls output/*linux*/bin/ot-ncp-radio)"
$RADIO_NCP_PATH 1 > $RADIO_PTY < $RADIO_PTY &
OT_NCP_PATH="$(pwd)/$(ls output/posix/*linux*/bin/ot-ncp)"
PLATFORM_NETIF=wpan0 sudo -E wpantund -I wpan0 -o Thread:Config:FilterRLOCAddresses 0 -s "system:${OT_NCP_PATH} ${CORE_PTY}" &
while true; do
sleep 5
if sudo wpanctl status; then
break
else
echo 'Still waiting for wpantund'
fi
done
sudo wpanctl leave || true
sudo wpanctl form -c 18 OpenThreadTest
mleid=$(sudo wpanctl status | grep MeshLocalAddress | cut -d'"' -f4)
echo "ML-EID is: ${mleid}"
netstat -an | grep -q 61631 || die 'TMF port is not available!'
xaddress=$(sudo wpanctl get 'NCP:ExtendedAddress' | cut -d= -f2 | tr -d ' []')
echo "Extended address is: ${xaddress}"
# Retrievie extended address through network diagnostic get
coap_response=$(echo -n '120100' | xxd -r -p | coap-client -m POST coap://[${mleid}]:61631/d/dg -f- | xxd -p -u | grep 0008)
echo "CoAP response is: ${coap_response}"
# Verify CoAP response contains the extended address
[[ "${coap_response}" = *${xaddress}* ]] || die 'failed to get extended address'
# Leave so that code coverage will be flushed
sudo wpanctl leave || true
}
main() {
case $1 in
check)
check
;;
*)
build
check
;;
esac
}
main "$@"
+113 -44
View File
@@ -34,6 +34,8 @@ die() {
set -x
python --version || die
[ $BUILD_TARGET != pretty-check ] || {
./bootstrap || die
./configure || die
@@ -52,6 +54,7 @@ set -x
--with-ncp-bus=uart \
--with-examples=posix \
--enable-application-coap \
--enable-application-coap-secure \
--enable-border-router \
--enable-cert-log \
--enable-child-supervision \
@@ -71,7 +74,11 @@ set -x
scan-build --status-bugs -analyze-headers -v make || die
}
[ $BUILD_TARGET != arm-gcc49 ] || {
[ $BUILD_TARGET != android-build ] || {
(cd .. && ${TRAVIS_BUILD_DIR}/.travis/check-android-build) || die
}
[ $BUILD_TARGET != arm-gcc-4 ] || {
export PATH=/tmp/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH || die
git checkout -- . || die
@@ -104,13 +111,22 @@ set -x
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 TMF_PROXY=1 make -f examples/Makefile-nrf52840 || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 LINK_RAW=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 UDP_PROXY=1 make -f examples/Makefile-nrf52840 || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-radio || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc1352 || die
arm-none-eabi-size output/cc1352/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc1352/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc1352/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc1352/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
@@ -140,7 +156,7 @@ set -x
arm-none-eabi-size output/samr21/bin/ot-ncp-mtd || die
}
[ $BUILD_TARGET != arm-gcc54 ] || {
[ $BUILD_TARGET != arm-gcc-5 ] || {
export PATH=/tmp/gcc-arm-none-eabi-5_4-2016q3/bin:$PATH || die
git checkout -- . || die
@@ -173,13 +189,22 @@ set -x
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 TMF_PROXY=1 make -f examples/Makefile-nrf52840 || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 UDP_PROXY=1 make -f examples/Makefile-nrf52840 || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-radio || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc1352 || die
arm-none-eabi-size output/cc1352/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc1352/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc1352/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc1352/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
@@ -209,7 +234,7 @@ set -x
arm-none-eabi-size output/samr21/bin/ot-ncp-mtd || die
}
[ $BUILD_TARGET != arm-gcc63 ] || {
[ $BUILD_TARGET != arm-gcc-6 ] || {
export PATH=/tmp/gcc-arm-none-eabi-6-2017-q2-update/bin:$PATH || die
git checkout -- . || die
@@ -221,14 +246,14 @@ set -x
arm-none-eabi-size output/cc2538/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-mtd || die
# git checkout -- . || die
# git clean -xfd || die
# ./bootstrap || die
# COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
# arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
# arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
# arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
# arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
@@ -242,13 +267,22 @@ set -x
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 TMF_PROXY=1 make -f examples/Makefile-nrf52840 || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 UDP_PROXY=1 make -f examples/Makefile-nrf52840 || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-radio || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc1352 || die
arm-none-eabi-size output/cc1352/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc1352/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc1352/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc1352/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
@@ -289,8 +323,8 @@ set -x
arc-elf32-size output/emsk/bin/ot-ncp-mtd || die
}
[ $BUILD_TARGET != arm-gcc7 ] || {
export PATH=/tmp/gcc-arm-none-eabi-7-2017-q4-major/bin:$PATH || die
[ $BUILD_TARGET != arm-gcc-7 ] || {
export PATH=/tmp/gcc-arm-none-eabi-7-2018-q2-update/bin:$PATH || die
git checkout -- . || die
git clean -xfd || die
@@ -301,14 +335,14 @@ set -x
arm-none-eabi-size output/cc2538/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2538/bin/ot-ncp-mtd || die
# git checkout -- . || die
# git clean -xfd || die
# ./bootstrap || die
# COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
# arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
# arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
# arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
# arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-da15000 || die
arm-none-eabi-size output/da15000/bin/ot-cli-ftd || die
arm-none-eabi-size output/da15000/bin/ot-cli-mtd || die
arm-none-eabi-size output/da15000/bin/ot-ncp-ftd || die
arm-none-eabi-size output/da15000/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
@@ -322,13 +356,22 @@ set -x
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 TMF_PROXY=1 make -f examples/Makefile-nrf52840 || die
BORDER_ROUTER=1 COAP=1 COMMISSIONER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 FULL_LOGS=1 JOINER=1 MAC_FILTER=1 MTD_NETDIAG=1 SERVICE=1 UDP_PROXY=1 make -f examples/Makefile-nrf52840 || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-cli-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-ftd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-mtd || die
arm-none-eabi-size output/nrf52840/bin/ot-ncp-radio || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-cc1352 || die
arm-none-eabi-size output/cc1352/bin/ot-cli-ftd || die
arm-none-eabi-size output/cc1352/bin/ot-cli-mtd || die
arm-none-eabi-size output/cc1352/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc1352/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
@@ -345,17 +388,17 @@ set -x
arm-none-eabi-size output/cc2652/bin/ot-ncp-ftd || die
arm-none-eabi-size output/cc2652/bin/ot-ncp-mtd || die
git checkout -- . || die
git clean -xfd || die
wget http://ww1.microchip.com/downloads/en/DeviceDoc/asf-standalone-archive-3.36.0.58.zip || die
unzip -qq asf-standalone-archive-3.36.0.58.zip || die
mv xdk-asf-3.36.0 third_party/microchip/asf || die
./bootstrap || die
COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-samr21 || die
arm-none-eabi-size output/samr21/bin/ot-cli-ftd || die
arm-none-eabi-size output/samr21/bin/ot-cli-mtd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-ftd || die
arm-none-eabi-size output/samr21/bin/ot-ncp-mtd || die
# git checkout -- . || die
# git clean -xfd || die
# wget http://ww1.microchip.com/downloads/en/DeviceDoc/asf-standalone-archive-3.36.0.58.zip || die
# unzip -qq asf-standalone-archive-3.36.0.58.zip || die
# mv xdk-asf-3.36.0 third_party/microchip/asf || die
# ./bootstrap || die
# COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 DNS_CLIENT=1 make -f examples/Makefile-samr21 || die
# arm-none-eabi-size output/samr21/bin/ot-cli-ftd || die
# arm-none-eabi-size output/samr21/bin/ot-cli-mtd || die
# arm-none-eabi-size output/samr21/bin/ot-ncp-ftd || die
# arm-none-eabi-size output/samr21/bin/ot-ncp-mtd || die
}
[ $BUILD_TARGET != posix ] || {
@@ -376,7 +419,9 @@ set -x
git clean -xfd || die
./bootstrap || die
./configure \
--enable-ncp-app=all \
--enable-ncp \
--enable-ftd \
--enable-mtd \
--with-ncp-bus=spi \
--with-examples=posix \
--enable-border-router \
@@ -389,14 +434,15 @@ set -x
--enable-channel-manager \
--enable-channel-monitor \
--disable-docs \
--disable-test || die
--disable-tests || die
make -j 8 || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
./configure \
--enable-cli-app=mtd \
--enable-cli \
--enable-mtd \
--with-ncp-bus=spi \
--with-examples=posix \
--enable-border-router \
@@ -405,15 +451,18 @@ set -x
--enable-mac-filter \
--enable-service \
--disable-docs \
--disable-test || die
--disable-tests || die
make -j 8 || die
git checkout -- . || die
git clean -xfd || die
./bootstrap || die
./configure \
--enable-cli-app=all \
--enable-ncp-app=all \
--enable-cli \
--enable-ncp \
--enable-ftd \
--enable-mtd \
--enable-radio-only \
--with-ncp-bus=uart \
--with-examples=posix || die
make -j 8 || die
@@ -432,6 +481,18 @@ set -x
COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make -f examples/Makefile-posix check || die
}
[ $BUILD_TARGET != posix-app-cli ] || {
./bootstrap || die
# enable code coverage for OpenThread transceiver only
COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix || die
COVERAGE=1 make -f src/posix/Makefile-posix || die
COVERAGE=1 PYTHONUNBUFFERED=1 OT_CLI_PATH="$(pwd)/$(ls output/posix/*/bin/ot-cli)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-ncp-radio)" make -f src/posix/Makefile-posix check || die
}
[ $BUILD_TARGET != posix-app-pty ] || {
.travis/check-posix-app-pty || die
}
[ $BUILD_TARGET != posix-mtd ] || {
./bootstrap || die
COVERAGE=1 CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 USE_MTD=1 make -f examples/Makefile-posix check || die
@@ -439,12 +500,20 @@ set -x
[ $BUILD_TARGET != posix-ncp-spi ] || {
./bootstrap || die
make -f examples/Makefile-posix check configure_OPTIONS="--enable-ncp-app=ftd --with-ncp-bus=spi --with-examples=posix" || die
make -f examples/Makefile-posix check configure_OPTIONS="--enable-ncp --enable-ftd --with-ncp-bus=spi --with-examples=posix" || die
}
[ $BUILD_TARGET != posix-app-ncp ] || {
./bootstrap || die
COVERAGE=1 VIRTUAL_TIME_UART=1 make -f examples/Makefile-posix || die
# enable code coverage for OpenThread posix radio
COVERAGE=1 make -f src/posix/Makefile-posix || die
COVERAGE=1 PYTHONUNBUFFERED=1 OT_NCP_PATH="$(pwd)/$(ls output/posix/*/bin/ot-ncp)" RADIO_DEVICE="$(pwd)/$(ls output/*/bin/ot-ncp-radio)" NODE_TYPE=ncp-sim make -f src/posix/Makefile-posix check || die
}
[ $BUILD_TARGET != posix-ncp ] || {
./bootstrap || die
NODE_TYPE=ncp-sim make -f examples/Makefile-posix check || die
COVERAGE=1 PYTHONUNBUFFERED=1 NODE_TYPE=ncp-sim make -f examples/Makefile-posix check || die
}
[ $BUILD_TARGET != toranj-test-framework ] || {
+301
View File
@@ -0,0 +1,301 @@
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-core
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/ncp \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/third_party \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
-D_GNU_SOURCE \
-DMBEDTLS_CONFIG_FILE=\"mbedtls-config.h\" \
-DOPENTHREAD_CONFIG_FILE=\<openthread-config-android.h\> \
-DOPENTHREAD_CONFIG_POSIX_APP_ENABLE_PTY_DEVICE=1 \
-DOPENTHREAD_FTD=1 \
-DOPENTHREAD_POSIX=1 \
-DOPENTHREAD_POSIX_APP=1 \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-posix-config.h\" \
-DSPINEL_PLATFORM_HEADER=\"spinel_platform.h\" \
-Wno-error=non-virtual-dtor \
$(NULL)
LOCAL_SRC_FILES := \
src/core/api/border_router_api.cpp \
src/core/api/channel_manager_api.cpp \
src/core/api/channel_monitor_api.cpp \
src/core/api/child_supervision_api.cpp \
src/core/api/coap_api.cpp \
src/core/api/commissioner_api.cpp \
src/core/api/crypto_api.cpp \
src/core/api/dataset_api.cpp \
src/core/api/dataset_ftd_api.cpp \
src/core/api/dhcp6_api.cpp \
src/core/api/dns_api.cpp \
src/core/api/icmp6_api.cpp \
src/core/api/instance_api.cpp \
src/core/api/ip6_api.cpp \
src/core/api/jam_detection_api.cpp \
src/core/api/joiner_api.cpp \
src/core/api/link_api.cpp \
src/core/api/link_raw_api.cpp \
src/core/api/message_api.cpp \
src/core/api/netdata_api.cpp \
src/core/api/server_api.cpp \
src/core/api/tasklet_api.cpp \
src/core/api/thread_api.cpp \
src/core/api/thread_ftd_api.cpp \
src/core/api/udp_api.cpp \
src/core/coap/coap.cpp \
src/core/coap/coap_header.cpp \
src/core/coap/coap_secure.cpp \
src/core/common/crc16.cpp \
src/core/common/instance.cpp \
src/core/common/logging.cpp \
src/core/common/locator.cpp \
src/core/common/message.cpp \
src/core/common/notifier.cpp \
src/core/common/settings.cpp \
src/core/common/string.cpp \
src/core/common/tasklet.cpp \
src/core/common/timer.cpp \
src/core/common/tlvs.cpp \
src/core/common/trickle_timer.cpp \
src/core/crypto/aes_ccm.cpp \
src/core/crypto/aes_ecb.cpp \
src/core/crypto/hmac_sha256.cpp \
src/core/crypto/mbedtls.cpp \
src/core/crypto/pbkdf2_cmac.cpp \
src/core/crypto/sha256.cpp \
src/core/mac/mac.cpp \
src/core/mac/mac_filter.cpp \
src/core/mac/mac_frame.cpp \
src/core/meshcop/announce_begin_client.cpp \
src/core/meshcop/border_agent.cpp \
src/core/meshcop/commissioner.cpp \
src/core/meshcop/dataset.cpp \
src/core/meshcop/dataset_local.cpp \
src/core/meshcop/dataset_manager.cpp \
src/core/meshcop/dataset_manager_ftd.cpp \
src/core/meshcop/dtls.cpp \
src/core/meshcop/energy_scan_client.cpp \
src/core/meshcop/joiner.cpp \
src/core/meshcop/joiner_router.cpp \
src/core/meshcop/leader.cpp \
src/core/meshcop/meshcop.cpp \
src/core/meshcop/meshcop_tlvs.cpp \
src/core/meshcop/panid_query_client.cpp \
src/core/meshcop/timestamp.cpp \
src/core/net/dhcp6_client.cpp \
src/core/net/dhcp6_server.cpp \
src/core/net/dns_client.cpp \
src/core/net/icmp6.cpp \
src/core/net/ip6.cpp \
src/core/net/ip6_address.cpp \
src/core/net/ip6_filter.cpp \
src/core/net/ip6_headers.cpp \
src/core/net/ip6_mpl.cpp \
src/core/net/ip6_routes.cpp \
src/core/net/netif.cpp \
src/core/net/udp6.cpp \
src/core/thread/address_resolver.cpp \
src/core/thread/announce_begin_server.cpp \
src/core/thread/announce_sender.cpp \
src/core/thread/child_table.cpp \
src/core/thread/data_poll_manager.cpp \
src/core/thread/energy_scan_server.cpp \
src/core/thread/key_manager.cpp \
src/core/thread/link_quality.cpp \
src/core/thread/lowpan.cpp \
src/core/thread/mesh_forwarder.cpp \
src/core/thread/mesh_forwarder_ftd.cpp \
src/core/thread/mesh_forwarder_mtd.cpp \
src/core/thread/mle.cpp \
src/core/thread/mle_router.cpp \
src/core/thread/network_data.cpp \
src/core/thread/network_data_leader.cpp \
src/core/thread/network_data_leader_ftd.cpp \
src/core/thread/network_data_local.cpp \
src/core/thread/network_diagnostic.cpp \
src/core/thread/panid_query_server.cpp \
src/core/thread/router_table.cpp \
src/core/thread/src_match_controller.cpp \
src/core/thread/thread_netif.cpp \
src/core/thread/topology.cpp \
src/core/utils/channel_manager.cpp \
src/core/utils/channel_monitor.cpp \
src/core/utils/child_supervision.cpp \
src/core/utils/heap.cpp \
src/core/utils/jam_detector.cpp \
src/core/utils/missing_strlcpy.c \
src/core/utils/missing_strlcat.c \
src/core/utils/missing_strnlen.c \
src/core/utils/parse_cmdline.cpp \
src/core/utils/slaac_address.cpp \
src/diag/diag_process.cpp \
src/diag/openthread-diag.cpp \
src/ncp/hdlc.cpp \
src/ncp/ncp_spi.cpp \
src/ncp/spinel.c \
src/ncp/spinel_decoder.cpp \
src/ncp/spinel_encoder.cpp \
src/posix/platform/alarm.c \
src/posix/platform/misc.c \
src/posix/platform/logging.c \
src/posix/platform/random.c \
src/posix/platform/system.c \
src/posix/platform/uart.c \
src/posix/platform/spi-stubs.c \
src/posix/platform/frame_queue.cpp \
src/posix/platform/radio_spinel.cpp \
src/posix/platform/settings.cpp \
third_party/mbedtls/repo/library/md.c \
third_party/mbedtls/repo/library/md_wrap.c \
third_party/mbedtls/repo/library/memory_buffer_alloc.c \
third_party/mbedtls/repo/library/platform.c \
third_party/mbedtls/repo/library/sha256.c \
third_party/mbedtls/repo/library/bignum.c \
third_party/mbedtls/repo/library/ccm.c \
third_party/mbedtls/repo/library/cipher.c \
third_party/mbedtls/repo/library/cipher_wrap.c \
third_party/mbedtls/repo/library/cmac.c \
third_party/mbedtls/repo/library/ctr_drbg.c \
third_party/mbedtls/repo/library/debug.c \
third_party/mbedtls/repo/library/ecjpake.c \
third_party/mbedtls/repo/library/ecp_curves.c \
third_party/mbedtls/repo/library/entropy.c \
third_party/mbedtls/repo/library/entropy_poll.c \
third_party/mbedtls/repo/library/ssl_cookie.c \
third_party/mbedtls/repo/library/ssl_ciphersuites.c \
third_party/mbedtls/repo/library/ssl_cli.c \
third_party/mbedtls/repo/library/ssl_srv.c \
third_party/mbedtls/repo/library/ssl_ticket.c \
third_party/mbedtls/repo/library/ssl_tls.c \
third_party/mbedtls/repo/library/aes.c \
third_party/mbedtls/repo/library/ecp.c \
$(NULL)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-cli
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
-D_GNU_SOURCE \
-DOPENTHREAD_CONFIG_FILE=\<openthread-config-android.h\> \
-DOPENTHREAD_CONFIG_POSIX_APP_ENABLE_PTY_DEVICE=1 \
-DOPENTHREAD_FTD=1 \
-DOPENTHREAD_POSIX=1 \
-DOPENTHREAD_POSIX_APP=2 \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-posix-config.h\" \
-DSPINEL_PLATFORM_HEADER=\"spinel_platform.h\" \
-Wno-error=non-virtual-dtor \
$(NULL)
LOCAL_LDLIBS := \
-lutil
LOCAL_SRC_FILES := \
src/cli/cli.cpp \
src/cli/cli_coap.cpp \
src/cli/cli_console.cpp \
src/cli/cli_dataset.cpp \
src/cli/cli_uart.cpp \
src/cli/cli_udp_example.cpp \
src/posix/main.c \
$(NULL)
LOCAL_STATIC_LIBRARIES = ot-core
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := ot-ncp
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/ncp \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
-D_GNU_SOURCE \
-DOPENTHREAD_CONFIG_FILE=\<openthread-config-android.h\> \
-DOPENTHREAD_CONFIG_POSIX_APP_ENABLE_PTY_DEVICE=1 \
-DOPENTHREAD_FTD=1 \
-DOPENTHREAD_POSIX=1 \
-DOPENTHREAD_POSIX_APP=1 \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"openthread-core-posix-config.h\" \
-DSPINEL_PLATFORM_HEADER=\"spinel_platform.h\" \
-Wno-error=non-virtual-dtor \
$(NULL)
LOCAL_LDLIBS := \
-lutil
LOCAL_SRC_FILES := \
src/ncp/changed_props_set.cpp \
src/ncp/ncp_base.cpp \
src/ncp/ncp_base_mtd.cpp \
src/ncp/ncp_base_ftd.cpp \
src/ncp/ncp_base_dispatcher.cpp \
src/ncp/ncp_buffer.cpp \
src/ncp/ncp_uart.cpp \
src/posix/main.c \
$(NULL)
LOCAL_STATIC_LIBRARIES = ot-core
include $(BUILD_EXECUTABLE)
+8 -4
View File
@@ -33,25 +33,29 @@ AM_MAKEFLAGS = --no-print-directory
AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-address-sanitizer \
--enable-application-coap \
--enable-application-coap-secure \
--enable-border-router \
--enable-cli-app=all \
--enable-cli \
--enable-commissioner \
--enable-dhcp6-client \
--enable-dhcp6-server \
--enable-diag \
--enable-dns-client \
--enable-ftd \
--enable-joiner \
--enable-mac-filter \
--enable-ncp-app=all \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--enable-service \
--with-examples=posix \
--with-ncp-bus=uart \
$(NULL)
SUBDIRS = \
include \
src \
third_party \
src \
examples \
tests \
tools \
+407 -215
View File
@@ -68,7 +68,7 @@ AC_SUBST(LIBOPENTHREAD_VERSION_INFO, [${LIBOPENTHREAD_VERSION_CURRENT}:${LIB
# Check the sanity of the source directory by checking for the
# presence of a key watch file
#
AC_CONFIG_SRCDIR([include/openthread/openthread.h])
AC_CONFIG_SRCDIR([include/openthread/error.h])
#
# Tell autoconf where to find auxilliary build tools (e.g. config.guess,
@@ -233,7 +233,7 @@ AC_PATH_PROG(CMP, cmp)
#
PROSPECTIVE_CFLAGS="-Wall -Wextra -Wshadow -Werror -std=c99 -pedantic-errors"
PROSPECTIVE_CXXFLAGS="-Wall -Wextra -Wshadow -Werror -std=gnu++98 -Wno-c++14-compat"
PROSPECTIVE_CXXFLAGS="-Wall -Wextra -Wshadow -Werror -std=gnu++98 -Wno-c++14-compat -fno-exceptions -fno-rtti"
AC_CACHE_CHECK([whether $CC is Clang],
[nl_cv_clang],
@@ -373,177 +373,6 @@ NL_ENABLE_TESTS([yes])
AM_CONDITIONAL([OPENTHREAD_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"])
#
# CLI Library
#
AC_ARG_ENABLE(cli-app,
[AS_HELP_STRING([--enable-cli-app],[Enable CLI support (no|mtd|ftd|all) @<:@default=no@:>@.])],
[
case "${enableval}" in
all|both)
enable_cli_app=yes
enable_cli_app_mtd=yes
enable_cli_app_ftd=yes
;;
no|yes)
enable_cli_app=${enableval}
enable_cli_app_mtd=${enableval}
enable_cli_app_ftd=${enableval}
;;
mtd)
enable_cli_app=yes
enable_cli_app_mtd=yes
enable_cli_app_ftd=no
;;
ftd)
enable_cli_app=yes
enable_cli_app_mtd=no
enable_cli_app_ftd=yes
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-cli-app])
;;
esac
],
[
enable_cli_app=no
enable_cli_app_mtd=no
enable_cli_app_ftd=no])
AC_MSG_CHECKING([cli-app modes])
AC_MSG_RESULT(${enable_cli_app})
AM_CONDITIONAL([OPENTHREAD_ENABLE_CLI], [test "${enable_cli_app}" == "yes"])
AM_CONDITIONAL([OPENTHREAD_ENABLE_CLI_MTD], [test "${enable_cli_app_mtd}" == "yes"])
AM_CONDITIONAL([OPENTHREAD_ENABLE_CLI_FTD], [test "${enable_cli_app_ftd}" == "yes"])
AC_SUBST(OPENTHREAD_ENABLE_CLI)
AC_SUBST(OPENTHREAD_ENABLE_CLI_FTD)
AC_SUBST(OPENTHREAD_ENABLE_CLI_MTD)
#
# NCP app
#
AC_ARG_ENABLE(ncp-app,
[AS_HELP_STRING([--enable-ncp-app],[Enable NCP support (no|mtd|ftd|radio|all) @<:@default=no@:>@.])],
[
# Map all & both to yes
case "${enableval}" in
all)
enableval=yes
;;
*)
;;
esac
case "${enableval}" in
no|yes)
enable_ncp_app=${enableval}
enable_ncp_app_mtd=${enableval}
enable_ncp_app_ftd=${enableval}
enable_ncp_app_radio=${enableval}
;;
mtd)
enable_ncp_app=yes
enable_ncp_app_mtd=yes
enable_ncp_app_ftd=no
enable_ncp_app_radio=no
;;
ftd)
enable_ncp_app=yes
enable_ncp_app_mtd=no
enable_ncp_app_ftd=yes
enable_ncp_app_radio=no
;;
radio)
enable_ncp_app=yes
enable_ncp_app_mtd=no
enable_ncp_app_ftd=no
enable_ncp_app_radio=yes
;;
*)
AC_MSG_ERROR([Invalid value ${enableval} for --enable-ncp-app])
;;
esac
],
[
enable_ncp_app=no
enable_ncp_app_ftd=no
enable_ncp_app_mtd=no
enable_ncp_app_radio=no
]
)
AC_MSG_CHECKING([ncp-app modes])
AC_MSG_RESULT(${enable_ncp_app})
AC_MSG_CHECKING([should NCP support ftd])
AC_MSG_RESULT(${enable_ncp_app_ftd})
AC_MSG_CHECKING([should NCP support mtd])
AC_MSG_RESULT(${enable_ncp_app_mtd})
AC_MSG_CHECKING([should NCP support radio-only])
AC_MSG_RESULT(${enable_ncp_app_radio})
AC_SUBST(OPENTHREAD_ENABLE_NCP)
AC_SUBST(OPENTHREAD_ENABLE_NCP_MTD)
AC_SUBST(OPENTHREAD_ENABLE_NCP_FTD)
AC_SUBST(OPENTHREAD_ENABLE_NCP_RADIO)
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP], [test "${enable_ncp_app}" == "yes"])
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_MTD], [test "${enable_ncp_app_mtd}" == "yes"])
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_FTD], [test "${enable_ncp_app_ftd}" == "yes"])
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_RADIO], [test "${enable_ncp_app_radio}" == "yes"])
#
# NCP BUS - how does the NCP talk to the host?
#
AC_ARG_WITH(
[ncp-bus],
[AS_HELP_STRING([--with-ncp-bus],[Specify the NCP bus (none|spi|uart) @<:@default=none@:>@.])],
[
case "${with_ncp_bus}" in
"none")
OPENTHREAD_ENABLE_NCP_SPI=0
OPENTHREAD_ENABLE_NCP_UART=0
;;
"spi")
OPENTHREAD_ENABLE_NCP_SPI=1
OPENTHREAD_ENABLE_NCP_UART=0
;;
"uart")
OPENTHREAD_ENABLE_NCP_SPI=0
OPENTHREAD_ENABLE_NCP_UART=1
;;
*)
AC_MSG_ERROR([unexpected --with-ncp-bus=${with_ncp_bus}])
;;
esac
],
[
OPENTHREAD_ENABLE_NCP_SPI=0
OPENTHREAD_ENABLE_NCP_UART=0
])
AC_SUBST(OPENTHREAD_ENABLE_NCP_SPI)
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_SPI], [test "${with_ncp_bus}" = "spi"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP_SPI],[${OPENTHREAD_ENABLE_NCP_SPI}],[Define to 1 to enable the NCP SPI interface.])
AC_MSG_CHECKING([should NCP support SPI])
AC_MSG_RESULT([${OPENTHREAD_ENABLE_SPI}])
AC_SUBST(OPENTHREAD_ENABLE_NCP_UART)
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_UART], [test "${with_ncp_bus}" = "uart"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP_UART],[${OPENTHREAD_ENABLE_NCP_UART}],[Define to 1 to enable the NCP UART interface.])
AC_MSG_CHECKING([should NCP support UART])
AC_MSG_RESULT([${OPENTHREAD_ENABLE_UART}])
#
# Multiple OpenThread Instances
#
@@ -598,7 +427,6 @@ AC_ARG_ENABLE(builtin-mbedtls,
if test "$enable_builtin_mbedtls" = "yes" -a ! "${MBEDTLS_CPPFLAGS}"; then
MBEDTLS_CPPFLAGS="-I\${abs_top_srcdir}/third_party/mbedtls"
MBEDTLS_CPPFLAGS="${MBEDTLS_CPPFLAGS} -I\${abs_top_srcdir}/third_party/mbedtls/repo/include"
MBEDTLS_CPPFLAGS="${MBEDTLS_CPPFLAGS} -I\${abs_top_srcdir}/third_party/mbedtls/repo/include/mbedtls"
MBEDTLS_CPPFLAGS="${MBEDTLS_CPPFLAGS} -DMBEDTLS_CONFIG_FILE=\\\"mbedtls-config.h\\\""
fi
AC_MSG_CHECKING([whether mbed TLS should be enabled])
@@ -606,36 +434,303 @@ AC_MSG_RESULT(${enable_builtin_mbedtls})
AM_CONDITIONAL([OPENTHREAD_ENABLE_BUILTIN_MBEDTLS], [test "${enable_builtin_mbedtls}" = "yes"])
#
# Thread TMF Proxy
# POSIX Application
#
AC_MSG_CHECKING([whether to enable TMF proxy])
AC_ARG_ENABLE(tmf_proxy,
[AS_HELP_STRING([--enable-tmf-proxy],[Enable TMF proxy support @<:@default=no@:>@.])],
AC_MSG_CHECKING([whether to build POSIX applicaton])
AC_ARG_ENABLE(posix-app,
[AS_HELP_STRING([--enable-posix-app], [Build POSIX application @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_tmf_proxy=${enableval}
enable_posix_app=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_tmf_proxy} for --enable-tmf-proxy])
AC_MSG_ERROR([Invalid value ${enable_posix_app} for --enable-posix-app])
;;
esac
],
[enable_tmf_proxy=no])
[enable_posix_app=no])
if test "$enable_tmf_proxy" = "yes"; then
OPENTHREAD_ENABLE_TMF_PROXY=1
if test "$enable_posix_app" = "yes"; then
OPENTHREAD_ENABLE_POSIX_APP=1
else
OPENTHREAD_ENABLE_TMF_PROXY=0
OPENTHREAD_ENABLE_POSIX_APP=0
fi
AC_MSG_RESULT(${enable_tmf_proxy})
AC_SUBST(OPENTHREAD_ENABLE_TMF_PROXY)
AM_CONDITIONAL([OPENTHREAD_ENABLE_TMF_PROXY], [test "${enable_tmf_proxy}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_TMF_PROXY],[${OPENTHREAD_ENABLE_TMF_PROXY}],[Define to 1 to enable the TMF proxy feature.])
AC_MSG_RESULT(${enable_posix_app})
AC_SUBST(OPENTHREAD_ENABLE_POSIX_APP)
AM_CONDITIONAL([OPENTHREAD_ENABLE_POSIX_APP], [test "${enable_posix_app}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_POSIX_APP], [${OPENTHREAD_ENABLE_POSIX_APP}], [Define to 1 to build posix application.])
#
# FTD Library
#
AC_MSG_CHECKING([whether to build FTD library])
AC_ARG_ENABLE(ftd,
[AS_HELP_STRING([--enable-ftd], [Build FTD library @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_ftd=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_ftd} for --enable-ftd])
;;
esac
],
[enable_ftd=no])
if test "$enable_ftd" = "yes"; then
OPENTHREAD_ENABLE_FTD=1
else
OPENTHREAD_ENABLE_FTD=0
fi
AC_MSG_RESULT(${enable_ftd})
AC_SUBST(OPENTHREAD_ENABLE_FTD)
AM_CONDITIONAL([OPENTHREAD_ENABLE_FTD], [test "${enable_ftd}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_FTD], [${OPENTHREAD_ENABLE_FTD}], [Define to 1 to build FTD library.])
#
# MTD Library
#
AC_MSG_CHECKING([whether to build MTD library])
AC_ARG_ENABLE(mtd,
[AS_HELP_STRING([--enable-mtd], [Build MTD library @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_mtd=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_mtd} for --enable-mtd])
;;
esac
],
[enable_mtd=no])
if test "$enable_mtd" = "yes"; then
OPENTHREAD_ENABLE_MTD=1
else
OPENTHREAD_ENABLE_MTD=0
fi
AC_MSG_RESULT(${enable_mtd})
AC_SUBST(OPENTHREAD_ENABLE_MTD)
AM_CONDITIONAL([OPENTHREAD_ENABLE_MTD], [test "${enable_mtd}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_MTD], [${OPENTHREAD_ENABLE_MTD}], [Define to 1 to build MTD library.])
#
# Radio Library
#
AC_MSG_CHECKING([whether to build radio-only library])
AC_ARG_ENABLE(radio-only,
[AS_HELP_STRING([--enable-radio-only], [Build radio-only library @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_radio_only=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_radio_only} for --enable-radio-only])
;;
esac
],
[enable_radio_only=no])
if test "$enable_radio_only" = "yes"; then
OPENTHREAD_ENABLE_RADIO_ONLY=1
else
OPENTHREAD_ENABLE_RADIO_ONLY=0
fi
AC_MSG_RESULT(${enable_radio_only})
AC_SUBST(OPENTHREAD_ENABLE_RADIO_ONLY)
AM_CONDITIONAL([OPENTHREAD_ENABLE_RADIO_ONLY], [test "${enable_radio_only}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_RADIO_ONLY], [${OPENTHREAD_ENABLE_RADIO_ONLY}], [Define to 1 to build radio-only library.])
#
# CLI Library
#
AC_MSG_CHECKING([whether to build CLI library])
AC_ARG_ENABLE(cli,
[AS_HELP_STRING([--enable-cli], [Build CLI library @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_cli=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_cli} for --enable-cli])
;;
esac
],
[enable_cli=no])
if test "$enable_cli" = "yes"; then
OPENTHREAD_ENABLE_CLI=1
else
OPENTHREAD_ENABLE_CLI=0
fi
AC_MSG_RESULT(${enable_cli})
AC_SUBST(OPENTHREAD_ENABLE_CLI)
AM_CONDITIONAL([OPENTHREAD_ENABLE_CLI], [test "${enable_cli}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_CLI], [${OPENTHREAD_ENABLE_CLI}], [Define to 1 to build CLI library.])
#
# NCP Library
#
AC_MSG_CHECKING([whether to build NCP library])
AC_ARG_ENABLE(ncp,
[AS_HELP_STRING([--enable-ncp], [Build NCP library @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_ncp=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_ncp} for --enable-ncp])
;;
esac
],
[enable_ncp=no])
if test "$enable_ncp" = "yes"; then
OPENTHREAD_ENABLE_NCP=1
else
OPENTHREAD_ENABLE_NCP=0
fi
AC_MSG_RESULT(${enable_ncp})
AC_SUBST(OPENTHREAD_ENABLE_NCP)
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP], [test "${enable_ncp}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP], [${OPENTHREAD_ENABLE_NCP}], [Define to 1 to build NCP library.])
#
# NCP BUS - how does the NCP talk to the host?
#
AC_ARG_WITH(
[ncp-bus],
[AS_HELP_STRING([--with-ncp-bus],[Specify the NCP bus (none|spi|uart) @<:@default=none@:>@.])],
[
case "${with_ncp_bus}" in
"none")
OPENTHREAD_ENABLE_NCP_SPI=0
OPENTHREAD_ENABLE_NCP_UART=0
;;
"spi")
OPENTHREAD_ENABLE_NCP_SPI=1
OPENTHREAD_ENABLE_NCP_UART=0
;;
"uart")
OPENTHREAD_ENABLE_NCP_SPI=0
OPENTHREAD_ENABLE_NCP_UART=1
;;
*)
AC_MSG_ERROR([unexpected --with-ncp-bus=${with_ncp_bus}])
;;
esac
],
[
OPENTHREAD_ENABLE_NCP_SPI=0
OPENTHREAD_ENABLE_NCP_UART=0
])
AC_SUBST(OPENTHREAD_ENABLE_NCP_SPI)
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_SPI], [test "${with_ncp_bus}" = "spi"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP_SPI],[${OPENTHREAD_ENABLE_NCP_SPI}],[Define to 1 to enable the NCP SPI interface.])
AC_MSG_CHECKING([should NCP support SPI])
AC_MSG_RESULT([${OPENTHREAD_ENABLE_SPI}])
AC_SUBST(OPENTHREAD_ENABLE_NCP_UART)
AM_CONDITIONAL([OPENTHREAD_ENABLE_NCP_UART], [test "${with_ncp_bus}" = "uart"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_NCP_UART],[${OPENTHREAD_ENABLE_NCP_UART}],[Define to 1 to enable the NCP UART interface.])
AC_MSG_CHECKING([should NCP support UART])
AC_MSG_RESULT([${OPENTHREAD_ENABLE_UART}])
#
# Thread UDP Proxy
#
AC_MSG_CHECKING([whether to enable UDP proxy])
AC_ARG_ENABLE(udp_proxy,
[AS_HELP_STRING([--enable-udp-proxy], [Enable UDP proxy support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_udp_proxy=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_udp_proxy} for --enable-udp-proxy])
;;
esac
],
[enable_udp_proxy=no])
if test "$enable_udp_proxy" = "yes"; then
OPENTHREAD_ENABLE_UDP_PROXY=1
else
OPENTHREAD_ENABLE_UDP_PROXY=0
fi
AC_MSG_RESULT(${enable_udp_proxy})
AC_SUBST(OPENTHREAD_ENABLE_UDP_PROXY)
AM_CONDITIONAL([OPENTHREAD_ENABLE_UDP_PROXY], [test "${enable_udp_proxy}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_UDP_PROXY], [${OPENTHREAD_ENABLE_UDP_PROXY}], [Define to 1 to enable the UDP proxy feature.])
#
# Thread Border Agent
#
AC_MSG_CHECKING([whether to enable border agent])
AC_ARG_ENABLE(border_agent,
[AS_HELP_STRING([--enable-border-agent], [Enable border agent support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_border_agent=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_border_agent} for --enable-border-agent])
;;
esac
],
[enable_border_agent=no])
if test "${enable_border_agent}" = "yes"; then
OPENTHREAD_ENABLE_BORDER_AGENT=1
else
OPENTHREAD_ENABLE_BORDER_AGENT=0
fi
AC_MSG_RESULT(${enable_border_agent})
AC_SUBST(OPENTHREAD_ENABLE_BORDER_AGENT)
AM_CONDITIONAL([OPENTHREAD_ENABLE_BORDER_AGENT], [test "${enable_border_agent}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_BORDER_AGENT], [${OPENTHREAD_ENABLE_BORDER_AGENT}], [Define to 1 to enable the border agent feature.])
#
# Thread Network Diagnostic for MTD
@@ -669,6 +764,66 @@ AC_SUBST(OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC)
AM_CONDITIONAL([OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC], [test "${enable_mtd_network_diagnostic}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC],[${OPENTHREAD_ENABLE_MTD_NETWORK_DIAGNOSTIC}],[Define to 1 to enable network diagnostic for MTD.])
#
# Application CoAP Secure
#
AC_ARG_ENABLE(application_coap_secure,
[AS_HELP_STRING([--enable-application-coap-secure],[Enable CoAP Secure to an application.@<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_application_coap_secure=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_application_coap_secure} for --enable-application-coap_secure])
;;
esac
],
[enable_application_coap_secure=no])
if test "$enable_application_coap_secure" = "yes"; then
OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE=1
enable_application_coap="yes"
else
OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE=0
fi
AC_SUBST(OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE)
AM_CONDITIONAL([OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE], [test "${enable_application_coap_secure}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE],[${OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE}],[Define to 1 if you want to enable CoAP Secure to an application.])
#
# Platform UDP
#
AC_ARG_ENABLE(platform_udp,
[AS_HELP_STRING([--enable-platform-udp],[Enable platform UDP support @<:@default=no@:>@.])],
[
case "${enableval}" in
no|yes)
enable_platform_udp=${enableval}
;;
*)
AC_MSG_ERROR([Invalid value ${enable_platform_udp} for --enable-platform-udp])
;;
esac
],
[enable_platform_udp=no])
if test "$enable_platform_udp" = "yes"; then
OPENTHREAD_ENABLE_PLATFORM_UDP=1
else
OPENTHREAD_ENABLE_PLATFORM_UDP=0
fi
AC_MSG_RESULT(${enable_platform_udp})
AC_SUBST(OPENTHREAD_ENABLE_PLATFORM_UDP)
AM_CONDITIONAL([OPENTHREAD_ENABLE_PLATFORM_UDP], [test "${enable_platform_udp}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_PLATFORM_UDP], [${OPENTHREAD_ENABLE_PLATFORM_UDP}], [Define to 1 to enable platform UDP.])
#
# Thread Commissioner
#
@@ -733,7 +888,7 @@ AC_SUBST(OPENTHREAD_ENABLE_JOINER)
AM_CONDITIONAL([OPENTHREAD_ENABLE_JOINER], [test "${enable_joiner}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_JOINER],[${OPENTHREAD_ENABLE_JOINER}],[Define to 1 to enable the joiner role.])
if test "${enable_commissioner}" = "yes" -o "${enable_joiner}" = "yes"; then
if test "${enable_commissioner}" = "yes" -o "${enable_joiner}" = "yes" -o "${enable_border_agent}" = "yes" -o "${enable_application_coap_secure}" = "yes"; then
enable_dtls="yes"
OPENTHREAD_ENABLE_DTLS=1
else
@@ -1290,17 +1445,39 @@ AC_MSG_CHECKING([whether to enable linker map output])
AC_MSG_RESULT(${enable_linker_map})
AM_CONDITIONAL([OPENTHREAD_ENABLE_LINKER_MAP], [test "${enable_linker_map}" = "yes"])
#
# Custom linker file
#
AC_ARG_WITH(
[custom-linker-file],
[AS_HELP_STRING([--with-custom-linker-file=<linkerfile.ld>],[Specify custom linker file (absolute path). @<:@default=none@:>@.])],
[
with_custom_linker_file=yes
OPENTHREAD_CUSTOM_LINKER_FILE=${withval}
],
[
with_custom_linker_file=no
])
AC_SUBST(OPENTHREAD_CUSTOM_LINKER_FILE)
AM_CONDITIONAL([OPENTHREAD_ENABLE_CUSTOM_LINKER_FILE], [test "${with_custom_linker_file}" = "yes"])
#
# Examples
#
AC_ARG_WITH(examples,
[AS_HELP_STRING([--with-examples=TARGET],
[Specify the examples from one of: none, posix, cc2538, cc2650, cc2652, da15000, efr32, emsk, gp712, kw41z, nrf52840, samr21 @<:@default=none@:>@.])],
[Specify the examples from one of: none, posix, cc1352, cc2538, cc2650, cc2652, da15000, efr32, emsk, gp712, kw41z, nrf52840, samr21 @<:@default=none@:>@.])],
[
case "${with_examples}" in
none|posix|cc2538|cc2650|cc2652|da15000|efr32|emsk|gp712|kw41z|nrf52840|samr21)
none)
;;
posix|cc1352|cc2538|cc2650|cc2652|da15000|efr32|emsk|gp712|kw41z|nrf52840|samr21)
if test ${enable_posix_app} = "yes"; then
AC_MSG_ERROR([--with-examples must be none when POSIX apps are enabled by --enable-posix-app])
fi
;;
*)
AC_MSG_ERROR([Invalid value ${with_examples} for --with-examples])
@@ -1309,7 +1486,7 @@ AC_ARG_WITH(examples,
],
[with_examples=none])
OPENTHREAD_EXAMPLES=${with_examples}
OPENTHREAD_ENABLE_EXAMPLES=${with_examples}
case ${with_examples} in
@@ -1318,6 +1495,11 @@ case ${with_examples} in
AC_DEFINE_UNQUOTED([OPENTHREAD_EXAMPLES_POSIX],[${OPENTHREAD_EXAMPLES_POSIX}],[Define to 1 if you want to use posix examples])
;;
cc1352)
OPENTHREAD_EXAMPLES_CC1352=1
AC_DEFINE_UNQUOTED([OPENTHREAD_EXAMPLES_CC1352],[${OPENTHREAD_EXAMPLES_CC1352}],[Define to 1 if you want to use cc1352 examples])
;;
cc2538)
OPENTHREAD_EXAMPLES_CC2538=1
AC_DEFINE_UNQUOTED([OPENTHREAD_EXAMPLES_CC2538],[${OPENTHREAD_EXAMPLES_CC2538}],[Define to 1 if you want to use cc2538 examples])
@@ -1373,42 +1555,45 @@ esac
AC_MSG_CHECKING([whether to enable examples])
AC_MSG_RESULT(${OPENTHREAD_EXAMPLES})
AC_SUBST(OPENTHREAD_EXAMPLES)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES], [test ${with_examples} != "none"])
AC_DEFINE_UNQUOTED([OPENTHREAD_EXAMPLES],[${OPENTHREAD_EXAMPLES}],[OpenThread examples])
AC_SUBST(OPENTHREAD_ENABLE_EXAMPLES)
AM_CONDITIONAL([OPENTHREAD_ENABLE_EXAMPLES], [test ${with_examples} != "none"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_EXAMPLES],[${OPENTHREAD_ENABLE_EXAMPLES}],[OpenThread examples])
AC_SUBST(OPENTHREAD_EXAMPLES_POSIX)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_POSIX], [test "${OPENTHREAD_EXAMPLES}" = "posix"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_POSIX], [test "${with_examples}" = "posix"])
AC_SUBST(OPENTHREAD_EXAMPLES_CC1352)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC1352], [test "${with_examples}" = "cc1352"])
AC_SUBST(OPENTHREAD_EXAMPLES_CC2538)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2538], [test "${OPENTHREAD_EXAMPLES}" = "cc2538"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2538], [test "${with_examples}" = "cc2538"])
AC_SUBST(OPENTHREAD_EXAMPLES_CC2650)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2650], [test "${OPENTHREAD_EXAMPLES}" = "cc2650"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2650], [test "${with_examples}" = "cc2650"])
AC_SUBST(OPENTHREAD_EXAMPLES_CC2652)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2652], [test "${OPENTHREAD_EXAMPLES}" = "cc2652"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2652], [test "${with_examples}" = "cc2652"])
AC_SUBST(OPENTHREAD_EXAMPLES_DA15000)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_DA15000], [test "${OPENTHREAD_EXAMPLES}" = "da15000"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_DA15000], [test "${with_examples}" = "da15000"])
AC_SUBST(OPENTHREAD_EXAMPLES_EFR32)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32], [test "${OPENTHREAD_EXAMPLES}" = "efr32"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32], [test "${with_examples}" = "efr32"])
AC_SUBST(OPENTHREAD_EXAMPLES_EMSK)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EMSK], [test "${OPENTHREAD_EXAMPLES}" = "emsk"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EMSK], [test "${with_examples}" = "emsk"])
AC_SUBST(OPENTHREAD_EXAMPLES_GP712)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_GP712], [test "${OPENTHREAD_EXAMPLES}" = "gp712"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_GP712], [test "${with_examples}" = "gp712"])
AC_SUBST(OPENTHREAD_EXAMPLES_KW41Z)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_KW41Z], [test "${OPENTHREAD_EXAMPLES}" = "kw41z"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_KW41Z], [test "${with_examples}" = "kw41z"])
AC_SUBST(OPENTHREAD_EXAMPLES_NRF52840)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52840], [test "${OPENTHREAD_EXAMPLES}" = "nrf52840"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52840], [test "${with_examples}" = "nrf52840"])
AC_SUBST(OPENTHREAD_EXAMPLES_SAMR21)
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SAMR21], [test "${OPENTHREAD_EXAMPLES}" = "samr21"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SAMR21], [test "${with_examples}" = "samr21"])
#
# Tools
@@ -1446,6 +1631,8 @@ NL_ENABLE_DOCS([auto],[NO])
AM_CONDITIONAL(OPENTHREAD_BUILD_DOCS, [test "${nl_cv_build_docs}" = "yes"])
AM_CONDITIONAL(OPENTHREAD_POSIX, [test "${OPENTHREAD_ENABLE_POSIX_APP}" = "1" -o "${OPENTHREAD_EXAMPLES_POSIX}" = "1"])
#
# Checks for libraries and packages.
#
@@ -1541,6 +1728,8 @@ src/cli/Makefile
src/ncp/Makefile
src/core/Makefile
src/diag/Makefile
src/posix/Makefile
src/posix/platform/Makefile
third_party/Makefile
third_party/mbedtls/Makefile
examples/Makefile
@@ -1548,6 +1737,7 @@ examples/apps/Makefile
examples/apps/cli/Makefile
examples/apps/ncp/Makefile
examples/platforms/Makefile
examples/platforms/cc1352/Makefile
examples/platforms/cc2538/Makefile
examples/platforms/cc2650/Makefile
examples/platforms/cc2652/Makefile
@@ -1630,19 +1820,18 @@ AC_MSG_NOTICE([
Pretty args : ${PRETTY_ARGS:--}
Pretty check : ${PRETTY_CHECK:--}
Pretty check args : ${PRETTY_CHECK_ARGS:--}
OpenThread CLI support : ${enable_cli_app}
OpenThread CLI-MTD support : ${enable_cli_app_mtd}
OpenThread CLI-FTD support : ${enable_cli_app_ftd}
OpenThread NCP support : ${enable_ncp_app}
OpenThread NCP-MTD support : ${enable_ncp_app_mtd}
OpenThread NCP-FTD support : ${enable_ncp_app_ftd}
OpenThread FTD support : ${enable_ftd}
OpenThread MTD support : ${enable_mtd}
OpenThread Radio Only support : ${enable_radio_only}
OpenThread CLI support : ${enable_cli}
OpenThread NCP support : ${enable_ncp}
OpenThread NCP-BUS Configuration : ${with_ncp_bus}
OpenThread NCP Vendor Hook Source : ${with_ncp_vendor_hook_source}
OpenThread NCP Spinel Encrypter : ${with_ncp_spinel_encrypter_libs}
OpenThread Multiple Instances support : ${enable_multiple_instances}
OpenThread MTD Network Diagnostic support : ${enable_mtd_network_diagnostic}
OpenThread builtin mbedtls support : ${enable_builtin_mbedtls}
OpenThread TMF Proxy support : ${enable_tmf_proxy}
OpenThread UDP Proxy support : ${enable_udp_proxy}
OpenThread Commissioner support : ${enable_commissioner}
OpenThread Joiner support : ${enable_joiner}
OpenThread DTLS support : ${enable_dtls}
@@ -1658,9 +1847,12 @@ AC_MSG_NOTICE([
OpenThread DHCPv6 Client support : ${enable_dhcp6_client}
OpenThread DNS Client support : ${enable_dns_client}
OpenThread Application CoAP support : ${enable_application_coap}
OpenThread Application CoAP Secure support: ${enable_application_coap_secure}
OpenThread Raw Link-Layer support : ${enable_raw_link_api}
OpenThread Border Agent support : ${enable_border_agent}
OpenThread Border Router support : ${enable_border_router}
OpenThread Service support : ${enable_service}
OpenThread examples : ${OPENTHREAD_EXAMPLES}
OpenThread Examples : ${with_examples}
OpenThread POSIX Application : ${enable_posix_app}
])
+20 -12
View File
@@ -14,9 +14,9 @@ following allocation plan:
Property ID Range | Description
:---------------------|:-----------------
0 - 127 | Reserved for frequently-used properties
128 - 15,359 | Unallocated
128 - 15,359 | Technology-specific
15,360 - 16,383 | Vendor-specific
16,384 - 1,999,999 | Unallocated
16,384 - 1,999,999 | Technology-specific
2,000,000 - 2,097,151 | Experimental use only
For an explanation of the data format encoding shorthand used
@@ -28,16 +28,24 @@ The currently assigned properties are broken up into several
sections, each with reserved ranges of property identifiers.
These ranges are:
Name | Range (Inclusive) | Documentation
-------|------------------------------|--------------
Core | 0x00 - 0x1F, 0x1000 - 0x11FF | (#prop-core)
PHY | 0x20 - 0x2F, 0x1200 - 0x12FF | (#prop-phy)
MAC | 0x30 - 0x3F, 0x1300 - 0x13FF | (#prop-mac)
NET | 0x40 - 0x4F, 0x1400 - 0x14FF | (#prop-net)
Tech | 0x50 - 0x5F, 0x1500 - 0x15FF | Technology-specific
IPv6 | 0x60 - 0x6F, 0x1600 - 0x16FF | (#prop-ipv6)
Stream | 0x70 - 0x7F, 0x1700 - 0x17FF | (#prop-core)
Debug | 0x4000 - 0x4400 | (#prop-debug)
Name | Range (Inclusive) | Description
-------------|--------------------------------|------------------------
Core | 0x000 - 0x01F, 0x1000 - 0x11FF | Spinel core
PHY | 0x020 - 0x02F, 0x1200 - 0x12FF | Radio PHY layer
MAC | 0x030 - 0x03F, 0x1300 - 0x13FF | MAC layer
NET | 0x040 - 0x04F, 0x1400 - 0x14FF | Network
Thread | 0x050 - 0x05F, 0x1500 - 0x15FF | Thread
IPv6 | 0x060 - 0x06F, 0x1600 - 0x16FF | IPv6
Stream | 0x070 - 0x07F, 0x1700 - 0x17FF | Stream
MeshCop | 0x080 - 0x08F, 0x1800 - 0x18FF | Thread Mesh Commissioning
OpenThread | 0x1900 - 0x19FF | OpenThread specific
Interface | 0x100 - 0x1FF | Interface (e.g., UART)
PIB | 0x400 - 0x4FF | 802.15.4 PIB
Counter | 0x500 - 0x7FF | Counters (MAC, IP, etc).
Nest | 0x3BC0 - 0x3BFF | Nest (legacy)
Vendor | 0x3C00 - 0x3FFF | Vendor specific
Debug | 0x4000 - 0x43FF | Debug related
Experimental | 2,000,000 - 2,097,151 | Experimental use only
Note that some of the property sections have two reserved
ranges: a primary range (which is encoded as a single byte)
+100 -17
View File
@@ -32,10 +32,17 @@ The IPv6 address of the leader. (Note: May change to long and short address of l
### PROP 81: PROP_THREAD_PARENT
* Type: Read-Only
* Packed-Encoding: `ES`
* LADDR, SADDR
* Packed-Encoding: `ESLccCC`
The long address and short address of the parent of this node.
Information about parent of this node.
* `E`: Extended address
* `S`: RLOC16
* `L`: Age (seconds since last heard from)
* `c`: Average RSS (in dBm)
* `c`: Last RSSI (in dBm)
* `C`: Link Quality In
* `C`: Link Quality Out
### PROP 82: PROP_THREAD_CHILD_TABLE
* Type: Read-Only
@@ -288,7 +295,7 @@ Set to true to enable the native commissioner. It is mandatory before adding the
* Packed-Encoding: `b`
* Required capability: `CAP_THREAD_TMF_PROXY`
Set to true to enable the TMF proxy.
Set to true to enable the TMF proxy. This property is deprecated.
### PROP 5394: PROP_THREAD_TMF_PROXY_STREAM {#prop-thread-tmf-proxy-stream}
@@ -296,6 +303,8 @@ Set to true to enable the TMF proxy.
* Packed-Encoding: `dSS`
* Required capability: `CAP_THREAD_TMF_PROXY`
This property is deprecated. Please see `SPINEL_PROP_THREAD_UDP_PROXY_STREAM`.
Data per item is:
* `d`: CoAP frame
@@ -309,7 +318,6 @@ Fields: | Length | CoAP | locator | port
This property allows the host to send and receive TMF messages from
the NCP's RLOC address and support Thread-specific border router functions.
### PROP 5395: PROP_THREAD_DISOVERY_SCAN_JOINER_FLAG {#prop-thread-discovery-scan-joiner-flag}
* Type: Read-Write
@@ -416,7 +424,7 @@ following properties can also be included in the Pending Dataset:
* SPINEL_PROP_DATASET_PENDING_TIMESTAMP
* SPINEL_PROP_DATASET_DELAY_TIMER
### PROP 5402: SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET (#prop-thread-mgmt-active-dataset)
### PROP 5402: SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET (#prop-thread-mgmt-set-active-dataset)
* Type: Write only
* Packing-Encoding: `A(t(iD))`
@@ -435,7 +443,7 @@ TLVs):
* SPINEL_PROP_DATASET_RAW_TLVS
### PROP 5403: SPINEL_PROP_THREAD_MGMT_PENDING_DATASET (#prop-thread-mgmt-pending-dataset)
### PROP 5403: SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET (#prop-thread-mgmt-set-pending-dataset)
* Type: Write only
* Packing-Encoding: `A(t(iD))`
@@ -461,8 +469,10 @@ This can only be included in one of the Dataset related properties below:
* SPINEL_PROP_THREAD_ACTIVE_DATASET
* SPINEL_PROP_THREAD_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
### PROP 5405: SPINEL_PROP_DATASET_PENDING_TIMESTAMP (#prop-dataset-pending-timestamps)
@@ -475,8 +485,8 @@ Dataset.
It can only be included in one of the Pending Dataset properties:
* SPINEL_PROP_THREAD_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
### PROP 5406: SPINEL_PROP_DATASET_DELAY_TIMER (#prop-dataset-delay-timer)
@@ -491,7 +501,8 @@ Pending Operational Dataset.
It can only be included in one of the Pending Dataset properties:
* SPINEL_PROP_THREAD_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
### PROP 5407: SPINEL_PROP_DATASET_SECURITY_POLICY (#prop-dataset-security-policy)
@@ -510,8 +521,10 @@ It can only be included in one of the Dataset related properties below:
* SPINEL_PROP_THREAD_ACTIVE_DATASET
* SPINEL_PROP_THREAD_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
### PROP 5408: SPINEL_PROP_DATASET_RAW_TLVS (#prop-dataset-raw-tlvs)
@@ -523,8 +536,8 @@ DataSet.
It can only be included in one of the following Dataset properties:
* SPINEL_PROP_THREAD_MGMT_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_PENDING_DATASET
* SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET
### PROP 5409: SPINEL_PROP_THREAD_CHILD_TABLE_ADDRESSES (#prop-thread-child-table-addresses)
@@ -563,7 +576,6 @@ Data per item is:
* `c`: Average RSSI (in dBm)
* `c`: Last RSSI (in dBm)
### PROP 5411: SPINEL_PROP_THREAD_ADDRESS_CACHE_TABLE (#prop-thread-address-cache-table)
* Type: Read-Only
@@ -576,3 +588,74 @@ Data per item is:
* `6` : Target IPv6 address
* `S` : RLOC16 of target
* `C` : Age (order of use, 0 indicates most recently used entry)
### PROP 5412: SPINEL_PROP_THREAD_UDP_PROXY_STREAM (#prop-thread-udp-proxy-stream)
* Type: Write-Stream
* Packed-Encoding: `dS6S`
* Required capability: `CAP_THREAD_UDP_PROXY`
This property helps exchange UDP packets with host.
`d`: UDP payload
`S`: Remote UDP port
`6`: Remote IPv6 address
`S`: Local UDP port
### PROP 5413: SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET (#prop-thread-mgmt-get-active-dataset)
* Type: Write-Only
* Packing-format: `A(t(iD))`
The formatting of this property follows the same rules as in
SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET. This property
allows the sender to not include a value associated with
properties in formating of `t(iD)`, i.e., it should accept
either a `t(iD)` or a `t(i)` encoding which in both cases
indicate the associated Dataset property should be requested
as part of MGMT_GET command.
When written, it triggers a MGMT_ACTIVE_GET meshcop command to be
sent to leader with the given Dataset. The spinel frame response
should be a `LAST_STATUS` with the status of the transmission
of MGMT_ACTIVE_GET command.
In addition to supported properties in
SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET, the following property
can be optionally included in the Dataset:
* SPINEL_PROP_DATASET_DEST_ADDRESS
### PROP 5414: SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET (#prop-thread-mgmt-get-pending-dataset)
* Type: Write-Only
* Packing-format: `A(t(iD))`
The formatting of this property follows the same rules as in
SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET.
This is write-only property. When written, it triggers a
MGMT_PENDING_GET meshcop command to be sent to leader with the
given Dataset. The spinel frame response should be a
`LAST_STATUS` with the status of the transmission of
MGMT_PENDING_GET command.
In addition to supported properties in
SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET, the following property
can be optionally included the Dataset:
* SPINEL_PROP_DATASET_DEST_ADDRESS
### PROP 5415: SPINEL_PROP_DATASET_DEST_ADDRESS (#prop-dataset-dest-address)
* Type: No direct read or write
* Packing-Encoding: `6`
This property specifies the IPv6 destination when sending
MGMT_GET command for either Active or Pending Dataset if not
provided, Leader ALOC address is used as default.
This can only be included in one of the Dataset related properties below:
* SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET
* SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET
@@ -61,6 +61,8 @@
<ClCompile Include="..\..\src\cli\cli_dataset.cpp" />
<ClCompile Include="..\..\src\cli\cli_instance.cpp" />
<ClCompile Include="..\..\src\cli\cli_uart.cpp" />
<ClCompile Include="..\..\src\core\utils\missing_strnlen.c" />
<ClCompile Include="..\..\src\core\utils\parse_cmdline.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
@@ -63,6 +63,7 @@
<ClCompile Include="..\..\src\ncp\ncp_base_ftd.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_base_mtd.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_base_radio.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_base_dispatcher.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_buffer.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_spi.cpp" />
<ClCompile Include="..\..\src\ncp\spinel.c" />
@@ -30,6 +30,9 @@
<ClCompile Include="..\..\src\ncp\ncp_base_radio.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ncp\ncp_base_dispatcher.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ncp\ncp_buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -64,6 +64,7 @@
<ClCompile Include="..\..\src\ncp\ncp_base_ftd.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_base_mtd.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_base_radio.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_base_dispatcher.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_buffer.cpp" />
<ClCompile Include="..\..\src\ncp\ncp_uart.cpp" />
<ClCompile Include="..\..\src\ncp\spinel.c" />
@@ -33,6 +33,9 @@
<ClCompile Include="..\..\src\ncp\ncp_base_radio.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ncp\ncp_base_dispatcher.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ncp\ncp_buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -59,12 +59,12 @@
<ClCompile Include="..\..\examples\platforms\posix\flash-windows-stubs.c" />
<ClCompile Include="..\..\examples\platforms\posix\logging.c" />
<ClCompile Include="..\..\examples\platforms\posix\misc.c" />
<ClCompile Include="..\..\examples\platforms\posix\platform.c" />
<ClCompile Include="..\..\examples\platforms\posix\radio.c" />
<ClCompile Include="..\..\examples\platforms\posix\random.c" />
<ClCompile Include="..\..\examples\platforms\posix\spi-stubs.c" />
<ClCompile Include="..\..\examples\platforms\posix\system.c" />
<ClCompile Include="..\..\examples\platforms\posix\uart-windows.c" />
<ClCompile Include="..\..\examples\platforms\utils\settings.cpp" />
<ClCompile Include="..\..\examples\platforms\utils\settings_flash.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\examples\platforms\posix\platform-posix.h" />
@@ -22,9 +22,6 @@
<ClCompile Include="..\..\examples\platforms\posix\misc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\examples\platforms\posix\platform.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\examples\platforms\posix\random.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -34,10 +31,13 @@
<ClCompile Include="..\..\examples\platforms\posix\spi-stubs.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\examples\platforms\posix\system.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\examples\platforms\posix\uart-windows.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\examples\platforms\utils\settings.cpp">
<ClCompile Include="..\..\examples\platforms\utils\settings_flash.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
+3
View File
@@ -94,6 +94,7 @@
<ClCompile Include="..\..\src\core\crypto\mbedtls.cpp" />
<ClCompile Include="..\..\src\core\crypto\pbkdf2_cmac.cpp" />
<ClCompile Include="..\..\src\core\crypto\sha256.cpp" />
<ClCompile Include="..\..\src\core\mac\link_raw.cpp" />
<ClCompile Include="..\..\src\core\mac\mac.cpp" />
<ClCompile Include="..\..\src\core\mac\mac_filter.cpp" />
<ClCompile Include="..\..\src\core\mac\mac_frame.cpp" />
@@ -148,6 +149,7 @@
<ClCompile Include="..\..\src\core\thread\thread_netif.cpp" />
<ClCompile Include="..\..\src\core\thread\topology.cpp" />
<ClCompile Include="..\..\src\core\utils\child_supervision.cpp" />
<ClCompile Include="..\..\src\core\utils\parse_cmdline.cpp" />
<ClCompile Include="..\..\src\core\utils\slaac_address.cpp" />
<ClCompile Include="..\..\src\core\utils\jam_detector.cpp" />
<ClCompile Include="..\..\src\core\utils\missing_strnlen.c" />
@@ -238,6 +240,7 @@
<ClInclude Include="..\..\src\core\thread\thread_uri_paths.hpp" />
<ClInclude Include="..\..\src\core\thread\topology.hpp" />
<ClInclude Include="..\..\src\core\utils\child_supervision.hpp" />
<ClInclude Include="..\..\src\core\utils\parse_cmdline.hpp" />
<ClInclude Include="..\..\src\core\utils\slaac_address.hpp" />
<ClInclude Include="..\..\src\core\utils\jam_detector.hpp" />
<ClInclude Include="..\..\src\core\utils\wrap_string.h" />
@@ -165,6 +165,9 @@
<ClCompile Include="..\..\src\core\crypto\aes_ccm.cpp">
<Filter>Source Files\crypto</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\mac\link_raw.cpp">
<Filter>Source Files\api</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\mac\mac.cpp">
<Filter>Source Files\mac</Filter>
</ClCompile>
@@ -327,6 +330,9 @@
<ClCompile Include="..\..\src\core\utils\child_supervision.cpp">
<Filter>Source Files\utils</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\utils\parse_cmdline.cpp">
<Filter>Source Files\utils</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\utils\slaac_address.cpp">
<Filter>Source Files\utils</Filter>
</ClCompile>
@@ -593,6 +599,9 @@
<ClInclude Include="..\..\src\core\utils\child_supervision.hpp">
<Filter>Header Files\utils</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\utils\parse_cmdline.hpp">
<Filter>Header Files\utils</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\utils\slaac_address.hpp">
<Filter>Header Files\utils</Filter>
</ClInclude>
+4 -3
View File
@@ -157,6 +157,7 @@
<ClCompile Include="..\..\src\core\thread\thread_netif.cpp" />
<ClCompile Include="..\..\src\core\thread\topology.cpp" />
<ClCompile Include="..\..\src\core\utils\child_supervision.cpp" />
<ClCompile Include="..\..\src\core\utils\parse_cmdline.cpp" />
<ClCompile Include="..\..\src\core\utils\slaac_address.cpp" />
<ClCompile Include="..\..\src\core\utils\jam_detector.cpp" />
<ClCompile Include="..\..\src\core\utils\missing_strlcat.c" />
@@ -173,6 +174,7 @@
<ClInclude Include="..\..\include\openthread\dataset_ftd.h" />
<ClInclude Include="..\..\include\openthread\dhcp6_client.h" />
<ClInclude Include="..\..\include\openthread\dhcp6_server.h" />
<ClInclude Include="..\..\include\openthread\error.h" />
<ClInclude Include="..\..\include\openthread\icmp6.h" />
<ClInclude Include="..\..\include\openthread\instance.h" />
<ClInclude Include="..\..\include\openthread\ip6.h" />
@@ -181,14 +183,11 @@
<ClInclude Include="..\..\include\openthread\link.h" />
<ClInclude Include="..\..\include\openthread\message.h" />
<ClInclude Include="..\..\include\openthread\netdata.h" />
<ClInclude Include="..\..\include\openthread\openthread.h" />
<ClInclude Include="..\..\include\openthread\tasklet.h" />
<ClInclude Include="..\..\include\openthread\thread.h" />
<ClInclude Include="..\..\include\openthread\thread_ftd.h" />
<ClInclude Include="..\..\include\openthread\types.h" />
<ClInclude Include="..\..\include\openthread-windows-config.h" />
<ClInclude Include="..\..\include\openthread\udp.h" />
<ClInclude Include="..\..\src\core\api\link_raw.hpp" />
<ClInclude Include="..\..\src\core\coap\coap.hpp" />
<ClInclude Include="..\..\src\core\coap\coap_header.hpp" />
<ClInclude Include="..\..\src\core\coap\coap_secure.hpp" />
@@ -214,6 +213,7 @@
<ClInclude Include="..\..\src\core\crypto\mbedtls.hpp" />
<ClInclude Include="..\..\src\core\crypto\pbkdf2_cmac.h" />
<ClInclude Include="..\..\src\core\crypto\sha256.hpp" />
<ClInclude Include="..\..\src\core\mac\link_raw.hpp" />
<ClInclude Include="..\..\src\core\mac\mac.hpp" />
<ClInclude Include="..\..\src\core\mac\mac_filter.hpp" />
<ClInclude Include="..\..\src\core\mac\mac_frame.hpp" />
@@ -273,6 +273,7 @@
<ClInclude Include="..\..\src\core\thread\thread_uri_paths.hpp" />
<ClInclude Include="..\..\src\core\thread\topology.hpp" />
<ClInclude Include="..\..\src\core\utils\child_supervision.hpp" />
<ClInclude Include="..\..\src\core\utils\parse_cmdline.hpp" />
<ClInclude Include="..\..\src\core\utils\slaac_address.hpp" />
<ClInclude Include="..\..\src\core\utils\jam_detector.hpp" />
<ClInclude Include="..\..\src\core\utils\wrap_string.h" />
@@ -327,6 +327,9 @@
<ClCompile Include="..\..\src\core\utils\child_supervision.cpp">
<Filter>Source Files\utils</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\utils\parse_cmdline.cpp">
<Filter>Source Files\utils</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\utils\slaac_address.cpp">
<Filter>Source Files\utils</Filter>
</ClCompile>
@@ -590,6 +593,9 @@
<ClInclude Include="..\..\src\core\utils\child_supervision.hpp">
<Filter>Header Files\utils</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\utils\parse_cmdline.hpp">
<Filter>Header Files\utils</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\utils\slaac_address.hpp">
<Filter>Header Files\utils</Filter>
</ClInclude>
@@ -614,9 +620,6 @@
<ClInclude Include="..\..\src\core\openthread-core-default-config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\openthread\types.h">
<Filter>Header Files\openthread</Filter>
</ClInclude>
<ClInclude Include="..\..\examples\drivers\windows\include\openthread-core-windows-config.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -644,6 +647,9 @@
<ClInclude Include="..\..\include\openthread\dhcp6_server.h">
<Filter>Header Files\openthread</Filter>
</ClInclude>
<ClInclude Include="..\..\include\openthread\error.h">
<Filter>Header Files\openthread</Filter>
</ClInclude>
<ClInclude Include="..\..\include\openthread\icmp6.h">
<Filter>Header Files\openthread</Filter>
</ClInclude>
@@ -668,9 +674,6 @@
<ClInclude Include="..\..\include\openthread\netdata.h">
<Filter>Header Files\openthread</Filter>
</ClInclude>
<ClInclude Include="..\..\include\openthread\openthread.h">
<Filter>Header Files\openthread</Filter>
</ClInclude>
<ClInclude Include="..\..\include\openthread\tasklet.h">
<Filter>Header Files\openthread</Filter>
</ClInclude>
@@ -683,7 +686,7 @@
<ClInclude Include="..\..\include\openthread\udp.h">
<Filter>Header Files\openthread</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\api\link_raw.hpp">
<ClInclude Include="..\..\src\core\mac\link_raw.hpp">
<Filter>Header Files\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\utils\wrapper_string.h">
+297
View File
@@ -0,0 +1,297 @@
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
.NOTPARALLEL:
AR = arm-none-eabi-ar
CCAS = arm-none-eabi-as
CPP = arm-none-eabi-cpp
CC = arm-none-eabi-gcc
CXX = arm-none-eabi-g++
LD = arm-none-eabi-ld
STRIP = arm-none-eabi-strip
NM = arm-none-eabi-nm
RANLIB = arm-none-eabi-ranlib
OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli \
--enable-diag \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--with-examples=cc1352 \
MBEDTLS_CPPFLAGS="$(CC1352_MBEDTLS_CPPFLAGS)" \
$(NULL)
DEFAULT_LOGGING ?= 1
CC1352_MBEDTLS_CPPFLAGS = \
-DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"' \
-DMBEDTLS_USER_CONFIG_FILE='\"cc1352-mbedtls-config.h\"' \
-I$(PWD)/examples/platforms/cc1352/crypto \
-I$(PWD)/third_party/ti/devices/cc13x2_cc26x2 \
-I$(PWD)/third_party/mbedtls \
-I$(PWD)/third_party/mbedtls/repo/include \
$(NULL)
CC1352_CONFIG_FILE_CPPFLAGS = \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-cc1352-config.h\"' \
-I$(PWD)/examples/platforms/cc1352/ \
$(NULL)
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(CC1352_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-nostartfiles \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
-Wl,-Map=map.map \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = cc1352
ARCHS = cortex-m4f
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
#
# configure-arch <arch>
#
# Configure OpenThread for the specified architecture.
#
# arch - The architecture to configure.
#
define configure-arch
$(ECHO) " CONFIG $(TargetTuple)..."
(cd $(BuildPath)/$(TargetTuple) \
&& $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPP="$(CPP)" \
CC="$(CC)" \
CXX="$(CXX)" \
OBJC="$(OBJC)" \
OBJCXX="$(OBJCXX)" \
AR="$(AR)" \
RANLIB="$(RANLIB)" \
NM="$(NM)" \
STRIP="$(STRIP)" \
CPPFLAGS="$(CPPFLAGS)" \
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
--host=arm-none-eabi \
--prefix=/ \
--exec-prefix=/$(TargetTuple) \
$(configure_OPTIONS))
endef # configure-arch
#
# build-arch <arch>
#
# Build the OpenThread intermediate build products for the specified
# architecture.
#
# arch - The architecture to build.
#
define build-arch
$(ECHO) " BUILD $(TargetTuple)"
$(MAKE) \
$(JOBSFLAG) \
-C $(BuildPath)/$(TargetTuple) \
--no-print-directory \
all
endef # build-arch
#
# stage-arch <arch>
#
# Stage (install) the OpenThread final build products for the specified
# architecture.
#
# arch - The architecture to stage.
#
define stage-arch
$(ECHO) " STAGE $(TargetTuple)"
$(MAKE) \
$(JOBSFLAG) \
-C $(BuildPath)/$(TargetTuple) \
--no-print-directory \
DESTDIR=$(AbsTopResultDir) \
install
endef # stage-arch
#
# ARCH_template <arch>
#
# Define macros, targets and rules to configure, build, and stage the
# OpenThread for a single architecture.
#
# arch - The architecture to instantiate the template for.
#
define ARCH_template
CONFIGURE_TARGETS += configure-$(1)
BUILD_TARGETS += do-build-$(1)
STAGE_TARGETS += stage-$(1)
BUILD_DIRS += $(BuildPath)/$(TargetTuple)
DIRECTORIES += $(BuildPath)/$(TargetTuple)
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
configure-$(1): $(BuildPath)/$(TargetTuple)/config.status
$(BuildPath)/$(TargetTuple)/config.status: | $(BuildPath)/$(TargetTuple)
$$(call configure-arch,$(1))
do-build-$(1): configure-$(1)
do-build-$(1):
+$$(call build-arch,$(1))
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-arch,$(1))
$(1): stage-$(1)
endef # ARCH_template
.DEFAULT_GOAL := all
all: stage
#
# cortex-m4f
#
cortex-m4f_target_ABI = cortex-m4f
cortex-m4f_target_CPPFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_CFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_CXXFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
cortex-m4f_target_LDFLAGS = -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
#
# Common / Finalization
#
configure: $(CONFIGURE_TARGETS)
build: $(BUILD_TARGETS)
stage: $(STAGE_TARGETS)
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
all: stage
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
clean:
$(ECHO) " CLEAN"
@$(RM_F) -r $(CLEAN_DIRS)
help:
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
$(ECHO) "architectures: "
$(ECHO) ""
$(ECHO) " $(ARCHS)"
$(ECHO) ""
$(ECHO) "To build only a particular architecture, specify: "
$(ECHO) ""
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
$(ECHO) ""
+7 -4
View File
@@ -42,12 +42,15 @@ OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli-app=all \
--enable-ncp-app=all \
--with-ncp-bus=uart \
--enable-cli \
--enable-diag \
--with-examples=cc2538 \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--enable-linker-map \
--with-examples=cc2538 \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
+7 -4
View File
@@ -42,15 +42,18 @@ OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli-app=mtd \
--enable-ncp-app=mtd \
--enable-cli \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--with-examples=cc2650 \
--enable-radio-only \
--enable-linker-map \
--with-examples=cc2650 \
MBEDTLS_CPPFLAGS="$(CC2650_MBEDTLS_CPPFLAGS)" \
$(NULL)
CC2650_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"cc2650-mbedtls-config.h\"'
CC2650_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
CC2650_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"cc2650-mbedtls-config.h\"'
CC2650_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/cc2650/crypto
CC2650_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/ti/devices/cc26x0
CC2650_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls
+9 -5
View File
@@ -42,10 +42,13 @@ OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli-app=all \
--enable-ncp-app=all \
--with-ncp-bus=uart \
--enable-cli \
--enable-diag \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--with-examples=cc2652 \
MBEDTLS_CPPFLAGS="$(CC2652_MBEDTLS_CPPFLAGS)" \
$(NULL)
@@ -53,9 +56,10 @@ configure_OPTIONS = \
DEFAULT_LOGGING ?= 1
CC2652_MBEDTLS_CPPFLAGS = \
-DMBEDTLS_CONFIG_FILE='\"cc2652-mbedtls-config.h\"' \
-DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"' \
-DMBEDTLS_USER_CONFIG_FILE='\"cc2652-mbedtls-config.h\"' \
-I$(PWD)/examples/platforms/cc2652/crypto \
-I$(PWD)/third_party/ti/devices/cc26x2 \
-I$(PWD)/third_party/ti/devices/cc13x2_cc26x2 \
-I$(PWD)/third_party/mbedtls \
-I$(PWD)/third_party/mbedtls/repo/include \
$(NULL)
+8 -4
View File
@@ -42,18 +42,22 @@ OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli-app=all \
--enable-ncp-app=all \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--with-examples=da15000 \
--enable-radio-only \
--enable-linker-map \
--with-examples=da15000 \
MBEDTLS_CPPFLAGS="$(DA15000_MBEDTLS_CPPFLAGS)" \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
DA15000_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"da15000-mbedtls-config.h\"'
DA15000_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
DA15000_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"da15000-mbedtls-config.h\"'
DA15000_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/da15000/crypto
DA15000_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/dialog/DialogSDK/bsp/include
DA15000_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/dialog/DialogSDK/bsp/peripherals/include
+12 -9
View File
@@ -42,12 +42,15 @@ OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli-app=all \
--enable-ncp-app=all \
--with-ncp-bus=uart \
--enable-cli \
--enable-diag \
--with-examples=efr32 \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--enable-linker-map \
--with-examples=efr32 \
MBEDTLS_CPPFLAGS="$(EFR32_MBEDTLS_CPPFLAGS)" \
$(NULL)
@@ -79,11 +82,11 @@ EFR32_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"efr32-mbedtls-config.h\"'
EFR32_MBEDTLS_CPPFLAGS += -D$(MCU)
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/efr32/crypto
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.2/util/third_party/mbedtls/configs
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.2/platform/CMSIS/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.2/util/third_party/mbedtls/sl_crypto/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.2/platform/Device/SiliconLabs/EFR32MG12P/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.2/platform/emlib/inc
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.3/util/third_party/mbedtls/configs
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.3/platform/CMSIS/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.3/util/third_party/mbedtls/sl_crypto/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.3/platform/Device/SiliconLabs/EFR32MG12P/Include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/silabs/gecko_sdk_suite/v2.3/platform/emlib/inc
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include
EFR32_MBEDTLS_CPPFLAGS += -I$(AbsTopSourceDir)/third_party/mbedtls/repo/include/mbedtls
+6 -3
View File
@@ -42,11 +42,14 @@ OBJCOPY = arc-elf32-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli-app=all \
--enable-ncp-app=all \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--with-examples=emsk \
--enable-radio-only \
--enable-linker-map \
--with-examples=emsk \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
+3 -1
View File
@@ -46,8 +46,10 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
BuildJobs ?= 9
configure_OPTIONS = \
--enable-cli-app=ftd \
--enable-cli \
--enable-diag \
--enable-ftd \
--enable-mtd \
--with-examples=$(PPREFIX) \
$(NULL)
+7 -4
View File
@@ -42,12 +42,15 @@ OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli-app=all \
--enable-ncp-app=all \
--with-ncp-bus=uart \
--enable-cli \
--enable-diag \
--with-examples=kw41z \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--enable-linker-map \
--with-examples=kw41z \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
+10 -3
View File
@@ -43,11 +43,14 @@ BuildJobs ?= 10
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
configure_OPTIONS = \
--enable-cli-app=all \
--enable-ncp-app=all \
--enable-cli \
--enable-diag \
--with-examples=nrf52840 \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--enable-linker-map \
--with-examples=nrf52840 \
MBEDTLS_CPPFLAGS="$(NRF52840_MBEDTLS_CPPFLAGS)" \
$(NULL)
@@ -61,6 +64,10 @@ else
configure_OPTIONS += --with-ncp-bus=uart
endif
ifeq ($(BOOTLOADER),1)
configure_OPTIONS += --with-custom-linker-file=$(AbsTopSourceDir)/examples/platforms/nrf52840/nrf52840_bootloader.ld
endif
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
+13 -7
View File
@@ -46,26 +46,31 @@ BuildJobs ?= 10
configure_OPTIONS = \
--enable-application-coap \
--enable-application-coap-secure \
--enable-border-agent \
--enable-border-router \
--enable-cert-log \
--enable-child-supervision \
--enable-cli-app=all \
--enable-cli \
--enable-commissioner \
--enable-dhcp6-client \
--enable-dhcp6-server \
--enable-diag \
--enable-dns-client \
--enable-ftd \
--enable-jam-detection \
--enable-joiner \
--enable-legacy \
--enable-mac-filter \
--enable-mtd \
--enable-mtd-network-diagnostic \
--enable-ncp-app=all \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--enable-raw-link-api \
--enable-service \
--enable-tmf-proxy \
--enable-udp-proxy \
--with-examples=posix \
--with-ncp-bus=uart \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
@@ -87,6 +92,10 @@ ifeq ($(VIRTUAL_TIME),1)
COMMONCFLAGS += -DOPENTHREAD_POSIX_VIRTUAL_TIME=1
endif
ifeq ($(VIRTUAL_TIME_UART),1)
COMMONCFLAGS += -DOPENTHREAD_POSIX_VIRTUAL_TIME_UART=1
endif
CPPFLAGS += \
$(COMMONCFLAGS) \
$(NULL)
@@ -106,9 +115,6 @@ LDFLAGS += \
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
+7 -4
View File
@@ -42,12 +42,15 @@ OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli-app=all \
--enable-ncp-app=all \
--with-ncp-bus=uart \
--enable-cli \
--enable-diag \
--with-examples=samr21 \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--with-ncp-bus=uart \
--enable-radio-only \
--enable-linker-map \
--with-examples=samr21 \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
+1 -1
View File
@@ -41,11 +41,11 @@ EXTRA_DIST = \
# Always build (e.g. for 'make all') these subdirectories.
if OPENTHREAD_ENABLE_EXAMPLES
SUBDIRS = \
platforms \
$(NULL)
if OPENTHREAD_EXAMPLES
SUBDIRS += \
apps \
$(NULL)
+6 -2
View File
@@ -63,7 +63,7 @@ LDADD_COMMON += \
$(NULL)
endif # OPENTHREAD_ENABLE_DIAG
if OPENTHREAD_ENABLE_CLI_FTD
if OPENTHREAD_ENABLE_FTD
bin_PROGRAMS += \
ot-cli-ftd \
$(NULL)
@@ -93,7 +93,7 @@ ot_cli_ftd_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_CLI_MTD
if OPENTHREAD_ENABLE_MTD
bin_PROGRAMS += \
ot-cli-mtd \
$(NULL)
@@ -129,6 +129,10 @@ ot_cli_mtd_LDFLAGS += -Wl,-Ma
endif
if OPENTHREAD_BUILD_COVERAGE
CPPFLAGS_COMMON += \
-DOPENTHREAD_ENABLE_COVERAGE \
$(NULL)
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
+25 -5
View File
@@ -32,10 +32,19 @@
#include <openthread/cli.h>
#include <openthread/diag.h>
#include <openthread/openthread.h>
#include <openthread/tasklet.h>
#include <openthread/platform/logging.h>
#include "platform.h"
#include "openthread-system.h"
#if OPENTHREAD_EXAMPLES_POSIX
#include <setjmp.h>
#include <unistd.h>
jmp_buf gResetJump;
void __gcov_flush();
#endif
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
void *otPlatCAlloc(size_t aNum, size_t aSize)
@@ -58,6 +67,17 @@ int main(int argc, char *argv[])
{
otInstance *sInstance;
#if OPENTHREAD_EXAMPLES_POSIX
if (setjmp(gResetJump))
{
alarm(0);
#if OPENTHREAD_ENABLE_COVERAGE
__gcov_flush();
#endif
execvp(argv[0], argv);
}
#endif
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
size_t otInstanceBufferLength = 0;
uint8_t *otInstanceBuffer = NULL;
@@ -65,7 +85,7 @@ int main(int argc, char *argv[])
pseudo_reset:
PlatformInit(argc, argv);
otSysInit(argc, argv);
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
// Call to query the buffer size
@@ -88,10 +108,10 @@ pseudo_reset:
otDiagInit(sInstance);
#endif
while (!PlatformPseudoResetWasRequested())
while (!otSysPseudoResetWasRequested())
{
otTaskletsProcess(sInstance);
PlatformProcessDrivers(sInstance);
otSysProcessDrivers(sInstance);
}
otInstanceFinalize(sInstance);
+15 -4
View File
@@ -54,6 +54,9 @@ SOURCES_COMMON += \
LDADD_MBEDTLS = \
$(NULL)
LDADD_DIAG = \
$(NULL)
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
LDADD_MBEDTLS += \
$(top_builddir)/third_party/mbedtls/libmbedcrypto.a \
@@ -61,7 +64,7 @@ LDADD_MBEDTLS += \
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
if OPENTHREAD_ENABLE_DIAG
LDADD_COMMON += \
LDADD_DIAG += \
$(top_builddir)/src/diag/libopenthread-diag.a \
$(NULL)
endif
@@ -72,7 +75,7 @@ LDADD_COMMON += \
$(NULL)
endif # OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER
if OPENTHREAD_ENABLE_NCP_FTD
if OPENTHREAD_ENABLE_FTD
bin_PROGRAMS += \
ot-ncp-ftd \
$(NULL)
@@ -87,9 +90,11 @@ ot_ncp_ftd_LDADD = \
$(top_builddir)/src/core/libopenthread-ftd.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS) \
$(LDADD_DIAG) \
$(top_builddir)/src/core/libopenthread-ftd.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS) \
$(LDADD_DIAG) \
$(NULL)
ot_ncp_ftd_LDFLAGS = \
@@ -104,7 +109,7 @@ ot_ncp_ftd_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_NCP_MTD
if OPENTHREAD_ENABLE_MTD
bin_PROGRAMS += \
ot-ncp-mtd \
$(NULL)
@@ -119,9 +124,11 @@ ot_ncp_mtd_LDADD = \
$(top_builddir)/src/core/libopenthread-mtd.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS) \
$(LDADD_DIAG) \
$(top_builddir)/src/core/libopenthread-mtd.a \
$(LDADD_COMMON) \
$(LDADD_MBEDTLS) \
$(LDADD_DIAG) \
$(NULL)
ot_ncp_mtd_LDFLAGS = \
@@ -136,7 +143,7 @@ ot_ncp_mtd_SOURCES = \
$(SOURCES_COMMON) \
$(NULL)
if OPENTHREAD_ENABLE_NCP_RADIO
if OPENTHREAD_ENABLE_RADIO_ONLY
bin_PROGRAMS += \
ot-ncp-radio \
$(NULL)
@@ -173,6 +180,10 @@ ot_ncp_radio_LDFLAGS += -Wl,-Ma
endif
if OPENTHREAD_BUILD_COVERAGE
CPPFLAGS_COMMON += \
-DOPENTHREAD_ENABLE_COVERAGE \
$(NULL)
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
+25 -5
View File
@@ -32,9 +32,18 @@
#include <openthread/diag.h>
#include <openthread/ncp.h>
#include <openthread/openthread.h>
#include <openthread/tasklet.h>
#include "platform.h"
#include "openthread-system.h"
#if OPENTHREAD_EXAMPLES_POSIX
#include <setjmp.h>
#include <unistd.h>
jmp_buf gResetJump;
void __gcov_flush();
#endif
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
void *otPlatCAlloc(size_t aNum, size_t aSize)
@@ -57,6 +66,17 @@ int main(int argc, char *argv[])
{
otInstance *sInstance;
#if OPENTHREAD_EXAMPLES_POSIX
if (setjmp(gResetJump))
{
alarm(0);
#if OPENTHREAD_ENABLE_COVERAGE
__gcov_flush();
#endif
execvp(argv[0], argv);
}
#endif
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
size_t otInstanceBufferLength = 0;
uint8_t *otInstanceBuffer = NULL;
@@ -64,7 +84,7 @@ int main(int argc, char *argv[])
pseudo_reset:
PlatformInit(argc, argv);
otSysInit(argc, argv);
#if OPENTHREAD_ENABLE_MULTIPLE_INSTANCES
// Call to query the buffer size
@@ -87,10 +107,10 @@ pseudo_reset:
otDiagInit(sInstance);
#endif
while (!PlatformPseudoResetWasRequested())
while (!otSysPseudoResetWasRequested())
{
otTaskletsProcess(sInstance);
PlatformProcessDrivers(sInstance);
otSysProcessDrivers(sInstance);
}
otInstanceFinalize(sInstance);
+1 -2
View File
@@ -29,7 +29,6 @@
#pragma once
#define OTDLL 1
#include <openthread/openthread.h>
#include <openthread/border_router.h>
#include <openthread/thread_ftd.h>
#include <openthread/commissioner.h>
@@ -72,7 +71,7 @@ public enum class otLinkModeFlags : unsigned int
None = 0,
RxOnWhenIdle = 0x1, /* 1, if the sender has its receiver on when not transmitting. 0, otherwise. */
SecureDataRequests = 0x2, /* 1, if the sender will use IEEE 802.15.4 to secure all data requests. 0, otherwise. */
DeviceType = 0x4, /* 1, if the sender is an FFD. 0, otherwise. */
DeviceType = 0x4, /* 1, if the sender is an FTD. 0, otherwise. */
NetworkData = 0x8 /* 1, if the sender requires the full Network Data. 0, otherwise. */
};
+10 -2
View File
@@ -26,6 +26,10 @@
# POSSIBILITY OF SUCH DAMAGE.
#
ifeq ($(BORDER_AGENT),1)
configure_OPTIONS += --enable-border-agent
endif
ifeq ($(BORDER_ROUTER),1)
configure_OPTIONS += --enable-border-router
endif
@@ -39,6 +43,10 @@ ifeq ($(COAP),1)
configure_OPTIONS += --enable-application-coap
endif
ifeq ($(COAPS),1)
configure_OPTIONS += --enable-application-coap-secure
endif
ifeq ($(COMMISSIONER),1)
configure_OPTIONS += --enable-commissioner
endif
@@ -95,8 +103,8 @@ ifeq ($(SERVICE),1)
configure_OPTIONS += --enable-service
endif
ifeq ($(TMF_PROXY),1)
configure_OPTIONS += --enable-tmf-proxy
ifeq ($(UDP_PROXY),1)
configure_OPTIONS += --enable-udp-proxy
endif
ifeq ($(DEBUG_UART),1)
+8 -2
View File
@@ -2,6 +2,8 @@
OpenThread includes Windows 10 drivers necessary for interfacing with UART NCP devices. The design allows for support of both simple radio devices and devices running the complete OpenThread stack.
> **NOTE:** OpenThread's Windows integration has not been actively maintained for some time. While Windows builds are still a part of OpenThread's continuous integration (CI), the Windows CI only tests basic compilation.
## Architecture ##
Details on the architecture can be found [here](https://openthread.io/platforms/windows10).
@@ -99,7 +101,11 @@ Since most of these drivers are still under development, it is recommended to al
The filter driver `otlwf.sys` exposes the IOCTL interface that `otapi.dll` uses and houses the bulk of the actual Thread logic. `otapi.dll` exposes the C interface for user mode applications to use to control the Thread interfaces.
1. Download the latest binaries ([x86](https://ci.appveyor.com/api/projects/jwhui/openthread/artifacts/release.zip?job=Platform%3A+x86), [x64](https://ci.appveyor.com/api/projects/jwhui/openthread/artifacts/release.zip?job=Platform%3A+x64), [arm](https://ci.appveyor.com/api/projects/jwhui/openthread/artifacts/release.zip?job=Platform%3A+arm))
1. Download the latest platform binary on AppVeyor:
1. Go to the [latest build](https://ci.appveyor.com/project/jwhui/openthread) page
1. Select the desired platform (x64, x86, arm)
1. On the platform page, select **ARTIFACTS**
1. Download the release.zip file for that platform
1. Extract the files to a temporary location
1. Open an admin command prompt in the temporary location
1. Run the `install_otlwf.cmd` file
@@ -146,7 +152,7 @@ The `instancelist` command queries for all available instances/interfaces on the
### Sample Universal App
The latest build of the sample universal app can be downloaded from ([x86](https://ci.appveyor.com/api/projects/jwhui/openthread/artifacts/build/bin/app.zip?job=Platform%3A+x86), [x64](https://ci.appveyor.com/api/projects/jwhui/openthread/artifacts/build/bin/app.zip?job=Platform%3A+x64), [arm](https://ci.appveyor.com/api/projects/jwhui/openthread/artifacts/build/bin/app.zip?job=Platform%3A+arm)).
The latest builds of the sample universal app can be downloaded from the [latest AppVeyor build](https://ci.appveyor.com/project/jwhui/openthread).
### Running Python Certification Tests
@@ -35,8 +35,6 @@
#ifndef __OTLWFIOCTL_H__
#define __OTLWFIOCTL_H__
#include <openthread/types.h>
__inline LONG ThreadErrorToNtstatus(otError error) { return (LONG)-((int)error); }
// User-mode IOCTL path for CreateFile
+1 -3
View File
@@ -29,14 +29,12 @@
/**
* @file
* @brief
* This file defines a node interface for openthread.h to be used for certification tests
* This file defines a node interface for openthread to be used for certification tests
*/
#ifndef OTNODE_H_
#define OTNODE_H_
#include <openthread/openthread.h>
#ifndef OTNODEAPI
#define OTNODEAPI __declspec(dllimport)
#endif
+21 -15
View File
@@ -1506,7 +1506,7 @@ otLinkSetExtendedAddress(
}
OTAPI
const uint8_t *
const otExtendedPanId *
OTCALL
otThreadGetExtendedPanId(
_In_ otInstance *aInstance
@@ -1515,12 +1515,13 @@ otThreadGetExtendedPanId(
if (aInstance == nullptr) return nullptr;
otExtendedPanId *Result = (otExtendedPanId*)malloc(sizeof(otExtendedPanId));
if (Result && QueryIOCTL(aInstance, IOCTL_OTLWF_OT_EXTENDED_PANID, Result) != ERROR_SUCCESS)
if (Result == nullptr) return nullptr;
if (QueryIOCTL(aInstance, IOCTL_OTLWF_OT_EXTENDED_PANID, Result) != ERROR_SUCCESS)
{
free(Result);
Result = nullptr;
}
return (uint8_t*)Result;
return Result;
}
OTAPI
@@ -1528,11 +1529,11 @@ otError
OTCALL
otThreadSetExtendedPanId(
_In_ otInstance *aInstance,
const uint8_t *aExtendedPanId
const otExtendedPanId *aExtendedPanId
)
{
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_EXTENDED_PANID, (const otExtendedPanId*)aExtendedPanId));
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_EXTENDED_PANID, aExtendedPanId));
}
OTAPI
@@ -1670,7 +1671,7 @@ otThreadGetMeshLocalEid(
}
OTAPI
const uint8_t *
const otMeshLocalPrefix *
OTCALL
otThreadGetMeshLocalPrefix(
_In_ otInstance *aInstance
@@ -1684,7 +1685,7 @@ otThreadGetMeshLocalPrefix(
free(Result);
Result = nullptr;
}
return (uint8_t*)Result;
return Result;
}
OTAPI
@@ -1692,11 +1693,11 @@ otError
OTCALL
otThreadSetMeshLocalPrefix(
_In_ otInstance *aInstance,
const uint8_t *aMeshLocalPrefix
const otMeshLocalPrefix *aMeshLocalPrefix
)
{
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_MESH_LOCAL_PREFIX, (const otMeshLocalPrefix*)aMeshLocalPrefix));
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_MESH_LOCAL_PREFIX, aMeshLocalPrefix));
}
OTAPI
@@ -2287,13 +2288,14 @@ OTAPI
otError
OTCALL
otDatasetSendMgmtActiveGet(
_In_ otInstance *aInstance,
_In_ otInstance *aInstance,
const otOperationalDatasetComponents *aDatasetComponents,
const uint8_t *aTlvTypes,
uint8_t aLength,
_In_opt_ const otIp6Address *aAddress
)
{
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
if (aInstance == nullptr || aDatasetComponents == nullptr) return OT_ERROR_INVALID_ARGS;
if (aTlvTypes == nullptr && aLength != 0) return OT_ERROR_INVALID_ARGS;
DWORD BufferSize = sizeof(GUID) + sizeof(uint8_t) + aLength;
@@ -2302,6 +2304,7 @@ otDatasetSendMgmtActiveGet(
if (Buffer == nullptr) return OT_ERROR_NO_BUFS;
memcpy_s(Buffer, BufferSize, &aInstance->InterfaceGuid, sizeof(GUID));
memcpy_s(Buffer + sizeof(GUID), BufferSize - sizeof(GUID), aDatasetComponents, sizeof(otOperationalDatasetComponents));
memcpy_s(Buffer + sizeof(GUID), BufferSize - sizeof(GUID), &aLength, sizeof(aLength));
if (aLength > 0)
memcpy_s(Buffer + sizeof(GUID) + sizeof(uint8_t), BufferSize - sizeof(GUID) - sizeof(uint8_t), aTlvTypes, aLength);
@@ -2320,7 +2323,7 @@ otError
OTCALL
otDatasetSendMgmtActiveSet(
_In_ otInstance *aInstance,
const otOperationalDataset *aDataset,
const otOperationalDataset *aDataset,
const uint8_t *aTlvs,
uint8_t aLength
)
@@ -2349,13 +2352,14 @@ OTAPI
otError
OTCALL
otDatasetSendMgmtPendingGet(
_In_ otInstance *aInstance,
_In_ otInstance *aInstance,
const otOperationalDatasetComponents *aDatasetComponents,
const uint8_t *aTlvTypes,
uint8_t aLength,
_In_opt_ const otIp6Address *aAddress
)
{
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
if (aInstance == nullptr || aDatasetComponents == nullptr) return OT_ERROR_INVALID_ARGS;
if (aTlvTypes == nullptr && aLength != 0) return OT_ERROR_INVALID_ARGS;
DWORD BufferSize = sizeof(GUID) + sizeof(uint8_t) + aLength;
@@ -2364,6 +2368,7 @@ otDatasetSendMgmtPendingGet(
if (Buffer == nullptr) return OT_ERROR_NO_BUFS;
memcpy_s(Buffer, BufferSize, &aInstance->InterfaceGuid, sizeof(GUID));
memcpy_s(Buffer + sizeof(GUID), BufferSize - sizeof(GUID), aDatasetComponents, sizeof(otOperationalDatasetComponents));
memcpy_s(Buffer + sizeof(GUID), BufferSize - sizeof(GUID), &aLength, sizeof(aLength));
if (aLength > 0)
memcpy_s(Buffer + sizeof(GUID) + sizeof(uint8_t), BufferSize - sizeof(GUID) - sizeof(uint8_t), aTlvTypes, aLength);
@@ -3440,7 +3445,7 @@ otThreadErrorToString(
switch (aError)
{
case OT_ERROR_NONE:
retval = "None";
retval = "OK";
break;
case OT_ERROR_FAILED:
@@ -3941,6 +3946,7 @@ otJoinerGetId(
)
{
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
ZeroMemory(aJoinerId, sizeof(otExtAddress));
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_JOINER_ID, aJoinerId));
}
+1 -1
View File
@@ -21,9 +21,9 @@
#define OTDLL
#define OTAPI EXTERN_C __declspec(dllexport)
#include <openthread/openthread.h>
#include <openthread/border_router.h>
#include <openthread/dataset_ftd.h>
#include <openthread/error.h>
#include <openthread/thread_ftd.h>
#include <openthread/commissioner.h>
#include <openthread/joiner.h>
-1
View File
@@ -29,7 +29,6 @@
#include <windows.h>
#include <stdio.h>
#include <openthread/openthread.h>
#include <openthread/cli.h>
#include <openthread/platform/uart.h>
#include <openthread/platform/misc.h>
+25 -19
View File
@@ -1256,12 +1256,13 @@ otLwfIoCtl_otExtendedPanId(
if (InBufferLength >= sizeof(otExtendedPanId))
{
status = ThreadErrorToNtstatus(otThreadSetExtendedPanId(pFilter->otCtx, (uint8_t*)InBuffer));
status = ThreadErrorToNtstatus(otThreadSetExtendedPanId(pFilter->otCtx, (otExtendedPanId*)InBuffer));
*OutBufferLength = 0;
}
else if (*OutBufferLength >= sizeof(otExtendedPanId))
{
memcpy(OutBuffer, otThreadGetExtendedPanId(pFilter->otCtx), sizeof(otExtendedPanId));
const otExtendedPanId* aExtendedPanId = otThreadGetExtendedPanId(pFilter->otCtx);
memcpy(OutBuffer, aExtendedPanId, sizeof(otExtendedPanId));
*OutBufferLength = sizeof(otExtendedPanId);
status = STATUS_SUCCESS;
}
@@ -1539,7 +1540,7 @@ enum
{
kThreadMode_RxOnWhenIdle = (1 << 3),
kThreadMode_SecureDataRequest = (1 << 2),
kThreadMode_FullFunctionDevice = (1 << 1),
kThreadMode_FullThreadDevice = (1 << 1),
kThreadMode_FullNetworkData = (1 << 0),
};
@@ -1563,7 +1564,7 @@ otLwfTunIoCtl_otLinkMode(
if (aLinkMode->mRxOnWhenIdle) numeric_mode |= kThreadMode_RxOnWhenIdle;
if (aLinkMode->mSecureDataRequests) numeric_mode |= kThreadMode_SecureDataRequest;
if (aLinkMode->mDeviceType) numeric_mode |= kThreadMode_FullFunctionDevice;
if (aLinkMode->mDeviceType) numeric_mode |= kThreadMode_FullThreadDevice;
if (aLinkMode->mNetworkData) numeric_mode |= kThreadMode_FullNetworkData;
status =
@@ -1614,7 +1615,7 @@ otLwfTunIoCtl_otLinkMode_Handler(
aLinkMode->mRxOnWhenIdle = ((numeric_mode & kThreadMode_RxOnWhenIdle) == kThreadMode_RxOnWhenIdle);
aLinkMode->mSecureDataRequests = ((numeric_mode & kThreadMode_SecureDataRequest) == kThreadMode_SecureDataRequest);
aLinkMode->mDeviceType = ((numeric_mode & kThreadMode_FullFunctionDevice) == kThreadMode_FullFunctionDevice);
aLinkMode->mDeviceType = ((numeric_mode & kThreadMode_FullThreadDevice) == kThreadMode_FullThreadDevice);
aLinkMode->mNetworkData = ((numeric_mode & kThreadMode_FullNetworkData) == kThreadMode_FullNetworkData);
*OutBufferLength = sizeof(otLinkModeConfig);
@@ -1935,12 +1936,13 @@ otLwfIoCtl_otMeshLocalPrefix(
if (InBufferLength >= sizeof(otMeshLocalPrefix))
{
status = ThreadErrorToNtstatus(otThreadSetMeshLocalPrefix(pFilter->otCtx, InBuffer));
status = ThreadErrorToNtstatus(otThreadSetMeshLocalPrefix(pFilter->otCtx, (otMeshLocalPrefix*)InBuffer));
*OutBufferLength = 0;
}
else if (*OutBufferLength >= sizeof(otMeshLocalPrefix))
{
memcpy(OutBuffer, otThreadGetMeshLocalPrefix(pFilter->otCtx), sizeof(otMeshLocalPrefix));
const otMeshLocalPrefix* aMeshLocalPrefix = otThreadGetMeshLocalPrefix(pFilter->otCtx);
memcpy(OutBuffer, aMeshLocalPrefix, sizeof(otMeshLocalPrefix));
*OutBufferLength = sizeof(otMeshLocalPrefix);
status = STATUS_SUCCESS;
}
@@ -5918,20 +5920,22 @@ otLwfIoCtl_otSendActiveGet(
*OutBufferLength = 0;
UNREFERENCED_PARAMETER(OutBuffer);
if (InBufferLength >= sizeof(uint8_t))
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t))
{
uint8_t aLength = *(uint8_t*)InBuffer;
PUCHAR aTlvTypes = aLength == 0 ? NULL : InBuffer + sizeof(uint8_t);
const otOperationalDatasetComponents *aDatasetComp = (otOperationalDatasetComponents*)InBuffer;
uint8_t aLength = *(uint8_t*)(InBuffer + sizeof(otOperationalDatasetComponents));
PUCHAR aTlvTypes = aLength == 0 ? NULL : InBuffer + sizeof(otOperationalDatasetComponents) + sizeof(uint8_t);
if (InBufferLength >= sizeof(uint8_t) + aLength)
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength)
{
otIp6Address *aAddress = NULL;
if (InBufferLength >= sizeof(uint8_t) + aLength + sizeof(otIp6Address))
aAddress = (otIp6Address*)(InBuffer + sizeof(uint8_t) + aLength);
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength + sizeof(otIp6Address))
aAddress = (otIp6Address*)(InBuffer + sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength);
status = ThreadErrorToNtstatus(
otDatasetSendMgmtActiveGet(
pFilter->otCtx,
aDatasetComp,
aTlvTypes,
aLength,
aAddress)
@@ -5997,20 +6001,22 @@ otLwfIoCtl_otSendPendingGet(
*OutBufferLength = 0;
UNREFERENCED_PARAMETER(OutBuffer);
if (InBufferLength >= sizeof(uint8_t))
if (InBufferLength >= sizeof(otOperationalDataset) + sizeof(uint8_t))
{
uint8_t aLength = *(uint8_t*)InBuffer;
PUCHAR aTlvTypes = aLength == 0 ? NULL : InBuffer + sizeof(uint8_t);
const otOperationalDatasetComponents *aDatasetComp = (otOperationalDatasetComponents*)InBuffer;
uint8_t aLength = *(uint8_t*)(InBuffer + sizeof(otOperationalDataset));
PUCHAR aTlvTypes = aLength == 0 ? NULL : InBuffer + sizeof(otOperationalDataset) + sizeof(uint8_t);
if (InBufferLength >= sizeof(uint8_t) + aLength)
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength)
{
otIp6Address *aAddress = NULL;
if (InBufferLength >= sizeof(uint8_t) + aLength + sizeof(otIp6Address))
aAddress = (otIp6Address*)(InBuffer + sizeof(uint8_t) + aLength);
if (InBufferLength >= sizeof(otOperationalDatasetComponents) + sizeof(uint8_t) + aLength + sizeof(otIp6Address))
aAddress = (otIp6Address*)(InBuffer + sizeof(otOperationalDataset) + sizeof(uint8_t) + aLength);
status = ThreadErrorToNtstatus(
otDatasetSendMgmtPendingGet(
pFilter->otCtx,
aDatasetComp,
aTlvTypes,
aLength,
aAddress)
-1
View File
@@ -61,7 +61,6 @@ RtlCopyBufferToMdl(
#include <openthread-windows-config.h>
#include <openthread-core-config.h>
#include <openthread/openthread.h>
#include <openthread/border_router.h>
#include <openthread/dataset_ftd.h>
#include <openthread/thread_ftd.h>
@@ -1976,24 +1976,24 @@ OTNODEAPI int32_t OTCALL otNodeSetActiveDataset(otNode* aNode, uint64_t aTimesta
otOperationalDataset aDataset = {};
aDataset.mActiveTimestamp = aTimestamp;
aDataset.mIsActiveTimestampSet = true;
aDataset.mComponents.mIsActiveTimestampPresent = true;
if (aPanId != 0)
{
aDataset.mPanId = aPanId;
aDataset.mIsPanIdSet = true;
aDataset.mComponents.mIsPanIdPresent = true;
}
if (aChannel != 0)
{
aDataset.mChannel = aChannel;
aDataset.mIsChannelSet = true;
aDataset.mComponents.mIsChannelPresent = true;
}
if (aChannelMask != 0)
{
aDataset.mChannelMaskPage0 = aChannelMask;
aDataset.mIsChannelMaskPage0Set = true;
aDataset.mComponents.mIsChannelMaskPage0Present = true;
}
if (aMasterKey != NULL && strlen(aMasterKey) != 0)
@@ -2004,7 +2004,7 @@ OTNODEAPI int32_t OTCALL otNodeSetActiveDataset(otNode* aNode, uint64_t aTimesta
printf("invalid length key %d\r\n", keyLength);
return OT_ERROR_PARSE;
}
aDataset.mIsMasterKeySet = true;
aDataset.mComponents.mIsMasterKeyPresent = true;
}
auto result = otDatasetSetActive(aNode->mInstance, &aDataset);
@@ -2022,25 +2022,25 @@ OTNODEAPI int32_t OTCALL otNodeSetPendingDataset(otNode* aNode, uint64_t aActive
if (aActiveTimestamp != 0)
{
aDataset.mActiveTimestamp = aActiveTimestamp;
aDataset.mIsActiveTimestampSet = true;
aDataset.mComponents.mIsActiveTimestampPresent = true;
}
if (aPendingTimestamp != 0)
{
aDataset.mPendingTimestamp = aPendingTimestamp;
aDataset.mIsPendingTimestampSet = true;
aDataset.mComponents.mIsPendingTimestampPresent = true;
}
if (aPanId != 0)
{
aDataset.mPanId = aPanId;
aDataset.mIsPanIdSet = true;
aDataset.mComponents.mIsPanIdPresent = true;
}
if (aChannel != 0)
{
aDataset.mChannel = aChannel;
aDataset.mIsChannelSet = true;
aDataset.mComponents.mIsChannelPresent = true;
}
auto result = otDatasetSetPending(aNode->mInstance, &aDataset);
@@ -2058,31 +2058,31 @@ OTNODEAPI int32_t OTCALL otNodeSendPendingSet(otNode* aNode, uint64_t aActiveTim
if (aActiveTimestamp != 0)
{
aDataset.mActiveTimestamp = aActiveTimestamp;
aDataset.mIsActiveTimestampSet = true;
aDataset.mComponents.mIsActiveTimestampPresent = true;
}
if (aPendingTimestamp != 0)
{
aDataset.mPendingTimestamp = aPendingTimestamp;
aDataset.mIsPendingTimestampSet = true;
aDataset.mComponents.mIsPendingTimestampPresent = true;
}
if (aDelayTimer != 0)
{
aDataset.mDelay = aDelayTimer;
aDataset.mIsDelaySet = true;
aDataset.mComponents.mIsDelayPresent = true;
}
if (aPanId != 0)
{
aDataset.mPanId = aPanId;
aDataset.mIsPanIdSet = true;
aDataset.mComponents.mIsPanIdPresent = true;
}
if (aChannel != 0)
{
aDataset.mChannel = aChannel;
aDataset.mIsChannelSet = true;
aDataset.mComponents.mIsChannelPresent = true;
}
if (aMasterKey != NULL && strlen(aMasterKey) != 0)
@@ -2093,7 +2093,7 @@ OTNODEAPI int32_t OTCALL otNodeSendPendingSet(otNode* aNode, uint64_t aActiveTim
printf("invalid length key %d\r\n", keyLength);
return OT_ERROR_PARSE;
}
aDataset.mIsMasterKeySet = true;
aDataset.mComponents.mIsMasterKeyPresent = true;
}
if (aMeshLocal != NULL && strlen(aMeshLocal) != 0)
@@ -2102,13 +2102,13 @@ OTNODEAPI int32_t OTCALL otNodeSendPendingSet(otNode* aNode, uint64_t aActiveTim
auto error = otIp6AddressFromString(aMeshLocal, &prefix);
if (error != OT_ERROR_NONE) return error;
memcpy(aDataset.mMeshLocalPrefix.m8, prefix.mFields.m8, sizeof(aDataset.mMeshLocalPrefix.m8));
aDataset.mIsMeshLocalPrefixSet = true;
aDataset.mComponents.mIsMeshLocalPrefixPresent = true;
}
if (aNetworkName != NULL && strlen(aNetworkName) != 0)
{
strcpy_s(aDataset.mNetworkName.m8, sizeof(aDataset.mNetworkName.m8), aNetworkName);
aDataset.mIsNetworkNameSet = true;
aDataset.mComponents.mIsNetworkNamePresent = true;
}
auto result = otDatasetSendMgmtPendingSet(aNode->mInstance, &aDataset, nullptr, 0);
@@ -2128,24 +2128,24 @@ OTNODEAPI int32_t OTCALL otNodeSendActiveSet(otNode* aNode, uint64_t aActiveTime
if (aActiveTimestamp != 0)
{
aDataset.mActiveTimestamp = aActiveTimestamp;
aDataset.mIsActiveTimestampSet = true;
aDataset.mComponents.mIsActiveTimestampPresent = true;
}
if (aPanId != 0)
{
aDataset.mPanId = aPanId;
aDataset.mIsPanIdSet = true;
aDataset.mComponents.mIsPanIdPresent = true;
}
if (aChannel != 0)
{
aDataset.mChannel = aChannel;
aDataset.mIsChannelSet = true;
aDataset.mComponents.mIsChannelPresent = true;
}
if (aChannelMask != 0)
{
aDataset.mChannelMaskPage0 = aChannelMask;
aDataset.mIsChannelMaskPage0Set = true;
aDataset.mComponents.mIsChannelMaskPage0Present = true;
}
if (aExtPanId != NULL && strlen(aExtPanId) != 0)
@@ -2156,7 +2156,7 @@ OTNODEAPI int32_t OTCALL otNodeSendActiveSet(otNode* aNode, uint64_t aActiveTime
printf("invalid length ext pan id %d\r\n", keyLength);
return OT_ERROR_PARSE;
}
aDataset.mIsExtendedPanIdSet = true;
aDataset.mComponents.mIsExtendedPanIdPresent = true;
}
if (aMasterKey != NULL && strlen(aMasterKey) != 0)
@@ -2167,7 +2167,7 @@ OTNODEAPI int32_t OTCALL otNodeSendActiveSet(otNode* aNode, uint64_t aActiveTime
printf("invalid length key %d\r\n", keyLength);
return OT_ERROR_PARSE;
}
aDataset.mIsMasterKeySet = true;
aDataset.mComponents.mIsMasterKeyPresent = true;
}
if (aMeshLocal != NULL && strlen(aMeshLocal) != 0)
@@ -2176,13 +2176,13 @@ OTNODEAPI int32_t OTCALL otNodeSendActiveSet(otNode* aNode, uint64_t aActiveTime
auto error = otIp6AddressFromString(aMeshLocal, &prefix);
if (error != OT_ERROR_NONE) return error;
memcpy(aDataset.mMeshLocalPrefix.m8, prefix.mFields.m8, sizeof(aDataset.mMeshLocalPrefix.m8));
aDataset.mIsMeshLocalPrefixSet = true;
aDataset.mComponents.mIsMeshLocalPrefixPresent = true;
}
if (aNetworkName != NULL && strlen(aNetworkName) != 0)
{
strcpy_s(aDataset.mNetworkName.m8, sizeof(aDataset.mNetworkName.m8), aNetworkName);
aDataset.mIsNetworkNameSet = true;
aDataset.mComponents.mIsNetworkNamePresent = true;
}
if (aBinary != NULL && strlen(aBinary) != 0)
@@ -49,7 +49,6 @@ using namespace std;
#define OTDLL
#define OTNODEAPI EXTERN_C __declspec(dllexport)
#include <openthread/openthread.h>
#include <openthread/border_router.h>
#include <openthread/dataset_ftd.h>
#include <openthread/thread_ftd.h>
+7 -1
View File
@@ -31,6 +31,7 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
# Always package (e.g. for 'make dist') these subdirectories.
DIST_SUBDIRS = \
cc1352 \
cc2538 \
cc2650 \
cc2652 \
@@ -51,6 +52,10 @@ SUBDIRS = \
utils \
$(NULL)
if OPENTHREAD_EXAMPLES_CC1352
SUBDIRS += cc1352
endif
if OPENTHREAD_EXAMPLES_CC2538
SUBDIRS += cc2538
endif
@@ -96,12 +101,13 @@ SUBDIRS += samr21
endif
noinst_HEADERS = \
platform.h \
openthread-system.h \
$(NULL)
# Always pretty (e.g. for 'make pretty') these subdirectories.
PRETTY_SUBDIRS = \
cc1352 \
cc2538 \
cc2650 \
cc2652 \
+4
View File
@@ -41,6 +41,10 @@ LDFLAGS_COMMON = $(NULL)
SOURCES_COMMON = $(NULL)
LIBTOOLFLAGS_COMMON = --preserve-dup-deps
if OPENTHREAD_EXAMPLES_CC1352
include $(top_srcdir)/examples/platforms/cc1352/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_CC2538
include $(top_srcdir)/examples/platforms/cc2538/Makefile.platform.am
endif
+86
View File
@@ -0,0 +1,86 @@
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
lib_LIBRARIES = libopenthread-cc1352.a
# Do not enable -pedantic-errors for cc13xx driverlib
override CFLAGS := $(filter-out -pedantic-errors,$(CFLAGS))
override CXXFLAGS := $(filter-out -pedantic-errors,$(CXXFLAGS))
libopenthread_cc1352_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/examples/platforms/cc1352 \
-I$(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2 \
-I$(top_srcdir)/third_party/mbedtls/repo/include \
$(MBEDTLS_CPPFLAGS) \
$(NULL)
PLATFORM_SOURCES = \
alarm.c \
diag.c \
flash.c \
logging.c \
misc.c \
radio.c \
random.c \
system.c \
uart.c \
crypto/aes_alt.c \
cc1352_ccfg.c \
cc1352_startup.c \
cxx_helpers.c \
$(NULL)
libopenthread_cc1352_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
libopenthread_cc1352_a_DEPENDENCIES = \
$(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.a \
$(NULL)
noinst_HEADERS = \
platform-cc1352.h \
$(NULL)
PRETTY_FILES = \
$(PLATFORM_SOURCES) \
$(noinst_HEADERS) \
$(NULL)
Dash = -
libopenthread_cc1352_a_LIBADD = \
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
@@ -0,0 +1,44 @@
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#
# cc1352 platform-specific Makefile
#
CPPFLAGS_COMMON += \
-I$(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2 \
$(NULL)
LDADD_COMMON += \
$(top_builddir)/examples/platforms/cc1352/libopenthread-cc1352.a \
$(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.a \
$(NULL)
LDFLAGS_COMMON += \
-T $(top_srcdir)/third_party/ti/devices/cc13x2_cc26x2/linker_files/cc26x2r1f.lds \
$(NULL)
+120
View File
@@ -0,0 +1,120 @@
# OpenThread on CC1352 Example
This directory contains example platform drivers for the [Texas Instruments
CC1352R1][cc1352r1].
The example platform drivers are intended to present the minimal code necessary
to support OpenThread. As a result, the example platform drivers do not
necessarily highlight the platform's full capabilities. Consult the [SimpleLink
CC26X2R1 SDK][cc26x2r1-sdk] for more development option. The platform drivers
were built for the [CC1352R1 LAUNCHXL][cc1352r1-launchxl], usage on other
boards with a cc1352r1 may require changes to the peripheral drivers.
[cc1352r1-launchxl]: http://www.ti.com/tool/launchxl-cc26x2r1
[cc26x2r1-sdk]: http://www.ti.com/tool/simplelink-cc26x2-sdk
<!---
TODO: Update link when cc1352 product page is live
[cc1352r1]: http://www.ti.com/product/cc1352r1
-->
[cc1352r1]: http://www.ti.com/tool/launchxl-cc26x2r1
## Toolchain
Building the examples for the cc1352 requires [GNU AutoConf][gnu-autoconf],
[GNU AutoMake][gnu-automake], [Python][python], and the [ARM gcc
toolchain][arm-toolchain].
With the exception of the arm toolchain, most of these tools are installed by
default on modern Posix systems. It is recommended to setup a Linux virtual
machine for building on a Windows host system. For help setting up VirtualBox
with Ubuntu, consult this [community help wiki
article][ubuntu-wiki-virtualbox].
[gnu-autoconf]: https://www.gnu.org/software/autoconf
[gnu-automake]: https://www.gnu.org/software/automake
[python]: https://www.python.org
[arm-toolchain]: https://launchpad.net/gcc-arm-embedded
[cygwin]: https://www.cygwin.com
[mingw]: http://www.mingw.org
[ubuntu-wiki-virtualbox]: https://help.ubuntu.com/community/VirtualBox
In a Bash terminal, follow these instructions to install the GNU toolchain and
other dependencies.
```bash
$ cd <path-to-openthread>
$ ./script/bootstrap
```
## Building
In a Bash terminal, follow these instructions to build the cc1352 examples.
```bash
$ cd <path-to-openthread>
$ ./bootstrap
$ make -f examples/Makefile-cc1352
```
## Flash Binaries
If the build completed successfully, the `elf` files may be found in
`<path-to-openthread>/output/cc1352/bin`.
Flash the images with [Uniflash][uniflash]. Make sure to deselect the binary
check-box, Uniflash assumes a file without an extension is a binary file.
[uniflash]: http://www.ti.com/tool/uniflash
## Interact
### CLI example
1. With a terminal client (PuTTY, minicom, etc.) open the com port associated
with the cc1352 UART. The serial port settings are:
* 115200 baud
* 8 data bits
* no parity bit
* 1 stop bit
2. Type `help` for a list of commands.
3. Follow the instructions in the [CLI README][cli-readme] for instructions on
setting up a network.
[cli-readme]: ../../../src/cli/README.md
```bash
> help
help
channel
childtimeout
contextreusedelay
extaddr
extpanid
ipaddr
keysequence
leaderweight
masterkey
mode
netdataregister
networkidtimeout
networkname
panid
ping
prefix
releaserouterid
rloc16
route
routerupgradethreshold
scan
start
state
stop
whitelist
```
### NCP example
Refer to the documentation in the [wpantund][wpantund] project for build
instructions and usage information.
[wpantund]: https://github.com/openthread/wpantund
+128
View File
@@ -0,0 +1,128 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for the alarm.
*
*/
#include <openthread/config.h>
#include <driverlib/aon_rtc.h>
#include <stdbool.h>
#include <stdint.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
#include "platform-cc1352.h"
/* NOTE: we could use systick, but that would sacrifice atleast a few ops
* every ms, and not run when the processor is sleeping.
*/
static uint32_t sTime0 = 0;
static uint32_t sAlarmTime = 0;
static bool sIsRunning = false;
/**
* Function documented in platform-cc1352.h
*/
void cc1352AlarmInit(void)
{
/*
* NOTE: this will not enable the individual rtc alarm channels
*/
AONRTCEnable();
sIsRunning = true;
}
/**
* Function documented in platform/alarm-milli.h
*/
uint32_t otPlatAlarmMilliGetNow(void)
{
/*
* This is current value of RTC as it appears in the register.
* With seconds as the upper 32 bits and fractions of a second as the
* lower 32 bits <32.32>.
*/
uint64_t rtcVal = AONRTCCurrent64BitValueGet();
return ((rtcVal * 1000) >> 32);
}
/**
* Function documented in platform/alarm-milli.h
*/
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
{
(void)aInstance;
sTime0 = aT0;
sAlarmTime = aDt;
sIsRunning = true;
}
/**
* Function documented in platform/alarm-milli.h
*/
void otPlatAlarmMilliStop(otInstance *aInstance)
{
(void)aInstance;
sIsRunning = false;
}
/**
* Function documented in platform-cc1352.h
*/
void cc1352AlarmProcess(otInstance *aInstance)
{
uint32_t offsetTime;
if (sIsRunning)
{
/* unsinged subtraction will result in the absolute offset */
offsetTime = otPlatAlarmMilliGetNow() - sTime0;
if (sAlarmTime <= offsetTime)
{
sIsRunning = false;
#if OPENTHREAD_ENABLE_DIAG
if (otPlatDiagModeGet())
{
otPlatDiagAlarmFired(aInstance);
}
else
#endif /* OPENTHREAD_ENABLE_DIAG */
{
otPlatAlarmMilliFired(aInstance);
}
}
}
}
+49
View File
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Configure the Customer Configuration Area.
*/
// clang-format off
// enable bootloader backdoor
#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 // Enable ROM boot loader
#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x0 // Active low to open boot loader backdoor
#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER 0x0F // DIO15 (BTN-1 button) on CC1352 LaunchPad Board for boot loader backdoor
#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 // Enabled boot loader backdoor
/*
* Include the default ccfg struct and configuration code.
*/
#include <startup_files/ccfg.c>
// clang-format on
+201
View File
@@ -0,0 +1,201 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CC1352_RADIO_H_
#define CC1352_RADIO_H_
#include <driverlib/rf_ieee_cmd.h>
enum
{
IEEE802154_FRAME_TYPE_MASK = 0x7, ///< (IEEE 802.15.4-2006) PSDU.FCF.frameType
IEEE802154_FRAME_TYPE_ACK = 0x2, ///< (IEEE 802.15.4-2006) frame type: ACK
IEEE802154_ACK_REQUEST = (1<<5), ///< (IEEE 802.15.4-2006) PSDU.FCF.bAR
IEEE802154_DSN_OFFSET = 2, ///< (IEEE 802.15.4-2006) PSDU.sequenceNumber
IEEE802154_MAC_MIN_BE = 1, ///< (IEEE 802.15.4-2006) macMinBE
IEEE802154_MAC_MAX_BE = 5, ///< (IEEE 802.15.4-2006) macMaxBE
IEEE802154_MAC_MAX_CSMA_BACKOFFS = 4, ///< (IEEE 802.15.4-2006) macMaxCSMABackoffs
IEEE802154_MAC_MAX_FRAMES_RETRIES = 3, ///< (IEEE 802.15.4-2006) macMaxFrameRetries
IEEE802154_A_UINT_BACKOFF_PERIOD = 20, ///< (IEEE 802.15.4-2006 7.4.1) MAC constants
IEEE802154_A_TURNAROUND_TIME = 12, ///< (IEEE 802.15.4-2006 6.4.1) PHY constants
IEEE802154_PHY_SHR_DURATION = 10,
///< (IEEE 802.15.4-2006 6.4.2) PHY PIB attribute, specifically the O-QPSK PHY
IEEE802154_PHY_SYMBOLS_PER_OCTET = 2,
///< (IEEE 802.15.4-2006 6.4.2) PHY PIB attribute, specifically the O-QPSK PHY
IEEE802154_MAC_ACK_WAIT_DURATION = (IEEE802154_A_UINT_BACKOFF_PERIOD +
IEEE802154_A_TURNAROUND_TIME +
IEEE802154_PHY_SHR_DURATION +
( 6 * IEEE802154_PHY_SYMBOLS_PER_OCTET)),
///< (IEEE 802.15.4-2006 7.4.2) macAckWaitDuration PIB attribute
IEEE802154_SYMBOLS_PER_SEC = 62500 ///< (IEEE 802.15.4-2006 6.5.3.2) O-QPSK symbol rate
};
enum
{
CC1352_RAT_TICKS_PER_SEC = 4000000, ///< 4MHz clock
CC1352_INVALID_RSSI = 127,
CC1352_UNKNOWN_EUI64 = 0xFF,
///< If the EUI64 read from the ccfg is all ones then the customer did not set the address
};
/**
* TX Power dBm lookup table - values from SmartRF Studio
*/
typedef struct output_config
{
int dbm;
uint16_t value;
} output_config_t;
/**
* * TX Power dBm lookup table from SmartRF Studio 7 2.10.0#94
*/
static const output_config_t rgOutputPower[] =
{
{ 5, 0x941E},
{ 4, 0x6c16},
{ 3, 0x5411},
{ 2, 0x440d},
{ 1, 0x385c},
{ 0, 0x3459},
{ -3, 0x2851},
{ -5, 0x224e},
{ -6, 0x204d},
{ -9, 0x0a8d},
{ -10, 0x168c},
{ -12, 0x108a},
{ -15, 0xc88c},
{ -18, 0x06c9},
{ -21, 0x06c7},
};
#define OUTPUT_CONFIG_COUNT (sizeof(rgOutputPower) / sizeof(rgOutputPower[0]))
/* Max and Min Output Power in dBm */
#define OUTPUT_POWER_MIN (rgOutputPower[OUTPUT_CONFIG_COUNT - 1].dbm)
#define OUTPUT_POWER_MAX (rgOutputPower[0].dbm)
#define OUTPUT_POWER_UNKNOWN 0xFFFF
/**
* return value used when searching the source match array
*/
#define CC1352_SRC_MATCH_NONE 0xFF
/**
* number of extended addresses used for source matching
*/
#define CC1352_EXTADD_SRC_MATCH_NUM 10
/**
* structure for source matching extended addresses
*/
typedef struct __attribute__((aligned(4))) ext_src_match_data
{
uint32_t srcMatchEn[((CC1352_EXTADD_SRC_MATCH_NUM + 31) / 32)];
uint32_t srcPendEn[((CC1352_EXTADD_SRC_MATCH_NUM + 31) / 32)];
uint64_t extAddrEnt[CC1352_EXTADD_SRC_MATCH_NUM];
} ext_src_match_data_t;
/**
* number of short addresses used for source matching
*/
#define CC1352_SHORTADD_SRC_MATCH_NUM 10
/**
* structure for source matching short addresses
*/
typedef struct __attribute__((aligned(4))) short_src_match_data
{
uint32_t srcMatchEn[((CC1352_SHORTADD_SRC_MATCH_NUM + 31) / 32)];
uint32_t srcPendEn[((CC1352_SHORTADD_SRC_MATCH_NUM + 31) / 32)];
rfc_shortAddrEntry_t extAddrEnt[CC1352_SHORTADD_SRC_MATCH_NUM];
} short_src_match_data_t;
/**
* size of length field in receive struct
*
* defined in Table 23-10 of the cc26xx TRM
*/
#define DATA_ENTRY_LENSZ_BYTE 1
/**
* address type for @ref rfCoreModifySourceMatchEntry()
*/
typedef enum cc1352_address
{
SHORT_ADDRESS = 1,
EXT_ADDRESS = 0,
} cc1352_address_t;
/**
* This enum represents the state of a radio.
* Initially, a radio is in the Disabled state.
*
* The following are valid radio state transitions for the cc1352:
*
* (Radio ON)
* +----------+ Enable() +-------+ Receive() +---------+ Transmit() +----------+
* | |----------->| |------------->| |--------------->| |
* | Disabled | | Sleep | | Receive | | Transmit |
* | |<-----------| |<-------------| |<---------------| |
* +----------+ Disable() | | Sleep() | | AckFrame RX or +----------+
* | | (Radio OFF) +---------+ sTxCmdChainDone == true
* | |
* | | EnergyScan() +--------+
* | |------------->| |
* | | | EdScan |
* | |<-------------| |
* | | signal ED | |
* +-------+ scan done +--------+
*
* These states slightly differ from the states in \ref include/platform/radio.h.
* The additional states the phy can be in are due to the asynchronous nature
* of the CM0 radio core.
*
* | state | description |
* |------------------|----------------------------------------------------|
* | Disabled | The rfcore powerdomain is off and the RFCPE is off |
* | Sleep | The RFCORE PD is on, and the RFCPE is in IEEE mode |
* | Receive | The RFCPE is running a CMD_IEEE_RX |
* | Transmit | The RFCPE is running a transmit command string |
* | TransmitComplete | The transmit command string has completed |
* | EdScan | The RFCPE is running a CMD_IEEE_ED_SCAN |
*
* \note The RAT start and Radio Setup commands may be moved to the Receive()
* and EnergyScan() transitions in the future.
*/
typedef enum cc1352_PhyState
{
cc1352_stateDisabled = 0,
cc1352_stateSleep,
cc1352_stateReceive,
cc1352_stateEdScan,
cc1352_stateTransmit,
} cc1352_PhyState_t;
#endif /* CC1352_RADIO_H_ */
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Include the standard startup files for the specified toolchain
* startup code is in 'third_party/ti'
*/
#if defined(__GNUC__)
#include <startup_files/startup_gcc.c>
#elif defined(__TI_ARM__)
#include <startup_files/startup_ccs.c>
#else
#error "Unknown compiler"
#endif
+202
View File
@@ -0,0 +1,202 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "aes_alt.h"
#include "mbedtls/aes.h"
#ifdef MBEDTLS_AES_ALT
#include <driverlib/crypto.h>
#include <driverlib/prcm.h>
#include <string.h>
#include <utils/code_utils.h>
#define CC1352_AES_KEY_UNUSED (-1)
#define CC1352_AES_CTX_MAGIC (0x7E)
/**
* bitmap of which key stores are currently used
*/
static uint8_t sUsedKeys = 0;
/**
* number of active contexts, used for power on/off of the crypto core
*/
static unsigned int sRefNum = 0;
/*
* Documented in aes_alt.h
*/
void mbedtls_aes_init(mbedtls_aes_context *ctx)
{
if (sRefNum++ == 0)
{
/* enable the crypto core */
/* The TRNG should already be running before we ever ask the AES core
* to do anything, if there is any scenario that the TRNG powers off
* the peripheral power domain use this code to repower it
PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH);
while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) != PRCM_DOMAIN_POWER_ON);
*/
PRCMPeripheralRunEnable(PRCM_PERIPH_CRYPTO);
PRCMPeripheralSleepEnable(PRCM_PERIPH_CRYPTO);
PRCMPeripheralDeepSleepEnable(PRCM_PERIPH_CRYPTO);
PRCMLoadSet();
while (!PRCMLoadGet())
;
}
ctx->magic = CC1352_AES_CTX_MAGIC;
ctx->key_idx = CC1352_AES_KEY_UNUSED;
}
/*
* Documented in aes_alt.h
*/
void mbedtls_aes_free(mbedtls_aes_context *ctx)
{
otEXPECT(ctx->magic == CC1352_AES_CTX_MAGIC);
if (ctx->key_idx != CC1352_AES_KEY_UNUSED)
{
sUsedKeys &= ~(1 << ctx->key_idx);
}
if (--sRefNum == 0)
{
/* disable the crypto core */
/* The TRNG core needs the peripheral power domain powered on to
* function. if there is a situation where the power domain must be
* powered off, use this code to do so.
PRCMPowerDomainOff(PRCM_DOMAIN_PERIPH);
while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) != PRCM_DOMAIN_POWER_OFF);
*/
PRCMPeripheralRunDisable(PRCM_PERIPH_CRYPTO);
PRCMPeripheralSleepDisable(PRCM_PERIPH_CRYPTO);
PRCMPeripheralDeepSleepDisable(PRCM_PERIPH_CRYPTO);
PRCMLoadSet();
while (!PRCMLoadGet())
;
}
memset((void *)ctx, 0x00, sizeof(ctx));
exit:
return;
}
/*
* Documented in aes_alt.h
*/
int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
{
unsigned char key_idx;
int retval = 0;
otEXPECT_ACTION(ctx->magic == CC1352_AES_CTX_MAGIC, retval = -1);
if (ctx->key_idx != CC1352_AES_KEY_UNUSED)
{
sUsedKeys &= ~(1 << ctx->key_idx);
}
/* our hardware only supports 128 bit keys */
otEXPECT_ACTION(keybits == 128u, retval = MBEDTLS_ERR_AES_INVALID_KEY_LENGTH);
for (key_idx = 0; ((sUsedKeys >> key_idx) & 0x01) != 0 && key_idx < 8; key_idx++)
;
/* we have no more room for this key */
otEXPECT_ACTION(key_idx < 8, retval = -2);
otEXPECT_ACTION(CRYPTOAesLoadKey((uint32_t *)key, key_idx) == AES_SUCCESS,
retval = MBEDTLS_ERR_AES_INVALID_KEY_LENGTH);
sUsedKeys |= (1 << key_idx);
ctx->key_idx = key_idx;
exit:
return retval;
}
/*
* Documented in aes_alt.h
*/
int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits)
{
unsigned char key_idx;
int retval = 0;
otEXPECT_ACTION(ctx->magic == CC1352_AES_CTX_MAGIC, retval = -1);
if (ctx->key_idx != CC1352_AES_KEY_UNUSED)
{
sUsedKeys &= ~(1 << ctx->key_idx);
}
/* our hardware only supports 128 bit keys */
otEXPECT_ACTION(keybits == 128u, retval = MBEDTLS_ERR_AES_INVALID_KEY_LENGTH);
for (key_idx = 0; ((sUsedKeys >> key_idx) & 0x01) != 0 && key_idx < 8; key_idx++)
;
/* we have no more room for this key */
otEXPECT_ACTION(key_idx < 8, retval = -2);
otEXPECT_ACTION(CRYPTOAesLoadKey((uint32_t *)key, key_idx) == AES_SUCCESS,
retval = MBEDTLS_ERR_AES_INVALID_KEY_LENGTH);
sUsedKeys |= (1 << key_idx);
ctx->key_idx = key_idx;
exit:
return retval;
}
/*
* Documented in aes_alt.h
*/
int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16])
{
int retval = -1;
retval = CRYPTOAesEcb((uint32_t *)input, (uint32_t *)output, ctx->key_idx, mode == MBEDTLS_AES_ENCRYPT, false);
otEXPECT(retval == AES_SUCCESS);
while ((retval = CRYPTOAesEcbStatus()) == AES_DMA_BSY)
;
CRYPTOAesEcbFinish();
exit:
return retval;
}
#endif /* MBEDTLS_AES_ALT */
+111
View File
@@ -0,0 +1,111 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MBEDTLS_AES_ALT_H
#define MBEDTLS_AES_ALT_H
#ifndef MBEDTLS_CONFIG_FILE
#include "cc1352-mbedtls-config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#ifdef MBEDTLS_AES_ALT
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
uint8_t magic;
signed char key_idx;
} mbedtls_aes_context;
/**
* @brief Initialize AES context
*
* @param [in,out] ctx AES context to be initialized
*/
void mbedtls_aes_init(mbedtls_aes_context *ctx);
/**
* @brief Clear AES context
*
* @param [in,out] ctx AES context to be cleared
*/
void mbedtls_aes_free(mbedtls_aes_context *ctx);
/**
* @brief AES key schedule (encryption)
*
* @param [in,out] ctx AES context to be used
* @param [in] key Encryption key
* @param [in] keybits Must be 128
*
* @retval 0 If successful
* @retval MBEDTLS_ERR_AES_INVALID_KEY_LENGTH If keybits was not 128
*/
int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key,
unsigned int keybits);
/**
* @brief AES key schedule (decryption)
*
* @param [in,out] ctx AES context to be used
* @param [in] key Decryption key
* @param [in] keybits Must be 128
*
* @retval 0 If successful
* @retval MBEDTLS_ERR_AES_INVALID_KEY_LENGTH If keybits was not 128
*/
int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key,
unsigned int keybits);
/**
* \brief AES-ECB block encryption/decryption
*
* \param ctx AES context
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
* \param input 16-byte input block
* \param output 16-byte output block
*
* @return The return value of @ref CRYPTOAesEcb.
* @retval 0 If successful
* @retval AES_KEYSTORE_READ_ERROR If the indicated keystore ram could not be read
*/
int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, int mode, const unsigned char input[16],
unsigned char output[16]);
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_AES_ALT */
#endif /* MBEDTLS_AES_ALT_H */
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CC1352_MBEDTLS_CONFIG_H
#define CC1352_MBEDTLS_CONFIG_H
#define MBEDTLS_AES_ALT
#endif // CC1352_MBEDTLS_CONFIG_H
+54
View File
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Helper functions for running c++ without the standard library
*/
__extension__ typedef int __guard __attribute__((mode(__DI__)));
int __cxa_guard_acquire(__guard *g)
{
return !*(char *)(g);
}
void __cxa_guard_release(__guard *g)
{
*(char *)g = 1;
}
void __cxa_guard_abort(__guard *g)
{
(void)g;
}
void __cxa_pure_virtual(void)
{
while (1)
;
}
+92
View File
@@ -0,0 +1,92 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <openthread/config.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <openthread/config.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/radio.h>
#include "platform-cc1352.h"
#if OPENTHREAD_ENABLE_DIAG
/**
* Diagnostics mode variables.
*
*/
static bool sDiagMode = false;
void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen)
{
(void)aInstance;
// Add more platform specific diagnostics features here.
if (argc > 1)
{
snprintf(aOutput, aOutputMaxLen, "diag feature '%s' is not supported\r\n", argv[0]);
}
}
void otPlatDiagModeSet(bool aMode)
{
sDiagMode = aMode;
}
bool otPlatDiagModeGet()
{
return sDiagMode;
}
void otPlatDiagChannelSet(uint8_t aChannel)
{
(void)aChannel;
}
void otPlatDiagTxPowerSet(int8_t aTxPower)
{
(void)aTxPower;
}
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
(void)aInstance;
(void)aFrame;
(void)aError;
}
void otPlatDiagAlarmCallback(otInstance *aInstance)
{
(void)aInstance;
}
#endif // OPENTHREAD_ENABLE_DIAG
+313
View File
@@ -0,0 +1,313 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <string.h>
#include <driverlib/aon_batmon.h>
#include <driverlib/flash.h>
#include <driverlib/interrupt.h>
#include <driverlib/vims.h>
#include <openthread-core-config.h>
#include <openthread/config.h>
#include <openthread/platform/alarm-milli.h>
#include <utils/code_utils.h>
#include "platform-cc1352.h"
/*
* The settings configuration base address *MUST* be defined in the core config
* file. The base address *MUST* be aligned on an 8K page boundary or the flash
* program calls will fail.
*/
#ifndef SETTINGS_CONFIG_BASE_ADDRESS
#error "SETTINGS_CONFIG_BASE_ADDRESS not defined in the OpenThread Core Config"
#endif /* SETTINGS_CONFIG_BASE_ADDRESS */
/*
* The settings configuration page size *MUST* be defined in the core config
* file. The page size *MUST* be 8K or the flash program calls will fail.
*/
#if (SETTINGS_CONFIG_PAGE_SIZE != 0x2000)
#error "SETTINGS_CONFIG_PAGE_SIZE must be defined in OpenThread Core Config"
#endif
/*
* The settings configuration page number _SHOULD_ be defined in the core
* config file.
*/
#ifndef SETTINGS_CONFIG_PAGE_NUM
#warn "SETTINGS_CONFIG_PAGE_NUM not defined in the OpenThread Core Config"
#endif /* SETTINGS_CONFIG_PAGE_NUM */
enum
{
MIN_VDD_FLASH = 0x18, /* 1.50 volts (0.50=128/256 -> 128=0x80) */
MAX_WRITE_INCREMENT = 8, /* maximum number of bytes to write at a time to
* avoid interrupt latency while in ROM
*/
};
/**
* Check if the Battery Monitor measurements and calculations are enabled.
*
* @return If the Battery Monitor is enabled.
* @retval true The Battery Monitor is on.
* @retval false The Battery Monitor is off.
*/
static bool isBatMonOn(void)
{
uint32_t batMonCtl = HWREG(AON_BATMON_BASE + AON_BATMON_O_CTL);
return ((batMonCtl & AON_BATMON_CTL_CALC_EN_M) == AON_BATMON_CTL_CALC_EN &&
(batMonCtl & AON_BATMON_CTL_MEAS_EN_M) == AON_BATMON_CTL_MEAS_EN);
}
/**
* Check if the supply voltage is high enough to support flash programming.
*
* @return If the Voltage is too low to support flash programming.
* @retval false The supply voltage is too low.
* @retval true The supply voltage is sufficient.
*/
static bool checkVoltage(void)
{
bool batMonWasOff = !isBatMonOn();
bool ret = false;
if (batMonWasOff)
{
AONBatMonEnable();
}
if (AONBatMonBatteryVoltageGet() >= MIN_VDD_FLASH)
{
ret = true;
}
if (batMonWasOff)
{
AONBatMonDisable();
}
return ret;
}
/**
* Disable Flash data caching and instruction pre-fetching.
*
* It is necessary to disable the caching and VIMS to ensure the cache has
* valid data while the program is executing.
*
* @return The VIMS state before being disabled.
*/
static uint32_t disableFlashCache(void)
{
uint32_t mode = VIMSModeGet(VIMS_BASE);
VIMSLineBufDisable(VIMS_BASE);
if (mode != VIMS_MODE_DISABLED)
{
VIMSModeSet(VIMS_BASE, VIMS_MODE_DISABLED);
while (VIMSModeGet(VIMS_BASE) != VIMS_MODE_DISABLED)
;
}
return mode;
}
/**
* Restore the Flash data caching and instruction pre-fetching.
*
* @param [in] mode The VIMS mode returned by @ref disableFlashCache.
*/
static void restoreFlashCache(uint32_t mode)
{
if (mode != VIMS_MODE_DISABLED)
{
VIMSModeSet(VIMS_BASE, mode);
}
VIMSLineBufEnable(VIMS_BASE);
}
/**
* Translate the errors from the Flash programming FSM to OpenThread error
* codes.
*
* @param [in] error Return from the Flash programming function.
*
* @return The corresponding OpenThread @ref otError value.
*/
static otError fsmErrorToOtError(uint32_t error)
{
otError ret = OT_ERROR_GENERIC;
switch (error)
{
case FAPI_STATUS_SUCCESS:
ret = OT_ERROR_NONE;
break;
case FAPI_STATUS_INCORRECT_DATABUFFER_LENGTH:
ret = OT_ERROR_INVALID_ARGS;
break;
case FAPI_STATUS_FSM_ERROR:
ret = OT_ERROR_FAILED;
break;
default:
break;
}
return ret;
}
/**
* Function documented in platforms/utils/flash.h
*/
otError utilsFlashInit(void)
{
return OT_ERROR_NONE;
}
/**
* Function documented in platforms/utils/flash.h
*/
uint32_t utilsFlashGetSize(void)
{
return FlashSizeGet();
}
/**
* Function documented in platforms/utils/flash.h
*/
otError utilsFlashErasePage(uint32_t aAddress)
{
uint32_t mode;
uint32_t fsmRet;
otError ret;
otEXPECT_ACTION(checkVoltage(), ret = OT_ERROR_FAILED);
mode = disableFlashCache();
fsmRet = FlashSectorErase(aAddress);
restoreFlashCache(mode);
ret = fsmErrorToOtError(fsmRet);
exit:
return ret;
}
/**
* Function documented in platforms/utils/flash.h
*/
otError utilsFlashStatusWait(uint32_t aTimeout)
{
uint32_t start = otPlatAlarmMilliGetNow();
otError ret = OT_ERROR_BUSY;
while ((otPlatAlarmMilliGetNow() - start) < aTimeout)
{
if (FlashCheckFsmForReady() == FAPI_STATUS_FSM_READY)
{
ret = OT_ERROR_NONE;
break;
}
}
return ret;
}
/**
* Function documented in platforms/utils/flash.h
*/
uint32_t utilsFlashWrite(uint32_t aAddress, uint8_t *aData, uint32_t aSize)
{
uint32_t mode;
uint32_t written = 0;
otEXPECT(checkVoltage());
mode = disableFlashCache();
while (written < aSize)
{
uint32_t toWrite = aSize - written;
uint8_t *data = aData + written;
uint32_t address = aAddress + written;
uint32_t fsmRet;
bool interruptsWereDisabled;
if (toWrite > MAX_WRITE_INCREMENT)
{
toWrite = MAX_WRITE_INCREMENT;
}
/* The CPU may not execute code from flash while a program is
* happening. We disable interrupts to ensure one does not preempt the
* ROM fsm.
*/
interruptsWereDisabled = IntMasterDisable();
fsmRet = FlashProgram(data, address, toWrite);
if (!interruptsWereDisabled)
{
IntMasterEnable();
}
if (fsmRet != FAPI_STATUS_SUCCESS)
{
break;
}
written += toWrite;
}
restoreFlashCache(mode);
exit:
return written;
}
/**
* Function documented in platforms/utils/flash.h
*/
uint32_t utilsFlashRead(uint32_t aAddress, uint8_t *aData, uint32_t aSize)
{
memcpy(aData, (void *)aAddress, (size_t)aSize);
return aSize;
}
+47
View File
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2016, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file logging.c
* Platform abstraction for the logging
*
*/
#include <openthread-core-config.h>
#include <openthread/config.h>
#include <openthread/platform/logging.h>
#include <openthread/platform/toolchain.h>
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \
(OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL)
OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
(void)aLogLevel;
(void)aLogRegion;
(void)aFormat;
}
#endif
+91
View File
@@ -0,0 +1,91 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <openthread/config.h>
#include <driverlib/sys_ctrl.h>
#include <openthread/platform/misc.h>
/*
* NOTE: if the system is flashed with Flash Programmer 2 or Uniflash, this
* reset will not work the first time. Both programs use the cJTAG module,
* which sets the halt in boot flag. The device must be manually reset the
* first time after being programmed through the JTAG interface.
*/
/**
* Function documented in platform/misc.h
*/
void otPlatReset(otInstance *aInstance)
{
(void)aInstance;
SysCtrlSystemReset();
}
/**
* Function documented in platform/misc.h
*/
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
(void)aInstance;
otPlatResetReason ret;
switch (SysCtrlResetSourceGet())
{
case RSTSRC_PWR_ON:
ret = OT_PLAT_RESET_REASON_POWER_ON;
break;
case RSTSRC_PIN_RESET:
ret = OT_PLAT_RESET_REASON_EXTERNAL;
break;
case RSTSRC_VDDS_LOSS:
case RSTSRC_VDDR_LOSS:
case RSTSRC_CLK_LOSS:
ret = OT_PLAT_RESET_REASON_CRASH;
break;
case RSTSRC_WARMRESET:
case RSTSRC_SYSRESET:
case RSTSRC_WAKEUP_FROM_SHUTDOWN:
ret = OT_PLAT_RESET_REASON_SOFTWARE;
break;
default:
ret = OT_PLAT_RESET_REASON_UNKNOWN;
break;
}
return ret;
}
void otPlatWakeHost(void)
{
// TODO: implement an operation to wake the host from sleep state.
}
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OPENTHREAD_CORE_CC1352_CONFIG_H_
#define OPENTHREAD_CORE_CC1352_CONFIG_H_
/**
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
*
* The platform-specific string to insert into the OpenThread version string.
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_INFO "CC1352"
/**
* @def SETTINGS_CONFIG_BASE_ADDRESS
*
* The base address of the pages to be used for non-volatile-settings storage.
*/
#define SETTINGS_CONFIG_BASE_ADDRESS (0x52000)
/**
* @def SETTINGS_CONFIG_PAGE_SIZE
*
* The size in bytes of a page for the cc26x2 platform.
*
* @note *MUST BE* 8K.
*/
#define SETTINGS_CONFIG_PAGE_SIZE (0x2000)
/**
* @def SETTINGS_CONFIG_PAGE_NUM
*
* The number of flash pages to use for non-volatile settings storage.
*/
#define SETTINGS_CONFIG_PAGE_NUM (2)
#endif /* OPENTHREAD_CORE_CC1352_CONFIG_H_ */
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, The OpenThread Authors.
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,57 +26,64 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* @brief
* This file defines the platform-specific initializers.
*/
#ifndef PLATFORM_H_
#define PLATFORM_H_
#include <openthread/types.h>
#include <openthread-core-config.h>
#include <stdint.h>
#include <openthread/config.h>
#include <openthread/instance.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* This function performs all platform-specific initialization.
*
*/
void PlatformInit(int argc, char *argv[]);
// Global OpenThread instance structure
extern otInstance *sInstance;
/**
* This function performs all platform-specific deinitialization.
*
* Initialize the debug uart
*/
void PlatformDeinit(void);
void cc1352DebugUartInit(void);
/**
* This function returns true is a pseudo-reset was requested.
* In such a case, the main loop should shut down and re-initialize
* the OpenThread instance.
* This method initializes the alarm service used by OpenThread.
*
*/
bool PlatformPseudoResetWasRequested(void);
void cc1352AlarmInit(void);
/**
* This function performs all platform-specific processing.
*
* @param[in] aInstance The OpenThread instance structure.
* This method performs alarm driver processing.
*
*/
void PlatformProcessDrivers(otInstance *aInstance);
void cc1352AlarmProcess(otInstance *aInstance);
/**
* This function is called whenever platform drivers needs processing.
* This method initializes the radio service used by OpenThread.
*
*/
extern void PlatformEventSignalPending(void);
void cc1352RadioInit(void);
/**
* This method performs radio driver processing.
*
*/
void cc1352RadioProcess(otInstance *aInstance);
/**
* This method initializes the random number service used by OpenThread.
*
*/
void cc1352RandomInit(void);
/**
* This method performs radio driver processing.
*
*/
void cc1352UartProcess(void);
#ifdef __cplusplus
} // end of extern "C"
} // extern "C"
#endif
#endif // PLATFORM_H_
File diff suppressed because it is too large Load Diff
+138
View File
@@ -0,0 +1,138 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <openthread/config.h>
#include <stddef.h>
#include <utils/code_utils.h>
#include <openthread/platform/random.h>
#include <driverlib/prcm.h>
#include <driverlib/trng.h>
enum
{
CC1352_TRNG_MIN_SAMPLES_PER_CYCLE = (1 << 6),
CC1352_TRNG_MAX_SAMPLES_PER_CYCLE = (1 << 24),
CC1352_TRNG_CLOCKS_PER_SAMPLE = 0,
};
/**
* \note if more than 32 bits of entropy are needed, the TRNG core produces
* 64 bits of random data, we just ignore the upper 32 bytes
*/
/**
* Function documented in platform-cc1352.h
*/
void cc1352RandomInit(void)
{
PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH);
while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) != PRCM_DOMAIN_POWER_ON)
;
PRCMPeripheralRunEnable(PRCM_PERIPH_TRNG);
PRCMPeripheralSleepEnable(PRCM_DOMAIN_PERIPH);
PRCMPeripheralDeepSleepEnable(PRCM_DOMAIN_PERIPH);
PRCMLoadSet();
TRNGConfigure(CC1352_TRNG_MIN_SAMPLES_PER_CYCLE, CC1352_TRNG_MAX_SAMPLES_PER_CYCLE, CC1352_TRNG_CLOCKS_PER_SAMPLE);
TRNGEnable();
}
/**
* Function documented in platform/random.h
*/
uint32_t otPlatRandomGet(void)
{
while (!(TRNGStatusGet() & TRNG_NUMBER_READY))
;
return TRNGNumberGet(TRNG_LOW_WORD);
}
/**
* Fill an arbitrary area with random data.
*
* @param [out] aOutput Area to place the random data.
* @param [in] aLen Size of the area to place random data.
* @param [out] oLen How much of the output was written to.
*
* @return Indication of error.
* @retval 0 No error occurred.
*/
static int TRNGPoll(unsigned char *aOutput, size_t aLen)
{
size_t length = 0;
union
{
uint32_t u32[2];
uint8_t u8[8];
} buffer;
while (length < aLen)
{
if (length % 8 == 0)
{
/* we've run to the end of the buffer */
while (!(TRNGStatusGet() & TRNG_NUMBER_READY))
;
/*
* don't use TRNGNumberGet here because it will tell the TRNG to
* refill the entropy pool, instead we do it ourself.
*/
buffer.u32[0] = HWREG(TRNG_BASE + TRNG_O_OUT0);
buffer.u32[1] = HWREG(TRNG_BASE + TRNG_O_OUT1);
HWREG(TRNG_BASE + TRNG_O_IRQFLAGCLR) = 0x1;
}
aOutput[length] = buffer.u8[length % 8];
length++;
}
return 0;
}
/**
* Function documented in platform/random.h
*/
otError otPlatRandomGetTrue(uint8_t *aOutput, uint16_t aOutputLength)
{
otError error = OT_ERROR_NONE;
size_t length = aOutputLength;
otEXPECT_ACTION(aOutput, error = OT_ERROR_INVALID_ARGS);
otEXPECT_ACTION(TRNGPoll((unsigned char *)aOutput, length) == 0, error = OT_ERROR_FAILED);
exit:
return error;
}
+88
View File
@@ -0,0 +1,88 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* @brief
* This file includes the platform-specific initializers.
*/
#include <openthread/config.h>
#include "platform-cc1352.h"
#include <stdio.h>
#include "inc/hw_ccfg.h"
#include "inc/hw_ccfg_simple_struct.h"
#include "inc/hw_types.h"
extern const ccfg_t __ccfg;
const char *dummy_ccfg_ref = ((const char *)(&(__ccfg)));
/**
* Function documented in platform-cc1352.h
*/
void otSysInit(int argc, char *argv[])
{
(void)argc;
(void)argv;
while (dummy_ccfg_ref == NULL)
{
/*
* This provides a code reference to the customer configuration area of
* the flash, otherwise the data is skipped by the linker and not put
* into the final flash image.
*/
}
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
cc1352DebugUartInit();
#endif
cc1352AlarmInit();
cc1352RandomInit();
cc1352RadioInit();
}
bool otSysPseudoResetWasRequested(void)
{
return false;
}
/**
* Function documented in platform-cc1352.h
*/
void otSysProcessDrivers(otInstance *aInstance)
{
// should sleep and wait for interrupts here
cc1352UartProcess();
cc1352RadioProcess(aInstance);
cc1352AlarmProcess(aInstance);
}
+333
View File
@@ -0,0 +1,333 @@
/*
* Copyright (c) 2018, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for UART communication.
*
*/
#include <openthread-core-config.h>
#include <openthread/config.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <openthread/platform/debug_uart.h>
#include <openthread/platform/logging.h>
#include <openthread/platform/uart.h>
#include "utils/code_utils.h"
#include <utils/code_utils.h>
#include <driverlib/ioc.h>
#include <driverlib/prcm.h>
#include <driverlib/sys_ctrl.h>
#include <driverlib/uart.h>
/**
* @note This will configure the uart for 115200 baud 8-N-1, no HW flow control
* RX pin IOID_2 TX pin IOID_3.
*
* If the DEBUG UART is enabled, IOID_0 = debug tx, IOID_1 = debug rx
*/
enum
{
CC1352_RECV_CIRC_BUFF_SIZE = 256,
};
static uint8_t const *sSendBuffer = NULL;
static uint16_t sSendLen = 0;
static uint8_t sReceiveBuffer[CC1352_RECV_CIRC_BUFF_SIZE];
static uint16_t sReceiveHeadIdx = 0;
static uint16_t sReceiveTailIdx = 0;
void UART0_intHandler(void);
static void uart_power_control(uint32_t who_base, int turnon)
{
uint32_t value;
if (turnon)
{
/* UART0 is in the SERIAL domain
* UART1 is in the PERIPH domain.
* See: ti/devices/cc13x2_cc26x2/driverlib/pcrm.h, line: 658
*/
value = (who_base == UART0_BASE) ? PRCM_DOMAIN_SERIAL : PRCM_DOMAIN_PERIPH;
PRCMPowerDomainOn(value);
while (PRCMPowerDomainStatus(value) != PRCM_DOMAIN_POWER_ON)
;
value = (who_base == UART0_BASE) ? PRCM_PERIPH_UART0 : PRCM_PERIPH_UART1;
PRCMPeripheralRunEnable(value);
PRCMPeripheralSleepEnable(value);
PRCMPeripheralDeepSleepEnable(value);
PRCMLoadSet();
while (!PRCMLoadGet())
;
}
else
{
if (who_base == UART0_BASE)
{
PRCMPeripheralRunDisable(PRCM_PERIPH_UART0);
PRCMPeripheralSleepDisable(PRCM_PERIPH_UART0);
PRCMPeripheralDeepSleepDisable(PRCM_PERIPH_UART0);
PRCMLoadSet();
PRCMPowerDomainOff(PRCM_DOMAIN_SERIAL);
}
else
{
/* we never turn the debug uart off */
}
}
}
/**
* Function documented in platform/uart.h
*/
otError otPlatUartEnable(void)
{
uart_power_control(UART0_BASE, true);
IOCPinTypeUart(UART0_BASE, IOID_12, IOID_13, IOID_UNUSED, IOID_UNUSED);
UARTConfigSetExpClk(UART0_BASE, SysCtrlClockGet(), 115200,
UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE);
/* Note: UART1 could use IRQs
* However, for reasons of debug simplicity
* we do not use IRQs for the debug uart
*/
UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
UARTIntRegister(UART0_BASE, UART0_intHandler);
UARTEnable(UART0_BASE);
return OT_ERROR_NONE;
}
/**
* Function documented in platform/uart.h
*/
otError otPlatUartDisable(void)
{
UARTDisable(UART0_BASE);
UARTIntUnregister(UART0_BASE);
UARTIntDisable(UART0_BASE, UART_INT_RX | UART_INT_RT);
IOCPortConfigureSet(IOID_2, IOC_PORT_GPIO, IOC_STD_INPUT);
IOCPortConfigureSet(IOID_3, IOC_PORT_GPIO, IOC_STD_INPUT);
uart_power_control(UART0_BASE, false);
return OT_ERROR_NONE;
}
/**
* Function documented in platform/uart.h
*/
otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(sSendBuffer == NULL, error = OT_ERROR_BUSY);
sSendBuffer = aBuf;
sSendLen = aBufLength;
exit:
return error;
}
/**
* @brief process the receive side of the buffers
*/
static void processReceive(void)
{
while (sReceiveHeadIdx != sReceiveTailIdx)
{
uint16_t tailIdx;
if (sReceiveHeadIdx < sReceiveTailIdx)
{
tailIdx = sReceiveTailIdx;
otPlatUartReceived(&(sReceiveBuffer[sReceiveHeadIdx]), tailIdx - sReceiveHeadIdx);
sReceiveHeadIdx = tailIdx;
}
else
{
tailIdx = CC1352_RECV_CIRC_BUFF_SIZE;
otPlatUartReceived(&(sReceiveBuffer[sReceiveHeadIdx]), tailIdx - sReceiveHeadIdx);
sReceiveHeadIdx = 0;
}
}
}
/**
* @brief process the transmit side of the buffers
*/
static void processTransmit(void)
{
otEXPECT(sSendBuffer != NULL);
for (; sSendLen > 0; sSendLen--)
{
UARTCharPut(UART0_BASE, *sSendBuffer);
sSendBuffer++;
}
sSendBuffer = NULL;
sSendLen = 0;
otPlatUartSendDone();
exit:
return;
}
/**
* Function documented in platform-cc1352.h
*/
void cc1352UartProcess(void)
{
processReceive();
processTransmit();
}
/**
* @brief the interrupt handler for the uart interrupt vector
*/
void UART0_intHandler(void)
{
while (UARTCharsAvail(UART0_BASE))
{
uint32_t c = UARTCharGet(UART0_BASE);
/* XXX process error flags for this character ?? */
sReceiveBuffer[sReceiveTailIdx] = (uint8_t)c;
sReceiveTailIdx++;
if (sReceiveTailIdx >= CC1352_RECV_CIRC_BUFF_SIZE)
{
sReceiveTailIdx = 0;
}
}
}
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
/*
* Documented in platform-cc1352.h
*/
void cc1352DebugUartInit(void)
{
uart_power_control(UART1_BASE, true);
/*
* LaunchPad Pin29 = tx, Pin 30 = rxd
*
* The function IOCPinTypeUart() is hard coded to
* only support UART0 - and does not support UART1.
*
* Thus, these pins are configured using a different way.
*/
IOCPortConfigureSet(IOID_0, IOC_PORT_MCU_UART1_TX, IOC_STD_INPUT);
IOCPortConfigureSet(IOID_1, IOC_PORT_MCU_UART1_RX, IOC_STD_INPUT);
UARTConfigSetExpClk(UART1_BASE, SysCtrlClockGet(), 115200,
UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE);
UARTEnable(UART1_BASE);
}
/* This holds the last key pressed */
static int debug_uart_ungetbuf;
/*
* Documented in "src/core/common/debug_uart.h"
*/
int otPlatDebugUart_getc(void)
{
int ch = -1;
if (otPlatDebugUart_kbhit())
{
/* get & clear 0x100 bit used below as flag */
ch = debug_uart_ungetbuf & 0x0ff;
debug_uart_ungetbuf = 0;
}
return ch;
}
/*
* Documented in "src/core/common/debug_uart.h"
*/
int otPlatDebugUart_kbhit(void)
{
int r;
/* if something is in the unget buf... */
r = !!debug_uart_ungetbuf;
if (!r)
{
/*
* Driverlib code returns "-1", or "char" on something
* but it comes with flags in upper bits
*/
r = (int)UARTCharGetNonBlocking(UART1_BASE);
if (r < 0)
{
r = 0; /* no key pressed */
}
else
{
/* key was pressed, mask flags
* and set 0x100 bit, to distinguish
* the value "0x00" from "no-key-pressed"
*/
debug_uart_ungetbuf = ((r & 0x0ff) | 0x0100);
r = 1; /* key pressed */
}
}
return r;
}
/*
* Documented in "src/core/common/debug_uart.h"
*/
void otPlatDebugUart_putchar_raw(int b)
{
UARTCharPut(UART1_BASE, b);
}
#endif /* OPENTHREAD_CONFIG_ENABLE_DEBUG_UART */
+1 -1
View File
@@ -41,10 +41,10 @@ PLATFORM_SOURCES = \
diag.c \
flash.c \
misc.c \
platform.c \
radio.c \
random.c \
startup-gcc.c \
system.c \
logging.c \
uart.c \
$(NULL)
-1
View File
@@ -36,7 +36,6 @@
#include <stdint.h>
#include <openthread/config.h>
#include <openthread/openthread.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
+55
View File
@@ -83,6 +83,7 @@
#define RFCORE_XREG_RXENABLE 0x4008862C // RX enabling
#define RFCORE_XREG_FREQCTRL 0x4008863C // Controls the RF frequency
#define RFCORE_XREG_TXPOWER 0x40088640 // Controls the output power
#define RFCORE_XREG_FSMSTAT0 0x40088648 // Radio finite state machine status
#define RFCORE_XREG_FSMSTAT1 0x4008864C // Radio status register
#define RFCORE_XREG_FIFOPCTRL 0x40088650 // FIFOP threshold
#define RFCORE_XREG_CCACTRL0 0x40088658 // CCA threshold
@@ -105,7 +106,50 @@
#define RFCORE_XREG_RFRND_IRND 0x00000001
#define RFCORE_XREG_FSMSTAT0_STATE_MASK 0x0000003F
#define RFCORE_XREG_FSMSTAT0_CAL_DONE 0x00000080
#define RFCORE_XREG_FSMSTAT0_CAL_RUN 0x00000040
#define RFCORE_XREG_FSMSTAT0_STATE_IDLE 0x00000000
#define RFCORE_XREG_FSMSTAT0_STATE_RX_CAL 0x00000002
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT0 0x00000003
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT1 0x00000004
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT2 0x00000005
#define RFCORE_XREG_FSMSTAT0_STATE_SFD_WAIT3 0x00000006
#define RFCORE_XREG_FSMSTAT0_STATE_RX0 0x00000007
#define RFCORE_XREG_FSMSTAT0_STATE_RX1 0x00000008
#define RFCORE_XREG_FSMSTAT0_STATE_RX2 0x00000009
#define RFCORE_XREG_FSMSTAT0_STATE_RX3 0x0000000A
#define RFCORE_XREG_FSMSTAT0_STATE_RX4 0x0000000B
#define RFCORE_XREG_FSMSTAT0_STATE_RX5 0x0000000C
#define RFCORE_XREG_FSMSTAT0_STATE_RX6 0x0000000D
#define RFCORE_XREG_FSMSTAT0_STATE_RX_WAIT 0x0000000E
#define RFCORE_XREG_FSMSTAT0_STATE_RX_FRST 0x00000010
#define RFCORE_XREG_FSMSTAT0_STATE_RX_OVER 0x00000011
#define RFCORE_XREG_FSMSTAT0_STATE_TX_CAL 0x00000020
#define RFCORE_XREG_FSMSTAT0_STATE_TX0 0x00000022
#define RFCORE_XREG_FSMSTAT0_STATE_TX1 0x00000023
#define RFCORE_XREG_FSMSTAT0_STATE_TX2 0x00000024
#define RFCORE_XREG_FSMSTAT0_STATE_TX3 0x00000025
#define RFCORE_XREG_FSMSTAT0_STATE_TX4 0x00000026
#define RFCORE_XREG_FSMSTAT0_STATE_TX_FINAL 0x00000027
#define RFCORE_XREG_FSMSTAT0_STATE_RXTX_TRANS 0x00000028
#define RFCORE_XREG_FSMSTAT0_STATE_ACK_CAL 0x00000030
#define RFCORE_XREG_FSMSTAT0_STATE_ACK0 0x00000031
#define RFCORE_XREG_FSMSTAT0_STATE_ACK1 0x00000032
#define RFCORE_XREG_FSMSTAT0_STATE_ACK2 0x00000033
#define RFCORE_XREG_FSMSTAT0_STATE_ACK3 0x00000034
#define RFCORE_XREG_FSMSTAT0_STATE_ACK4 0x00000035
#define RFCORE_XREG_FSMSTAT0_STATE_ACK5 0x00000036
#define RFCORE_XREG_FSMSTAT0_STATE_ACK_DELAY 0x00000037
#define RFCORE_XREG_FSMSTAT0_STATE_TX_UNDER 0x00000038
#define RFCORE_XREG_FSMSTAT0_STATE_TX_DOWN0 0x0000001A
#define RFCORE_XREG_FSMSTAT0_STATE_TX_DOWN1 0x0000003A
#define RFCORE_XREG_FSMSTAT1_RX_ACTIVE 0x00000001
#define RFCORE_XREG_FSMSTAT1_TX_ACTIVE 0x00000002
#define RFCORE_XREG_FSMSTAT1_LOCK_STATUS 0x00000004
#define RFCORE_XREG_FSMSTAT1_SAMPLED_CCA 0x00000008
#define RFCORE_XREG_FSMSTAT1_CCA 0x00000010 // Clear channel assessment
#define RFCORE_XREG_FSMSTAT1_SFD 0x00000020
#define RFCORE_XREG_FSMSTAT1_FIFOP 0x00000040
@@ -113,7 +157,13 @@
#define RFCORE_XREG_RSSISTAT_RSSI_VALID 0x00000001 // RSSI value is valid.
#define RFCORE_SFR_RFERRF_NLOCK 0x00000001 // Failed to achieve PLL lock.
#define RFCORE_SFR_RFERRF_RXABO 0x00000002 // RX Aborted.
#define RFCORE_SFR_RFERRF_RXOVERF 0x00000004 // RX FIFO overflowed.
#define RFCORE_SFR_RFERRF_RXUNDERF 0x00000008 // RX FIFO underflowed.
#define RFCORE_SFR_RFERRF_TXOVERF 0x00000010 // TX FIFO overflowed.
#define RFCORE_SFR_RFERRF_TXUNDERF 0x00000020 // TX FIFO underflowed.
#define RFCORE_SFR_RFERRF_STROBEERR 0x00000040 // Command Strobe Error.
#define RFCORE_SFR_RFST_INSTR_RXON 0xE3 // Instruction set RX on
#define RFCORE_SFR_RFST_INSTR_TXON 0xE9 // Instruction set TX on
@@ -172,6 +222,11 @@
#define IOC_OVERRIDE_OE 0x00000008 // PAD Config Override Output Enable
#define IOC_OVERRIDE_DIS 0x00000000 // PAD Config Override Disabled
#define IOC_PAD_IN_SEL_PA0 0x00000000 // PA0
#define IOC_PAD_IN_SEL_PA1 0x00000001 // PA1
#define IOC_PAD_IN_SEL_PA2 0x00000002 // PA2
#define IOC_PAD_IN_SEL_PA3 0x00000003 // PA3
#define UART0_BASE 0x4000C000
#define UART1_BASE 0x4000D000
#define GPIO_A_BASE 0x400D9000 // GPIO
-1
View File
@@ -32,7 +32,6 @@
#include <sys/time.h>
#include <openthread/config.h>
#include <openthread/openthread.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/radio.h>
+1
View File
@@ -34,6 +34,7 @@
#include <openthread-core-config.h>
#include <openthread/config.h>
#include <openthread/platform/logging.h>
#include <openthread/platform/toolchain.h>
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \
(OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL)
-1
View File
@@ -26,7 +26,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <openthread/types.h>
#include <openthread/platform/misc.h>
#include "platform-cc2538.h"
@@ -58,6 +58,14 @@
*/
#define OPENTHREAD_CONFIG_ENABLE_SOFTWARE_RETRANSMIT 1
/**
* @def OPENTHREAD_CONFIG_ENABLE_SOFTWARE_CSMA_BACKOFF
*
* Define to 1 if you want to enable software CSMA-CA backoff logic.
*
*/
#define OPENTHREAD_CONFIG_ENABLE_SOFTWARE_CSMA_BACKOFF 1
/**
* @def OPENTHREAD_CONFIG_ENABLE_SOFTWARE_ENERGY_SCAN
*
+1 -2
View File
@@ -38,8 +38,7 @@
#include <openthread-core-config.h>
#include <stdint.h>
#include <openthread/config.h>
#include <openthread/types.h>
#include <openthread/instance.h>
#include "cc2538-reg.h"
+82 -24
View File
@@ -33,7 +33,6 @@
*/
#include <openthread/config.h>
#include <openthread/openthread.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
#include <openthread/platform/radio.h>
@@ -343,6 +342,30 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
return error;
}
static void setupTransmit(otRadioFrame *aFrame)
{
int i;
// wait for current TX operation to complete, if any.
while (HWREG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE)
;
// flush txfifo
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHTX;
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHTX;
// frame length
HWREG(RFCORE_SFR_RFDATA) = aFrame->mLength;
// frame data
for (i = 0; i < aFrame->mLength; i++)
{
HWREG(RFCORE_SFR_RFDATA) = aFrame->mPsdu[i];
}
setChannel(aFrame->mChannel);
}
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
{
otError error = OT_ERROR_INVALID_STATE;
@@ -356,27 +379,61 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
sState = OT_RADIO_STATE_TRANSMIT;
sTransmitError = OT_ERROR_NONE;
while (HWREG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_TX_ACTIVE)
;
setupTransmit(aFrame);
// flush txfifo
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHTX;
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHTX;
// Set up a counter to inform us if we get stuck.
i = 1000000;
// frame length
HWREG(RFCORE_SFR_RFDATA) = aFrame->mLength;
// frame data
for (i = 0; i < aFrame->mLength; i++)
// Wait for radio to enter receive state.
while ((HWREG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_RX_ACTIVE) == 0)
{
HWREG(RFCORE_SFR_RFDATA) = aFrame->mPsdu[i];
// Count down the cycles, and emit a message if we get to zero.
// Ideally, we should never get there!
if (i)
{
i--;
}
else
{
otLogCritPlat(sInstance, "Radio is stuck!!! FSMSTAT0=0x%08x FSMSTAT1=0x%08x RFERRF=0x%08x",
HWREG(RFCORE_XREG_FSMSTAT0), HWREG(RFCORE_XREG_FSMSTAT1), HWREG(RFCORE_SFR_RFERRF));
i = 1000000;
}
// Ensure we haven't overflowed the RX buffer in the mean time, as this
// will cause a deadlock here otherwise. Similarly, if we see an aborted
// RX, handle that here too to prevent deadlock.
if (HWREG(RFCORE_SFR_RFERRF) & (RFCORE_SFR_RFERRF_RXOVERF | RFCORE_SFR_RFERRF_RXABO))
{
if (HWREG(RFCORE_SFR_RFERRF) & RFCORE_SFR_RFERRF_RXOVERF)
{
otLogCritPlat(sInstance, "RX Buffer Overflow detected", NULL);
}
if (HWREG(RFCORE_SFR_RFERRF) & RFCORE_SFR_RFERRF_RXABO)
{
otLogCritPlat(sInstance, "Aborted RX detected", NULL);
}
// Flush the RX buffer
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHRX;
HWREG(RFCORE_SFR_RFST) = RFCORE_SFR_RFST_INSTR_FLUSHRX;
}
// Check for idle state. After flushing the RX buffer, we may wind up here.
if (!(HWREG(RFCORE_XREG_FSMSTAT1) & (RFCORE_XREG_FSMSTAT1_TX_ACTIVE | RFCORE_XREG_FSMSTAT1_RX_ACTIVE)))
{
otLogCritPlat(sInstance, "Idle state detected", NULL);
// In this case, the state of our driver mis-matches our state. So force
// matters by clearing our channel variable and calling setChannel. This
// should bring our radio into the RX state, which should allow us to go
// into TX.
sChannel = 0;
setupTransmit(aFrame);
}
}
setChannel(aFrame->mChannel);
while ((HWREG(RFCORE_XREG_FSMSTAT1) & 1) == 0)
;
// wait for valid rssi
while ((HWREG(RFCORE_XREG_RSSISTAT) & RFCORE_XREG_RSSISTAT_RSSI_VALID) == 0)
;
@@ -440,7 +497,7 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
}
}
void readFrame(void)
void readFrame(otInstance *aInstance)
{
uint8_t length;
uint8_t crcCorr;
@@ -453,11 +510,12 @@ void readFrame(void)
length = HWREG(RFCORE_SFR_RFDATA);
otEXPECT(IEEE802154_MIN_LENGTH <= length && length <= IEEE802154_MAX_LENGTH);
#if OPENTHREAD_ENABLE_RAW_LINK_API
// Timestamp
sReceiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
if (otPlatRadioGetPromiscuous(aInstance))
{
// Timestamp
sReceiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
sReceiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
}
// read psdu
for (i = 0; i < length - 2; i++)
@@ -496,7 +554,7 @@ exit:
void cc2538RadioProcess(otInstance *aInstance)
{
readFrame();
readFrame(aInstance);
if ((sState == OT_RADIO_STATE_RECEIVE && sReceiveFrame.mLength > 0) ||
(sState == OT_RADIO_STATE_TRANSMIT && sReceiveFrame.mLength > IEEE802154_ACK_LENGTH))
-1
View File
@@ -32,7 +32,6 @@
*
*/
#include <openthread/types.h>
#include <openthread/platform/radio.h>
#include <openthread/platform/random.h>
@@ -36,7 +36,7 @@
otInstance *sInstance;
void PlatformInit(int argc, char *argv[])
void otSysInit(int argc, char *argv[])
{
#if OPENTHREAD_CONFIG_ENABLE_DEBUG_UART
cc2538DebugUartInit();
@@ -49,12 +49,12 @@ void PlatformInit(int argc, char *argv[])
(void)argv;
}
bool PlatformPseudoResetWasRequested(void)
bool otSysPseudoResetWasRequested(void)
{
return false;
}
void PlatformProcessDrivers(otInstance *aInstance)
void otSysProcessDrivers(otInstance *aInstance)
{
sInstance = aInstance;
+4 -5
View File
@@ -39,7 +39,6 @@
#include <stddef.h>
#include <stdio.h>
#include <openthread/types.h>
#include <openthread/platform/debug_uart.h>
#include <openthread/platform/logging.h>
#include <openthread/platform/uart.h>
@@ -114,8 +113,8 @@ otError otPlatUartEnable(void)
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_1;
// rx pin
HWREG(IOC_PA0_SEL) = IOC_UARTRXD_UART0;
HWREG(IOC_PA0_OVER) = IOC_OVERRIDE_DIS;
HWREG(IOC_UARTRXD_UART0) = IOC_PAD_IN_SEL_PA0;
HWREG(IOC_PA0_OVER) = IOC_OVERRIDE_DIS;
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_0;
HWREG(UART0_BASE + UART_O_CTL) = 0;
@@ -288,8 +287,8 @@ void cc2538DebugUartInit(void)
// UART1 - rx pin we don't really use but we setup anyway
// PA2 => is jumper position RF1.16
HWREG(IOC_PA2_SEL) = IOC_UARTRXD_UART1;
HWREG(IOC_PA2_OVER) = IOC_OVERRIDE_DIS;
HWREG(IOC_UARTRXD_UART1) = IOC_PAD_IN_SEL_PA2;
HWREG(IOC_PA2_OVER) = IOC_OVERRIDE_DIS;
HWREG(GPIO_A_BASE + GPIO_O_AFSEL) |= GPIO_PIN_2;
HWREG(UART1_BASE + UART_O_CC) = 0;
+1 -1
View File
@@ -51,9 +51,9 @@ PLATFORM_SOURCES = \
flash.c \
misc.c \
logging.c \
platform.c \
radio.c \
random.c \
system.c \
uart.c \
crypto/sha256_alt.c \
crypto/aes_alt.c \
-1
View File
@@ -29,7 +29,6 @@
#include <driverlib/aon_rtc.h>
#include <stdbool.h>
#include <stdint.h>
#include <openthread/types.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -26,14 +26,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <openthread/config.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <openthread/platform/diag.h>
#if OPENTHREAD_ENABLE_DIAG
#include "platform-cc2650.h"
/**
* Diagnostics mode variables.
*
+2
View File
@@ -28,6 +28,8 @@
#include "platform-cc2650.h"
#include <openthread/error.h>
/**
* @warning this file only implements stubs for the function calls. There is
* not enough space on the cc2650 to support NV as an SoC.
+1
View File
@@ -34,6 +34,7 @@
#include <openthread-core-config.h>
#include <openthread/config.h>
#include <openthread/platform/logging.h>
#include <openthread/platform/toolchain.h>
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED) || \
(OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL)
-2
View File
@@ -27,7 +27,6 @@
*/
#include <driverlib/sys_ctrl.h>
#include <openthread/types.h>
#include <openthread/platform/misc.h>
/**
@@ -55,7 +54,6 @@ otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
return OT_PLAT_RESET_REASON_EXTERNAL;
case RSTSRC_VDDS_LOSS:
case RSTSRC_VDD_LOSS:
case RSTSRC_VDDR_LOSS:
case RSTSRC_CLK_LOSS:
return OT_PLAT_RESET_REASON_CRASH;
+1 -1
View File
@@ -32,7 +32,7 @@
#include <openthread-core-config.h>
#include <stdint.h>
#include <openthread/config.h>
#include "openthread/types.h"
#include <openthread/instance.h>
#ifdef __cplusplus
extern "C" {
+8 -6
View File
@@ -26,12 +26,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <openthread/types.h>
#include <openthread/config.h>
#include "cc2650_radio.h"
#include <assert.h>
#include <utils/code_utils.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
#include <openthread/platform/radio.h>
#include <openthread/platform/random.h> /* to seed the CSMA-CA funciton */
@@ -1823,11 +1824,12 @@ static void cc2650RadioProcessReceiveQueue(otInstance *aInstance)
if (crcCorr->status.bCrcErr == 0 && (len - 2) < OT_RADIO_FRAME_MAX_SIZE)
{
#if OPENTHREAD_ENABLE_RAW_LINK_API
// TODO: Propagate CM0 timestamp
receiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
receiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
#endif
if (otPlatRadioGetPromiscuous(aInstance))
{
// TODO: Propagate CM0 timestamp
receiveFrame.mInfo.mRxInfo.mMsec = otPlatAlarmMilliGetNow();
receiveFrame.mInfo.mRxInfo.mUsec = 0; // Don't support microsecond timer for now.
}
receiveFrame.mLength = len;
receiveFrame.mPsdu = &(payload[1]);
-1
View File
@@ -27,7 +27,6 @@
*/
#include <utils/code_utils.h>
#include <openthread/types.h>
#include <driverlib/prcm.h>
#include <driverlib/trng.h>
@@ -28,7 +28,6 @@
#include "platform-cc2650.h"
#include <stdio.h>
#include <openthread/types.h>
#include "inc/hw_ccfg_simple_struct.h"
extern const ccfg_t __ccfg;
@@ -38,7 +37,7 @@ void *dummy_ccfg_ref = ((void *)(&(__ccfg)));
/**
* Function documented in platform-cc2650.h
*/
void PlatformInit(int argc, char *argv[])
void otSysInit(int argc, char *argv[])
{
(void)argc;
(void)argv;
@@ -57,7 +56,7 @@ void PlatformInit(int argc, char *argv[])
cc2650RadioInit();
}
bool PlatformPseudoResetWasRequested(void)
bool otSysPseudoResetWasRequested(void)
{
return false;
}
@@ -65,7 +64,7 @@ bool PlatformPseudoResetWasRequested(void)
/**
* Function documented in platform-cc2650.h
*/
void PlatformProcessDrivers(otInstance *aInstance)
void otSysProcessDrivers(otInstance *aInstance)
{
// should sleep and wait for interrupts here

Some files were not shown because too many files have changed in this diff Show More