From 3077293c8a725f558c69276426d4ccb4f5df09b2 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 24 Apr 2023 16:13:45 -0400 Subject: [PATCH] Bump third_party/pigweed/repo from `73cac22` to `b88cd71` (#26133) * Pin new pigweed branch * Fix issues caught in CI * Fix CI * Clean up * Fix QPG plaform CI issues * Fix CI issues for Ameba * Fix Ameba CI for real this time * Restyle * Fix k32w0 and mw320 CI * Restyle * CI fixes for TI platform stuff * Fixes CI for Infineon * Fix/efr32 ci with pw roll up (#113) * add syscall_stubs to efr32 test driver to support gcc 12 * fix release pw rpc build, and test driver * Fix CI for Infineon cyw30739 * Roll to latest pigweed commit * Clean up for review * Fix CI * Restyle * Fix CI --------- Co-authored-by: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> --- examples/all-clusters-app/nxp/mw320/BUILD.gn | 7 +- .../nxp/k32w/k32w0/BUILD.gn | 1 + examples/lighting-app/nxp/k32w/k32w0/BUILD.gn | 1 + examples/lock-app/nxp/k32w/k32w0/BUILD.gn | 1 + examples/platform/linux/system_rpc_server.cc | 11 +- examples/platform/nxp/mw320/BUILD.gn | 27 --- examples/platform/silabs/efr32/BUILD.gn | 4 +- examples/shell/nxp/k32w/k32w0/BUILD.gn | 1 + .../Ameba/DiagnosticDataProviderImpl.cpp | 87 ++++--- src/platform/BUILD.gn | 4 + src/platform/SyscallStubs.cpp | 221 ++++++++++++++++++ src/platform/cc32xx/CC32XXConfig.cpp | 2 +- src/test_driver/efr32/BUILD.gn | 6 +- third_party/infineon/cyw30739_sdk/BUILD.gn | 5 + third_party/infineon/psoc6/BUILD.gn | 10 + third_party/infineon/psoc6/syscalls_stubs.cpp | 221 ++++++++++++++++++ third_party/nlfaultinjection/BUILD.gn | 8 + third_party/nxp/k32w0_sdk/k32w0_sdk.gni | 10 +- third_party/pigweed/repo | 2 +- third_party/qpg_sdk/BUILD.gn | 1 + third_party/silabs/efr32_sdk.gni | 6 +- third_party/ti_simplelink_sdk/BUILD.gn | 8 + .../ti_simplelink_sdk/syscalls_stubs.cpp | 221 ++++++++++++++++++ 23 files changed, 779 insertions(+), 86 deletions(-) delete mode 100644 examples/platform/nxp/mw320/BUILD.gn create mode 100644 src/platform/SyscallStubs.cpp create mode 100644 third_party/infineon/psoc6/syscalls_stubs.cpp create mode 100644 third_party/ti_simplelink_sdk/syscalls_stubs.cpp diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index 84d41622d7d8f1..0884310a04d18a 100644 --- a/examples/all-clusters-app/nxp/mw320/BUILD.gn +++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn @@ -63,6 +63,8 @@ mw320_executable("shell_mw320") { "${chip_root}/src/setup_payload", ] + deps = [ "${chip_root}/src/platform:syscalls_stub" ] + include_dirs = [ "${chip_root}/src/platform/nxp/mw320", "${examples_plat_dir}/app/project_include", @@ -84,7 +86,10 @@ mw320_executable("shell_mw320") { ldscript = "${examples_plat_dir}/app/ldscripts/88MW320_xx_xxxx_flash.ld" - ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] + ldflags = [ + "-T" + rebase_path(ldscript, root_build_dir), + "-Wl,--no-warn-rwx-segment", + ] defines = [ "MW320_SHELL_STREAMER", "SHELL_STREAMER_APP_SPECIFIC", diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn index bfc232e963525a..0087777552cdce 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn @@ -108,6 +108,7 @@ k32w0_executable("contact_sensor_app") { "${chip_root}/examples/contact-sensor-app/contact-sensor-common", "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/lib", + "${chip_root}/src/platform:syscalls_stub", "${chip_root}/third_party/mbedtls:mbedtls", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", ] diff --git a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn index 5daf13dfc7110c..3ccf6f3df1b282 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn @@ -110,6 +110,7 @@ k32w0_executable("light_app") { "${chip_root}/examples/lighting-app/nxp/zap/", "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/lib", + "${chip_root}/src/platform:syscalls_stub", "${chip_root}/third_party/mbedtls:mbedtls", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", ] diff --git a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn index 2260f4cf1b58fd..70753788008300 100644 --- a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn @@ -109,6 +109,7 @@ k32w0_executable("lock_app") { "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/crypto", "${chip_root}/src/lib", + "${chip_root}/src/platform:syscalls_stub", "${chip_root}/third_party/mbedtls:mbedtls", "${chip_root}/third_party/simw-top-mini:se05x", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", diff --git a/examples/platform/linux/system_rpc_server.cc b/examples/platform/linux/system_rpc_server.cc index dee4bb6d7d957e..ff8e52ec94d65e 100644 --- a/examples/platform/linux/system_rpc_server.cc +++ b/examples/platform/linux/system_rpc_server.cc @@ -37,6 +37,7 @@ namespace { constexpr size_t kMaxTransmissionUnit = 512; uint16_t socket_port = 33000; +stream::ServerSocket server_socket; stream::SocketStream socket_stream; hdlc::RpcChannelOutput hdlc_channel_output(socket_stream, hdlc::kDefaultRpcAddress, "HDLC channel"); @@ -63,7 +64,10 @@ void Init() }); PW_LOG_INFO("Starting pw_rpc server on port %d", socket_port); - PW_CHECK_OK(socket_stream.Serve(socket_port)); + PW_CHECK_OK(server_socket.Listen(socket_port)); + auto accept_result = server_socket.Accept(); + PW_CHECK_OK(accept_result.status()); + socket_stream = *std::move(accept_result); } rpc::Server & Server() @@ -88,7 +92,10 @@ Status Start() // An out of range status indicates the remote end has disconnected. // Start to serve the connection again, which will allow another // remote to connect. - PW_CHECK_OK(socket_stream.Serve(socket_port)); + PW_CHECK_OK(server_socket.Listen(socket_port)); + auto accept_result = server_socket.Accept(); + PW_CHECK_OK(accept_result.status()); + socket_stream = *std::move(accept_result); } continue; } diff --git a/examples/platform/nxp/mw320/BUILD.gn b/examples/platform/nxp/mw320/BUILD.gn deleted file mode 100644 index 2cfcbd4dcced8a..00000000000000 --- a/examples/platform/nxp/mw320/BUILD.gn +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# 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. - -import("//build_overrides/chip.gni") -import("//build_overrides/mw320_sdk.gni") - -import("${mw320_sdk_build_root}/mw320_sdk.gni") - -config("chip_examples_project_config") { - include_dirs = [ "app/project_include" ] -} - -source_set("config_mw320_chip_examples") { - # sources = [ "app/project_include/CHIPProjectConfig.h" ] - public_configs = [ ":chip_examples_project_config" ] -} diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index fd33406f6911b1..48fb282c8fbb5f 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -228,9 +228,7 @@ config("efr32-common-config") { defines += [ "HEAP_MONITORING" ] } - # Do not warn for LOAD segment with RWX permissions - # Uncomment this cflag when pigweed update is done and GCC 12.2 is used. - #ldflags = [ "-Wl,--no-warn-rwx-segment" ] + ldflags = [ "-Wl,--no-warn-rwx-segment" ] } config("silabs-wifi-config") { diff --git a/examples/shell/nxp/k32w/k32w0/BUILD.gn b/examples/shell/nxp/k32w/k32w0/BUILD.gn index 19e52dcd502c7b..8b062831685aea 100644 --- a/examples/shell/nxp/k32w/k32w0/BUILD.gn +++ b/examples/shell/nxp/k32w/k32w0/BUILD.gn @@ -67,6 +67,7 @@ k32w0_executable("shell_app") { "${chip_root}/examples/common/QRCode", "${chip_root}/examples/lock-app/lock-common", "${chip_root}/examples/shell/shell_common:shell_common", + "${chip_root}/src/platform:syscalls_stub", "${chip_root}/third_party/mbedtls:mbedtls", "${chip_root}/third_party/simw-top-mini:se05x", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", diff --git a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp index ad6ae4e31ec4f8..b9f2f018e6987d 100644 --- a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp @@ -186,56 +186,49 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** NetworkInterface * head = NULL; struct ifaddrs * ifaddr = nullptr; - if (xnetif == NULL) + // xnetif is never null, no need to check. If we do check with -Werror=address, we get compiler error. + for (struct netif * ifa = xnetif; ifa != NULL; ifa = ifa->next) { - ChipLogError(DeviceLayer, "Failed to get network interfaces"); - } - else - { - for (struct netif * ifa = xnetif; ifa != NULL; ifa = ifa->next) + NetworkInterface * ifp = new NetworkInterface(); + + Platform::CopyString(ifp->Name, ifa->name); + + ifp->name = CharSpan::fromCharString(ifp->Name); + ifp->isOperational = true; + if ((ifa->flags) & NETIF_FLAG_ETHERNET) + ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET; + else + ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI; + ifp->offPremiseServicesReachableIPv4.SetNull(); + ifp->offPremiseServicesReachableIPv6.SetNull(); + + memcpy(ifp->MacAddress, ifa->hwaddr, sizeof(ifa->hwaddr)); + + if (0) { - NetworkInterface * ifp = new NetworkInterface(); - - Platform::CopyString(ifp->Name, ifa->name); - - ifp->name = CharSpan::fromCharString(ifp->Name); - ifp->isOperational = true; - if ((ifa->flags) & NETIF_FLAG_ETHERNET) - ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_ETHERNET; - else - ifp->type = EMBER_ZCL_INTERFACE_TYPE_ENUM_WI_FI; - ifp->offPremiseServicesReachableIPv4.SetNull(); - ifp->offPremiseServicesReachableIPv6.SetNull(); - - memcpy(ifp->MacAddress, ifa->hwaddr, sizeof(ifa->hwaddr)); - - if (0) - { - ChipLogError(DeviceLayer, "Failed to get network hardware address"); - } - else - { - // Set 48-bit IEEE MAC Address - ifp->hardwareAddress = ByteSpan(ifp->MacAddress, 6); - } - - if (ifa->ip_addr.u_addr.ip4.addr != 0) - { - memcpy(ifp->Ipv4AddressesBuffer[0], &(ifa->ip_addr.u_addr.ip4.addr), kMaxIPv4AddrSize); - ifp->Ipv4AddressSpans[0] = ByteSpan(ifp->Ipv4AddressesBuffer[0], kMaxIPv4AddrSize); - ifp->IPv4Addresses = chip::app::DataModel::List(ifp->Ipv4AddressSpans, 1); - } - - if (ifa->ip6_addr->u_addr.ip6.addr != 0) - { - memcpy(ifp->Ipv6AddressesBuffer[0], &(ifa->ip6_addr->u_addr.ip6.addr), kMaxIPv6AddrSize); - ifp->Ipv6AddressSpans[0] = ByteSpan(ifp->Ipv6AddressesBuffer[0], kMaxIPv6AddrSize); - ifp->IPv6Addresses = chip::app::DataModel::List(ifp->Ipv6AddressSpans, 1); - } - - ifp->Next = head; - head = ifp; + ChipLogError(DeviceLayer, "Failed to get network hardware address"); } + else + { + // Set 48-bit IEEE MAC Address + ifp->hardwareAddress = ByteSpan(ifp->MacAddress, 6); + } + + if (ifa->ip_addr.u_addr.ip4.addr != 0) + { + memcpy(ifp->Ipv4AddressesBuffer[0], &(ifa->ip_addr.u_addr.ip4.addr), kMaxIPv4AddrSize); + ifp->Ipv4AddressSpans[0] = ByteSpan(ifp->Ipv4AddressesBuffer[0], kMaxIPv4AddrSize); + ifp->IPv4Addresses = chip::app::DataModel::List(ifp->Ipv4AddressSpans, 1); + } + + // ifa->ip6_addr->u_addr.ip6.addr is never null, no need to check. If we do check with -Werror=address, we get compiler + // error. + memcpy(ifp->Ipv6AddressesBuffer[0], &(ifa->ip6_addr->u_addr.ip6.addr), kMaxIPv6AddrSize); + ifp->Ipv6AddressSpans[0] = ByteSpan(ifp->Ipv6AddressesBuffer[0], kMaxIPv6AddrSize); + ifp->IPv6Addresses = chip::app::DataModel::List(ifp->Ipv6AddressSpans, 1); + + ifp->Next = head; + head = ifp; } *netifpp = head; diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 678cbb8778fc79..b4876e13103364 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -487,3 +487,7 @@ if (chip_device_platform != "none") { public_deps = [ ":platform_buildconfig" ] } } + +source_set("syscalls_stub") { + sources = [ "SyscallStubs.cpp" ] +} diff --git a/src/platform/SyscallStubs.cpp b/src/platform/SyscallStubs.cpp new file mode 100644 index 00000000000000..8ce83ddc3ecbeb --- /dev/null +++ b/src/platform/SyscallStubs.cpp @@ -0,0 +1,221 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ + +/* + This file is only used to implement weak syscall stubs + that gcc-arm-none-eabi 12.2.1 expect to link when using Libc + (newlib/libc_nano) +*/ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int _open(const char * pathname, int flags, int mode); +int _close(int file); +int _fstat(int file, struct stat * st); +int _isatty(int file); +int _lseek(int file, int ptr, int dir); +int _read(int file, char * ptr, int len); +int _write(int file, const char * ptr, int len); + +/************************************************************************** + * @brief + * Open a file. + * + * @param[in] file + * File you want to open. + * + * @return + * Returns -1 since there is not logic here to open file. + **************************************************************************/ +int __attribute__((weak)) _open(const char * pathname, int flags, int mode) +{ + (void) pathname; + (void) flags; + (void) mode; + return -1; +} + +/************************************************************************** + * @brief + * Close a file. + * + * @param[in] file + * File you want to close. + * + * @return + * Returns 0 when the file is closed. + **************************************************************************/ +int __attribute__((weak)) _close(int file) +{ + (void) file; + return 0; +} + +/************************************************************************** + * @brief Exit the program. + * @param[in] status The value to return to the parent process as the + * exit status (not used). + **************************************************************************/ +void __attribute__((weak)) _exit(int status) +{ + (void) status; + while (true) + { + } /* Hang here forever... */ +} + +/************************************************************************* + * @brief + * Status of an open file. + * + * @param[in] file + * Check status for this file. + * + * @param[in] st + * Status information. + * + * @return + * Returns 0 when st_mode is set to character special. + ************************************************************************/ +int __attribute__((weak)) _fstat(int file, struct stat * st) +{ + (void) file; + (void) st; + return 0; +} + +/************************************************************************** + * @brief Get process ID. + *************************************************************************/ +int __attribute__((weak)) _getpid(void) +{ + return 1; +} + +/************************************************************************** + * @brief + * Query whether output stream is a terminal. + * + * @param[in] file + * Descriptor for the file. + * + * @return + * Returns 1 when query is done. + **************************************************************************/ +int __attribute__((weak)) _isatty(int file) +{ + (void) file; + return 1; +} + +/************************************************************************** + * @brief Send signal to process. + * @param[in] pid Process id (not used). + * @param[in] sig Signal to send (not used). + *************************************************************************/ +int __attribute__((weak)) _kill(int pid, int sig) +{ + (void) pid; + (void) sig; + return -1; +} + +/************************************************************************** + * @brief + * Set position in a file. + * + * @param[in] file + * Descriptor for the file. + * + * @param[in] ptr + * Poiter to the argument offset. + * + * @param[in] dir + * Directory whence. + * + * @return + * Returns 0 when position is set. + *************************************************************************/ +int __attribute__((weak)) _lseek(int file, int ptr, int dir) +{ + (void) file; + (void) ptr; + (void) dir; + return 0; +} + +/************************************************************************** + * @brief + * Read from a file. + * + * @param[in] file + * Descriptor for the file you want to read from. + * + * @param[in] ptr + * Pointer to the chacaters that are beeing read. + * + * @param[in] len + * Number of characters to be read. + * + * @return + * Number of characters that have been read. + *************************************************************************/ +int __attribute__((weak)) _read(int file, char * ptr, int len) +{ + (void) file; + (void) ptr; + (void) len; + return 0; +} + +/************************************************************************** + * @brief + * Write to a file. + * + * @param[in] file + * Descriptor for the file you want to write to. + * + * @param[in] ptr + * Pointer to the text you want to write + * + * @param[in] len + * Number of characters to be written. + * + * @return + * Number of characters that have been written. + **************************************************************************/ +int __attribute__((weak)) _write(int file, const char * ptr, int len) +{ + (void) file; + (void) ptr; + + return len; +} + +#ifdef __cplusplus +} +#endif diff --git a/src/platform/cc32xx/CC32XXConfig.cpp b/src/platform/cc32xx/CC32XXConfig.cpp index ad0e52ce5571c0..b6ed391b25fea0 100644 --- a/src/platform/cc32xx/CC32XXConfig.cpp +++ b/src/platform/cc32xx/CC32XXConfig.cpp @@ -282,7 +282,7 @@ class CC32XXKVSList // value is stored in the LL, we do not need the value variable above - delete value; + delete[] value; } } }; diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index 8ffd6d346033c7..08a5e4186903c5 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -72,6 +72,7 @@ silabs_executable("efr32_device_tests") { "${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp", "${examples_common_plat_dir}/PigweedLogger.cpp", "${examples_common_plat_dir}/heap_4_silabs.c", + "${examples_common_plat_dir}/syscalls_stubs.cpp", "${examples_plat_dir}/init_efrPlatform.cpp", "${examples_plat_dir}/uart.cpp", "src/main.cpp", @@ -111,7 +112,10 @@ silabs_executable("efr32_device_tests") { inputs = [ ldscript ] - ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ] + ldflags = [ + "-T" + rebase_path(ldscript, root_build_dir), + "-Wl,--no-warn-rwx-segment", + ] output_dir = root_out_dir } diff --git a/third_party/infineon/cyw30739_sdk/BUILD.gn b/third_party/infineon/cyw30739_sdk/BUILD.gn index 75b9e272840b63..46ca83b4eae8e4 100644 --- a/third_party/infineon/cyw30739_sdk/BUILD.gn +++ b/third_party/infineon/cyw30739_sdk/BUILD.gn @@ -25,8 +25,13 @@ declare_args() { assert(cyw30739_sdk_target != "", "cyw30739_sdk_target must be specified") +config("cyw30739_sdk_no_warn_rwx") { + ldflags = [ "-Wl,--no-warn-rwx-segment" ] +} + group("cyw30739_sdk") { public_deps = [ cyw30739_sdk_target ] + all_dependent_configs = [ ":cyw30739_sdk_no_warn_rwx" ] } config("mbedtls_cyw30739_config") { diff --git a/third_party/infineon/psoc6/BUILD.gn b/third_party/infineon/psoc6/BUILD.gn index ebb79e618655c3..59464a8e2a7cf5 100644 --- a/third_party/infineon/psoc6/BUILD.gn +++ b/third_party/infineon/psoc6/BUILD.gn @@ -67,6 +67,9 @@ config("psoc6_sdk_config") { asmflags = mtb_json.asflags ldflags = filter_exclude(mtb_json.ldflags, [ "-T*" ]) + # TODO, once the issue is properly fixed we should no longer need this warning. + cflags_c += [ "-Wno-error=array-parameter" ] + # Pull out linker flags with paths (-T flags) and make paths absolute # OTA app provides it's own linker script if (!chip_enable_ota_requestor) { @@ -82,6 +85,8 @@ config("psoc6_sdk_config") { } } + ldflags += [ "-Wl,--no-warn-rwx-segment" ] + # --specs=nano.specs is getting added twice and causing compile issues so remove from cxx flags here. cflags_c -= [ "--specs=nano.specs" ] cflags_cc -= [ "--specs=nano.specs" ] @@ -89,7 +94,12 @@ config("psoc6_sdk_config") { ldflags -= [ "--specs=nano.specs" ] } +source_set("syscalls_stub") { + sources = [ "syscalls_stubs.cpp" ] +} + group("psoc6_build") { public_configs = [ ":psoc6_sdk_config" ] public_deps = [ psoc6_target_project ] + deps = [ ":syscalls_stub" ] } diff --git a/third_party/infineon/psoc6/syscalls_stubs.cpp b/third_party/infineon/psoc6/syscalls_stubs.cpp new file mode 100644 index 00000000000000..8ce83ddc3ecbeb --- /dev/null +++ b/third_party/infineon/psoc6/syscalls_stubs.cpp @@ -0,0 +1,221 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ + +/* + This file is only used to implement weak syscall stubs + that gcc-arm-none-eabi 12.2.1 expect to link when using Libc + (newlib/libc_nano) +*/ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int _open(const char * pathname, int flags, int mode); +int _close(int file); +int _fstat(int file, struct stat * st); +int _isatty(int file); +int _lseek(int file, int ptr, int dir); +int _read(int file, char * ptr, int len); +int _write(int file, const char * ptr, int len); + +/************************************************************************** + * @brief + * Open a file. + * + * @param[in] file + * File you want to open. + * + * @return + * Returns -1 since there is not logic here to open file. + **************************************************************************/ +int __attribute__((weak)) _open(const char * pathname, int flags, int mode) +{ + (void) pathname; + (void) flags; + (void) mode; + return -1; +} + +/************************************************************************** + * @brief + * Close a file. + * + * @param[in] file + * File you want to close. + * + * @return + * Returns 0 when the file is closed. + **************************************************************************/ +int __attribute__((weak)) _close(int file) +{ + (void) file; + return 0; +} + +/************************************************************************** + * @brief Exit the program. + * @param[in] status The value to return to the parent process as the + * exit status (not used). + **************************************************************************/ +void __attribute__((weak)) _exit(int status) +{ + (void) status; + while (true) + { + } /* Hang here forever... */ +} + +/************************************************************************* + * @brief + * Status of an open file. + * + * @param[in] file + * Check status for this file. + * + * @param[in] st + * Status information. + * + * @return + * Returns 0 when st_mode is set to character special. + ************************************************************************/ +int __attribute__((weak)) _fstat(int file, struct stat * st) +{ + (void) file; + (void) st; + return 0; +} + +/************************************************************************** + * @brief Get process ID. + *************************************************************************/ +int __attribute__((weak)) _getpid(void) +{ + return 1; +} + +/************************************************************************** + * @brief + * Query whether output stream is a terminal. + * + * @param[in] file + * Descriptor for the file. + * + * @return + * Returns 1 when query is done. + **************************************************************************/ +int __attribute__((weak)) _isatty(int file) +{ + (void) file; + return 1; +} + +/************************************************************************** + * @brief Send signal to process. + * @param[in] pid Process id (not used). + * @param[in] sig Signal to send (not used). + *************************************************************************/ +int __attribute__((weak)) _kill(int pid, int sig) +{ + (void) pid; + (void) sig; + return -1; +} + +/************************************************************************** + * @brief + * Set position in a file. + * + * @param[in] file + * Descriptor for the file. + * + * @param[in] ptr + * Poiter to the argument offset. + * + * @param[in] dir + * Directory whence. + * + * @return + * Returns 0 when position is set. + *************************************************************************/ +int __attribute__((weak)) _lseek(int file, int ptr, int dir) +{ + (void) file; + (void) ptr; + (void) dir; + return 0; +} + +/************************************************************************** + * @brief + * Read from a file. + * + * @param[in] file + * Descriptor for the file you want to read from. + * + * @param[in] ptr + * Pointer to the chacaters that are beeing read. + * + * @param[in] len + * Number of characters to be read. + * + * @return + * Number of characters that have been read. + *************************************************************************/ +int __attribute__((weak)) _read(int file, char * ptr, int len) +{ + (void) file; + (void) ptr; + (void) len; + return 0; +} + +/************************************************************************** + * @brief + * Write to a file. + * + * @param[in] file + * Descriptor for the file you want to write to. + * + * @param[in] ptr + * Pointer to the text you want to write + * + * @param[in] len + * Number of characters to be written. + * + * @return + * Number of characters that have been written. + **************************************************************************/ +int __attribute__((weak)) _write(int file, const char * ptr, int len) +{ + (void) file; + (void) ptr; + + return len; +} + +#ifdef __cplusplus +} +#endif diff --git a/third_party/nlfaultinjection/BUILD.gn b/third_party/nlfaultinjection/BUILD.gn index 02f3a7fba06e16..740ee69c4d6d28 100644 --- a/third_party/nlfaultinjection/BUILD.gn +++ b/third_party/nlfaultinjection/BUILD.gn @@ -18,6 +18,13 @@ config("nlfaultinjection_config") { include_dirs = [ "repo/include" ] } +config("nlfaultinjection_disable_warnings_config") { + cflags = [ + # We are intentionally inducing faults with this library so it makes sense to ignore errors. + "-Wno-error=array-bounds", + ] +} + static_library("nlfaultinjection") { sources = [ "repo/include/nlfaultinjection.hpp", @@ -27,6 +34,7 @@ static_library("nlfaultinjection") { deps = [ "${nlassert_root}:nlassert" ] public_configs = [ ":nlfaultinjection_config" ] + configs += [ ":nlfaultinjection_disable_warnings_config" ] output_name = "libnlfaultinjection" output_dir = "${root_out_dir}/lib" diff --git a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni index c42bfd85baa780..b9900540a79169 100644 --- a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni +++ b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni @@ -455,7 +455,15 @@ template("k32w0_sdk") { "-Wno-parentheses-equality", ] } else { - cflags += [ "-fno-optimize-strlen" ] + cflags += [ + "-fno-optimize-strlen", + + # TODO After upgrading the compiler we started to see new error from address + # warning. To allow PR that rolls up compiler we have suppress this warning + # as an error temporarily. + # see https://github.com/project-chip/connectedhomeip/issues/26221 + "-Wno-error=address", + ] } # Now add our "system-header" include dirs diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 73cac22f49069a..b88cd71d271c41 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 73cac22f49069a18fbec3bb60cb5f762b32ce20b +Subproject commit b88cd71d271c41e34a36dfc1c435e1e6ee3bc72a diff --git a/third_party/qpg_sdk/BUILD.gn b/third_party/qpg_sdk/BUILD.gn index 55e3bb4b5217f6..26cf78cf4e52be 100755 --- a/third_party/qpg_sdk/BUILD.gn +++ b/third_party/qpg_sdk/BUILD.gn @@ -163,6 +163,7 @@ config("qpg_retain_bootloader") { ldflags = [ "-Wl,-u_binary_bl_userlicense_bin_start", "-Wl,-u_binary_bootloader_bin_start", + "-Wl,--no-warn-rwx-segment", ] } diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index baf89660ce836b..97de1caf125afe 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -504,8 +504,10 @@ template("efr32_sdk") { "-Wno-shadow", # see https://github.com/project-chip/connectedhomeip/issues/26058 - # Uncomment this cflag when pigweed update is done and GCC 12.2 is used. - # "-Wno-error=array-parameter", + "-Wno-error=array-parameter", + + # see https://github.com/project-chip/connectedhomeip/issues/26170 + "-Wno-error=array-bounds", ] if (silabs_family == "efr32mg24" || silabs_family == "mgm24") { diff --git a/third_party/ti_simplelink_sdk/BUILD.gn b/third_party/ti_simplelink_sdk/BUILD.gn index 2451ab80e67195..d0b8d79372ea31 100644 --- a/third_party/ti_simplelink_sdk/BUILD.gn +++ b/third_party/ti_simplelink_sdk/BUILD.gn @@ -34,6 +34,10 @@ group("ti_simplelink_sysconfig") { public_deps = [ ti_simplelink_sysconfig_target ] } +source_set("syscalls_stub") { + sources = [ "syscalls_stubs.cpp" ] +} + config("ti_simplelink_mbedtls_config") { if (ti_simplelink_device_family == "cc13x2_26x2" || ti_simplelink_device_family == "cc13x2x7_26x2x7") { @@ -67,6 +71,8 @@ mbedtls_target("mbedtls") { public_configs = [ ":ti_simplelink_mbedtls_config" ] public_deps = [ ti_simplelink_sysconfig_target ] + + deps = [ ":syscalls_stub" ] } config("ti_simplelink_freertos_config") { @@ -108,4 +114,6 @@ freertos_target("freertos") { public_deps = [ "${chip_root}/third_party/ti_simplelink_sdk:ti_simplelink_sysconfig" ] } + + deps = [ ":syscalls_stub" ] } diff --git a/third_party/ti_simplelink_sdk/syscalls_stubs.cpp b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp new file mode 100644 index 00000000000000..8ce83ddc3ecbeb --- /dev/null +++ b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp @@ -0,0 +1,221 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * 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. + */ + +/* + This file is only used to implement weak syscall stubs + that gcc-arm-none-eabi 12.2.1 expect to link when using Libc + (newlib/libc_nano) +*/ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int _open(const char * pathname, int flags, int mode); +int _close(int file); +int _fstat(int file, struct stat * st); +int _isatty(int file); +int _lseek(int file, int ptr, int dir); +int _read(int file, char * ptr, int len); +int _write(int file, const char * ptr, int len); + +/************************************************************************** + * @brief + * Open a file. + * + * @param[in] file + * File you want to open. + * + * @return + * Returns -1 since there is not logic here to open file. + **************************************************************************/ +int __attribute__((weak)) _open(const char * pathname, int flags, int mode) +{ + (void) pathname; + (void) flags; + (void) mode; + return -1; +} + +/************************************************************************** + * @brief + * Close a file. + * + * @param[in] file + * File you want to close. + * + * @return + * Returns 0 when the file is closed. + **************************************************************************/ +int __attribute__((weak)) _close(int file) +{ + (void) file; + return 0; +} + +/************************************************************************** + * @brief Exit the program. + * @param[in] status The value to return to the parent process as the + * exit status (not used). + **************************************************************************/ +void __attribute__((weak)) _exit(int status) +{ + (void) status; + while (true) + { + } /* Hang here forever... */ +} + +/************************************************************************* + * @brief + * Status of an open file. + * + * @param[in] file + * Check status for this file. + * + * @param[in] st + * Status information. + * + * @return + * Returns 0 when st_mode is set to character special. + ************************************************************************/ +int __attribute__((weak)) _fstat(int file, struct stat * st) +{ + (void) file; + (void) st; + return 0; +} + +/************************************************************************** + * @brief Get process ID. + *************************************************************************/ +int __attribute__((weak)) _getpid(void) +{ + return 1; +} + +/************************************************************************** + * @brief + * Query whether output stream is a terminal. + * + * @param[in] file + * Descriptor for the file. + * + * @return + * Returns 1 when query is done. + **************************************************************************/ +int __attribute__((weak)) _isatty(int file) +{ + (void) file; + return 1; +} + +/************************************************************************** + * @brief Send signal to process. + * @param[in] pid Process id (not used). + * @param[in] sig Signal to send (not used). + *************************************************************************/ +int __attribute__((weak)) _kill(int pid, int sig) +{ + (void) pid; + (void) sig; + return -1; +} + +/************************************************************************** + * @brief + * Set position in a file. + * + * @param[in] file + * Descriptor for the file. + * + * @param[in] ptr + * Poiter to the argument offset. + * + * @param[in] dir + * Directory whence. + * + * @return + * Returns 0 when position is set. + *************************************************************************/ +int __attribute__((weak)) _lseek(int file, int ptr, int dir) +{ + (void) file; + (void) ptr; + (void) dir; + return 0; +} + +/************************************************************************** + * @brief + * Read from a file. + * + * @param[in] file + * Descriptor for the file you want to read from. + * + * @param[in] ptr + * Pointer to the chacaters that are beeing read. + * + * @param[in] len + * Number of characters to be read. + * + * @return + * Number of characters that have been read. + *************************************************************************/ +int __attribute__((weak)) _read(int file, char * ptr, int len) +{ + (void) file; + (void) ptr; + (void) len; + return 0; +} + +/************************************************************************** + * @brief + * Write to a file. + * + * @param[in] file + * Descriptor for the file you want to write to. + * + * @param[in] ptr + * Pointer to the text you want to write + * + * @param[in] len + * Number of characters to be written. + * + * @return + * Number of characters that have been written. + **************************************************************************/ +int __attribute__((weak)) _write(int file, const char * ptr, int len) +{ + (void) file; + (void) ptr; + + return len; +} + +#ifdef __cplusplus +} +#endif