diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index 3710792be47466..a14d3912cef8b2 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -30,8 +30,6 @@ #include -#include - #include #include diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index fc2b7a41acd5d0..706cb5dc9de067 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -301,6 +301,7 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { "cc13x2_26x2/Logging.cpp", "cc13x2_26x2/PlatformManagerImpl.cpp", "cc13x2_26x2/PlatformManagerImpl.h", + "cc13x2_26x2/Random.c", "cc13x2_26x2/SystemPlatformConfig.h", ] diff --git a/src/platform/cc13x2_26x2/Random.c b/src/platform/cc13x2_26x2/Random.c new file mode 100644 index 00000000000000..d1ff1496d34ae5 --- /dev/null +++ b/src/platform/cc13x2_26x2/Random.c @@ -0,0 +1,38 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020 Texas Instruments Incorporated + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +/* Basic implementation of pseudo-random number generation to override the + * default newlib-nano implementation. + */ + +static unsigned long int next = 1; + +/* Return next random integer */ +int rand() +{ + next = next * 1103515245L + 12345; + return (unsigned int) (next / 65536L) % 32768L; +} + +/* Set seed for random generator */ +void srand(unsigned int seed) +{ + next = seed; +} diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni index 7d29bf2ea16160..5f654246df9c9a 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni @@ -309,6 +309,9 @@ template("ti_simplelink_sdk") { # DMM/BLE: "${ti_simplelink_sdk_root}/source", + # Eclipse the SDK config header from DMM + "${chip_root}/src/platform/cc13x2_26x2", + # CHIPoBLE Added include dirs "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/", "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/itm",