From c1223eaac5339d3c137a46b8004bfc309eae60f1 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 17 Apr 2023 18:42:37 +0000 Subject: [PATCH 01/19] Pin new pigweed branch --- third_party/pigweed/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 73cac22f49069a..bd5f22c9a762d5 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 73cac22f49069a18fbec3bb60cb5f762b32ce20b +Subproject commit bd5f22c9a762d508576d6add833628406220efee From 4351e76bfef8e198390dcc31d148efa3cfc8c3da Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Tue, 18 Apr 2023 17:39:48 +0000 Subject: [PATCH 02/19] Fix issues caught in CI --- build/config/compiler/BUILD.gn | 3 +++ examples/platform/linux/system_rpc_server.cc | 11 +++++++++-- examples/platform/silabs/efr32/BUILD.gn | 4 +--- src/platform/cc32xx/CC32XXConfig.cpp | 2 +- third_party/nlfaultinjection/BUILD.gn | 8 ++++++++ third_party/pigweed/repo | 2 +- third_party/qpg_sdk/qpg_sdk.gni | 1 + third_party/silabs/efr32_sdk.gni | 3 +-- 8 files changed, 25 insertions(+), 9 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 577dac76c66642..f70c42fec0fd4e 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -207,6 +207,9 @@ config("disabled_warnings") { "-Wno-cast-function-type", "-Wno-psabi", "-Wno-maybe-uninitialized", + # When upgrading to gcc 12.2 new compiler warnings were encountered, this suppress + # compiler errors to allow gcc rollup, over time these warnings should be addressed. + "-Wno-address", ] } } 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/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index b48f1498469ac0..60508f6abf1107 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/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/third_party/nlfaultinjection/BUILD.gn b/third_party/nlfaultinjection/BUILD.gn index 02f3a7fba06e16..8f671184fdc561 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_config_private") { + cflags = [ + # We are intentionally inducing faults with this librarys so it makes sense to ignore errors. + "-Wno-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_config_private" ] output_name = "libnlfaultinjection" output_dir = "${root_out_dir}/lib" diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index bd5f22c9a762d5..6b169fab4b4e1d 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit bd5f22c9a762d508576d6add833628406220efee +Subproject commit 6b169fab4b4e1d272ed93558ca055f6d28ccbadf diff --git a/third_party/qpg_sdk/qpg_sdk.gni b/third_party/qpg_sdk/qpg_sdk.gni index f9f6ed610b49fc..ea2aef3205208c 100644 --- a/third_party/qpg_sdk/qpg_sdk.gni +++ b/third_party/qpg_sdk/qpg_sdk.gni @@ -102,6 +102,7 @@ template("qpg_sdk") { cflags += [ "-Wno-maybe-uninitialized", "-Wno-shadow", + "-Wno-error=array-parameter", ] # Inherit defines from invoker (i.e. examples app) diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index baf89660ce836b..ab1dd6192937f1 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -504,8 +504,7 @@ 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", ] if (silabs_family == "efr32mg24" || silabs_family == "mgm24") { From 775e0b06881581ef64a0f62d82a412c0bec604a1 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Tue, 18 Apr 2023 17:51:01 +0000 Subject: [PATCH 03/19] Fix CI --- build/config/compiler/BUILD.gn | 1 + third_party/nlfaultinjection/BUILD.gn | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index f70c42fec0fd4e..54d7afc919c00a 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -207,6 +207,7 @@ config("disabled_warnings") { "-Wno-cast-function-type", "-Wno-psabi", "-Wno-maybe-uninitialized", + # When upgrading to gcc 12.2 new compiler warnings were encountered, this suppress # compiler errors to allow gcc rollup, over time these warnings should be addressed. "-Wno-address", diff --git a/third_party/nlfaultinjection/BUILD.gn b/third_party/nlfaultinjection/BUILD.gn index 8f671184fdc561..46dc7a7c8c2994 100644 --- a/third_party/nlfaultinjection/BUILD.gn +++ b/third_party/nlfaultinjection/BUILD.gn @@ -34,7 +34,7 @@ static_library("nlfaultinjection") { deps = [ "${nlassert_root}:nlassert" ] public_configs = [ ":nlfaultinjection_config" ] - configs = [ ":nlfaultinjection_config_private" ] + configs += [ ":nlfaultinjection_config_private" ] output_name = "libnlfaultinjection" output_dir = "${root_out_dir}/lib" From 5a51a61d96cdf21bec3484acf4076cd8039a3969 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Tue, 18 Apr 2023 19:07:37 +0000 Subject: [PATCH 04/19] Clean up --- build/config/compiler/BUILD.gn | 4 ---- third_party/nlfaultinjection/BUILD.gn | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 54d7afc919c00a..577dac76c66642 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -207,10 +207,6 @@ config("disabled_warnings") { "-Wno-cast-function-type", "-Wno-psabi", "-Wno-maybe-uninitialized", - - # When upgrading to gcc 12.2 new compiler warnings were encountered, this suppress - # compiler errors to allow gcc rollup, over time these warnings should be addressed. - "-Wno-address", ] } } diff --git a/third_party/nlfaultinjection/BUILD.gn b/third_party/nlfaultinjection/BUILD.gn index 46dc7a7c8c2994..740ee69c4d6d28 100644 --- a/third_party/nlfaultinjection/BUILD.gn +++ b/third_party/nlfaultinjection/BUILD.gn @@ -18,10 +18,10 @@ config("nlfaultinjection_config") { include_dirs = [ "repo/include" ] } -config("nlfaultinjection_config_private") { +config("nlfaultinjection_disable_warnings_config") { cflags = [ - # We are intentionally inducing faults with this librarys so it makes sense to ignore errors. - "-Wno-array-bounds", + # We are intentionally inducing faults with this library so it makes sense to ignore errors. + "-Wno-error=array-bounds", ] } @@ -34,7 +34,7 @@ static_library("nlfaultinjection") { deps = [ "${nlassert_root}:nlassert" ] public_configs = [ ":nlfaultinjection_config" ] - configs += [ ":nlfaultinjection_config_private" ] + configs += [ ":nlfaultinjection_disable_warnings_config" ] output_name = "libnlfaultinjection" output_dir = "${root_out_dir}/lib" From 62b9293fc96ca5ccbddd99daa058d446ef812ee6 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Tue, 18 Apr 2023 21:07:55 +0000 Subject: [PATCH 05/19] Fix QPG plaform CI issues --- third_party/qpg_sdk/BUILD.gn | 4 ++++ third_party/qpg_sdk/qpg_sdk.gni | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/third_party/qpg_sdk/BUILD.gn b/third_party/qpg_sdk/BUILD.gn index 55e3bb4b5217f6..96e00b7593b26e 100755 --- a/third_party/qpg_sdk/BUILD.gn +++ b/third_party/qpg_sdk/BUILD.gn @@ -160,9 +160,13 @@ qpg_make_build("qpg_bootloader") { ] } config("qpg_retain_bootloader") { + cflags = [ + "-Wno-error=array-parameter", + ] ldflags = [ "-Wl,-u_binary_bl_userlicense_bin_start", "-Wl,-u_binary_bootloader_bin_start", + "-Wl,--no-warn-rwx-segment", ] } diff --git a/third_party/qpg_sdk/qpg_sdk.gni b/third_party/qpg_sdk/qpg_sdk.gni index ea2aef3205208c..f9f6ed610b49fc 100644 --- a/third_party/qpg_sdk/qpg_sdk.gni +++ b/third_party/qpg_sdk/qpg_sdk.gni @@ -102,7 +102,6 @@ template("qpg_sdk") { cflags += [ "-Wno-maybe-uninitialized", "-Wno-shadow", - "-Wno-error=array-parameter", ] # Inherit defines from invoker (i.e. examples app) From 6954e94bb3351e8e96eeff32e0d1de8de7b8c6df Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 19 Apr 2023 16:10:14 +0000 Subject: [PATCH 06/19] Fix CI issues for Ameba --- third_party/qpg_sdk/BUILD.gn | 3 --- 1 file changed, 3 deletions(-) diff --git a/third_party/qpg_sdk/BUILD.gn b/third_party/qpg_sdk/BUILD.gn index 96e00b7593b26e..26cf78cf4e52be 100755 --- a/third_party/qpg_sdk/BUILD.gn +++ b/third_party/qpg_sdk/BUILD.gn @@ -160,9 +160,6 @@ qpg_make_build("qpg_bootloader") { ] } config("qpg_retain_bootloader") { - cflags = [ - "-Wno-error=array-parameter", - ] ldflags = [ "-Wl,-u_binary_bl_userlicense_bin_start", "-Wl,-u_binary_bootloader_bin_start", From 1a331ffd957af7e12253c339a66b110abfcf4585 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 19 Apr 2023 16:20:47 +0000 Subject: [PATCH 07/19] Fix Ameba CI for real this time --- .../Ameba/DiagnosticDataProviderImpl.cpp | 86 +++++++++---------- 1 file changed, 39 insertions(+), 47 deletions(-) diff --git a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp index ad6ae4e31ec4f8..b0377449fdc959 100644 --- a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp @@ -186,56 +186,48 @@ 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; From 5fbd87575113ac6c1b41936ea81d1569bff23022 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 19 Apr 2023 16:24:52 +0000 Subject: [PATCH 08/19] Restyle --- src/platform/Ameba/DiagnosticDataProviderImpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp index b0377449fdc959..b9f2f018e6987d 100644 --- a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp @@ -221,7 +221,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** 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. + // 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); From 7b2ab0ff74b69f195cb5c17a53b26723db3aa46d Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 19 Apr 2023 17:38:32 +0000 Subject: [PATCH 09/19] Fix k32w0 and mw320 CI --- 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 + .../platform/nxp/k32w/k32w0/common/BUILD.gn | 19 ++ .../nxp/k32w/k32w0/common/syscalls_stubs.cpp | 212 ++++++++++++++++++ examples/platform/nxp/mw320/BUILD.gn | 4 + .../platform/nxp/mw320/syscalls_stubs.cpp | 212 ++++++++++++++++++ examples/shell/nxp/k32w/k32w0/BUILD.gn | 1 + third_party/nxp/k32w0_sdk/k32w0_sdk.gni | 7 +- 10 files changed, 463 insertions(+), 2 deletions(-) create mode 100644 examples/platform/nxp/k32w/k32w0/common/BUILD.gn create mode 100644 examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp create mode 100644 examples/platform/nxp/mw320/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..cb03f05d508e03 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 = ["${examples_plat_dir}: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..87bd0e3845fea2 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn @@ -110,6 +110,7 @@ k32w0_executable("contact_sensor_app") { "${chip_root}/src/lib", "${chip_root}/third_party/mbedtls:mbedtls", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", + "${k32w0_platform_dir}/common:syscalls_stub", ] if (chip_openthread_ftd) { diff --git a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn index 5daf13dfc7110c..d74415059453fa 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn @@ -112,6 +112,7 @@ k32w0_executable("light_app") { "${chip_root}/src/lib", "${chip_root}/third_party/mbedtls:mbedtls", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", + "${k32w0_platform_dir}/common:syscalls_stub", ] if (chip_openthread_ftd) { diff --git a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn index 2260f4cf1b58fd..090ea560f3ad3d 100644 --- a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn @@ -112,6 +112,7 @@ k32w0_executable("lock_app") { "${chip_root}/third_party/mbedtls:mbedtls", "${chip_root}/third_party/simw-top-mini:se05x", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", + "${k32w0_platform_dir}/common:syscalls_stub", ] if (chip_openthread_ftd) { diff --git a/examples/platform/nxp/k32w/k32w0/common/BUILD.gn b/examples/platform/nxp/k32w/k32w0/common/BUILD.gn new file mode 100644 index 00000000000000..83a099e4c824f2 --- /dev/null +++ b/examples/platform/nxp/k32w/k32w0/common/BUILD.gn @@ -0,0 +1,19 @@ +# 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. + +import("//build_overrides/chip.gni") + +source_set("syscalls_stub") { + sources = [ "syscalls_stubs.cpp" ] +} diff --git a/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp b/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp new file mode 100644 index 00000000000000..0808ff99cfd744 --- /dev/null +++ b/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp @@ -0,0 +1,212 @@ +/* + * + * 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 +#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); + +int __attribute__((weak)) _open(const char* pathname, int flags, int mode) +{ + (void) pathname; + (void) flags; + (void) mode; + return 0; +} + +/************************************************************************** + * @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 (1) + { + } /* 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 \ No newline at end of file diff --git a/examples/platform/nxp/mw320/BUILD.gn b/examples/platform/nxp/mw320/BUILD.gn index 2cfcbd4dcced8a..6675e44b0fcc86 100644 --- a/examples/platform/nxp/mw320/BUILD.gn +++ b/examples/platform/nxp/mw320/BUILD.gn @@ -25,3 +25,7 @@ source_set("config_mw320_chip_examples") { # sources = [ "app/project_include/CHIPProjectConfig.h" ] public_configs = [ ":chip_examples_project_config" ] } + +source_set("syscalls_stub") { + sources = [ "syscalls_stubs.cpp" ] +} \ No newline at end of file diff --git a/examples/platform/nxp/mw320/syscalls_stubs.cpp b/examples/platform/nxp/mw320/syscalls_stubs.cpp new file mode 100644 index 00000000000000..0808ff99cfd744 --- /dev/null +++ b/examples/platform/nxp/mw320/syscalls_stubs.cpp @@ -0,0 +1,212 @@ +/* + * + * 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 +#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); + +int __attribute__((weak)) _open(const char* pathname, int flags, int mode) +{ + (void) pathname; + (void) flags; + (void) mode; + return 0; +} + +/************************************************************************** + * @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 (1) + { + } /* 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 \ No newline at end of file diff --git a/examples/shell/nxp/k32w/k32w0/BUILD.gn b/examples/shell/nxp/k32w/k32w0/BUILD.gn index 19e52dcd502c7b..e58d8349538ef0 100644 --- a/examples/shell/nxp/k32w/k32w0/BUILD.gn +++ b/examples/shell/nxp/k32w/k32w0/BUILD.gn @@ -70,6 +70,7 @@ k32w0_executable("shell_app") { "${chip_root}/third_party/mbedtls:mbedtls", "${chip_root}/third_party/simw-top-mini:se05x", "${k32w0_platform_dir}/app/support:freertos_mbedtls_utils", + "${k32w0_platform_dir}/common:syscalls_stub", ] cflags = [ "-Wconversion" ] diff --git a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni index c42bfd85baa780..8d6b6bccc9c5f0 100644 --- a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni +++ b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni @@ -455,7 +455,12 @@ template("k32w0_sdk") { "-Wno-parentheses-equality", ] } else { - cflags += [ "-fno-optimize-strlen" ] + cflags += [ + "-fno-optimize-strlen", + + # asdf + "-Wno-error=address", + ] } # Now add our "system-header" include dirs From 818663e12b67570b11332ee8b14ccb9ec54dfc32 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 19 Apr 2023 18:12:58 +0000 Subject: [PATCH 10/19] Restyle --- examples/all-clusters-app/nxp/mw320/BUILD.gn | 4 ++-- examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp | 6 +++--- examples/platform/nxp/mw320/BUILD.gn | 2 +- examples/platform/nxp/mw320/syscalls_stubs.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index cb03f05d508e03..7ece20a15a7085 100644 --- a/examples/all-clusters-app/nxp/mw320/BUILD.gn +++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn @@ -63,7 +63,7 @@ mw320_executable("shell_mw320") { "${chip_root}/src/setup_payload", ] - deps = ["${examples_plat_dir}:syscalls_stub"] + deps = [ "${examples_plat_dir}:syscalls_stub" ] include_dirs = [ "${chip_root}/src/platform/nxp/mw320", @@ -88,7 +88,7 @@ mw320_executable("shell_mw320") { ldflags = [ "-T" + rebase_path(ldscript, root_build_dir), - "-Wl,--no-warn-rwx-segment" + "-Wl,--no-warn-rwx-segment", ] defines = [ "MW320_SHELL_STREAMER", diff --git a/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp b/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp index 0808ff99cfd744..f79d00e7105e7b 100644 --- a/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp +++ b/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp @@ -34,7 +34,7 @@ extern "C" { #endif -int _open(const char* pathname, int flags, int mode); +int _open(const char * pathname, int flags, int mode); int _close(int file); int _fstat(int file, struct stat * st); int _isatty(int file); @@ -42,7 +42,7 @@ 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); -int __attribute__((weak)) _open(const char* pathname, int flags, int mode) +int __attribute__((weak)) _open(const char * pathname, int flags, int mode) { (void) pathname; (void) flags; @@ -209,4 +209,4 @@ int __attribute__((weak)) _write(int file, const char * ptr, int len) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/examples/platform/nxp/mw320/BUILD.gn b/examples/platform/nxp/mw320/BUILD.gn index 6675e44b0fcc86..9528e188fd1001 100644 --- a/examples/platform/nxp/mw320/BUILD.gn +++ b/examples/platform/nxp/mw320/BUILD.gn @@ -28,4 +28,4 @@ source_set("config_mw320_chip_examples") { source_set("syscalls_stub") { sources = [ "syscalls_stubs.cpp" ] -} \ No newline at end of file +} diff --git a/examples/platform/nxp/mw320/syscalls_stubs.cpp b/examples/platform/nxp/mw320/syscalls_stubs.cpp index 0808ff99cfd744..f79d00e7105e7b 100644 --- a/examples/platform/nxp/mw320/syscalls_stubs.cpp +++ b/examples/platform/nxp/mw320/syscalls_stubs.cpp @@ -34,7 +34,7 @@ extern "C" { #endif -int _open(const char* pathname, int flags, int mode); +int _open(const char * pathname, int flags, int mode); int _close(int file); int _fstat(int file, struct stat * st); int _isatty(int file); @@ -42,7 +42,7 @@ 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); -int __attribute__((weak)) _open(const char* pathname, int flags, int mode) +int __attribute__((weak)) _open(const char * pathname, int flags, int mode) { (void) pathname; (void) flags; @@ -209,4 +209,4 @@ int __attribute__((weak)) _write(int file, const char * ptr, int len) #ifdef __cplusplus } -#endif \ No newline at end of file +#endif From c1be0fec1bdf74bb378f35a0c44cfe35d8eba552 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 19 Apr 2023 18:53:33 +0000 Subject: [PATCH 11/19] CI fixes for TI platform stuff --- third_party/ti_simplelink_sdk/BUILD.gn | 8 + .../ti_simplelink_sdk/syscalls_stubs.cpp | 212 ++++++++++++++++++ 2 files changed, 220 insertions(+) create mode 100644 third_party/ti_simplelink_sdk/syscalls_stubs.cpp 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..f79d00e7105e7b --- /dev/null +++ b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp @@ -0,0 +1,212 @@ +/* + * + * 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 +#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); + +int __attribute__((weak)) _open(const char * pathname, int flags, int mode) +{ + (void) pathname; + (void) flags; + (void) mode; + return 0; +} + +/************************************************************************** + * @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 (1) + { + } /* 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 From 02164602d24176d34ec5de3a5d4080c307f75fbb Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 19 Apr 2023 20:51:42 +0000 Subject: [PATCH 12/19] Fixes CI for Infineon --- third_party/infineon/psoc6/BUILD.gn | 10 + third_party/infineon/psoc6/syscalls_stubs.cpp | 212 ++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 third_party/infineon/psoc6/syscalls_stubs.cpp 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..f79d00e7105e7b --- /dev/null +++ b/third_party/infineon/psoc6/syscalls_stubs.cpp @@ -0,0 +1,212 @@ +/* + * + * 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 +#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); + +int __attribute__((weak)) _open(const char * pathname, int flags, int mode) +{ + (void) pathname; + (void) flags; + (void) mode; + return 0; +} + +/************************************************************************** + * @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 (1) + { + } /* 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 From f4e11ac93c101d8b016f50c84466a7c232aa0bc6 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 19 Apr 2023 18:07:43 -0400 Subject: [PATCH 13/19] 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 --- src/test_driver/efr32/BUILD.gn | 6 +++++- third_party/silabs/efr32_sdk.gni | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index e440bb3ac475c2..76251e3d2b931d 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/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index ab1dd6192937f1..97de1caf125afe 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -505,6 +505,9 @@ template("efr32_sdk") { # see https://github.com/project-chip/connectedhomeip/issues/26058 "-Wno-error=array-parameter", + + # see https://github.com/project-chip/connectedhomeip/issues/26170 + "-Wno-error=array-bounds", ] if (silabs_family == "efr32mg24" || silabs_family == "mgm24") { From 10e09fa4e9c9b395f8c8773aa5b7377d9428b876 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 20 Apr 2023 14:25:32 +0000 Subject: [PATCH 14/19] Fix CI for Infineon cyw30739 --- third_party/infineon/cyw30739_sdk/BUILD.gn | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/third_party/infineon/cyw30739_sdk/BUILD.gn b/third_party/infineon/cyw30739_sdk/BUILD.gn index 75b9e272840b63..acf9e1154d78b8 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_special_linker_config") { + ldflags = [ "-Wl,--no-warn-rwx-segment" ] +} + group("cyw30739_sdk") { public_deps = [ cyw30739_sdk_target ] + all_dependent_configs = [ ":cyw30739_sdk_special_linker_config" ] } config("mbedtls_cyw30739_config") { From d3c023bef6376887abca3292633db28c8a203d02 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 24 Apr 2023 12:35:08 +0000 Subject: [PATCH 15/19] Roll to latest pigweed commit --- third_party/pigweed/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 6b169fab4b4e1d..b88cd71d271c41 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 6b169fab4b4e1d272ed93558ca055f6d28ccbadf +Subproject commit b88cd71d271c41e34a36dfc1c435e1e6ee3bc72a From fcbf6f50413764cc6dde7082e96cd62f55f8a95e Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 24 Apr 2023 13:31:27 +0000 Subject: [PATCH 16/19] Clean up for review --- examples/all-clusters-app/nxp/mw320/BUILD.gn | 2 +- .../nxp/k32w/k32w0/BUILD.gn | 2 +- examples/lighting-app/nxp/k32w/k32w0/BUILD.gn | 2 +- examples/lock-app/nxp/k32w/k32w0/BUILD.gn | 2 +- .../platform/nxp/k32w/k32w0/common/BUILD.gn | 19 -- examples/platform/nxp/mw320/BUILD.gn | 31 --- .../platform/nxp/mw320/syscalls_stubs.cpp | 212 ------------------ examples/shell/nxp/k32w/k32w0/BUILD.gn | 2 +- src/platform/BUILD.gn | 4 + .../platform/SyscallStubs.cpp | 12 +- third_party/infineon/cyw30739_sdk/BUILD.gn | 4 +- third_party/infineon/psoc6/syscalls_stubs.cpp | 12 +- third_party/nxp/k32w0_sdk/k32w0_sdk.gni | 5 +- .../ti_simplelink_sdk/syscalls_stubs.cpp | 12 +- 14 files changed, 48 insertions(+), 273 deletions(-) delete mode 100644 examples/platform/nxp/k32w/k32w0/common/BUILD.gn delete mode 100644 examples/platform/nxp/mw320/BUILD.gn delete mode 100644 examples/platform/nxp/mw320/syscalls_stubs.cpp rename examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp => src/platform/SyscallStubs.cpp (94%) diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index 7ece20a15a7085..0884310a04d18a 100644 --- a/examples/all-clusters-app/nxp/mw320/BUILD.gn +++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn @@ -63,7 +63,7 @@ mw320_executable("shell_mw320") { "${chip_root}/src/setup_payload", ] - deps = [ "${examples_plat_dir}:syscalls_stub" ] + deps = [ "${chip_root}/src/platform:syscalls_stub" ] include_dirs = [ "${chip_root}/src/platform/nxp/mw320", diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn index 87bd0e3845fea2..0087777552cdce 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn @@ -108,9 +108,9 @@ 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", - "${k32w0_platform_dir}/common:syscalls_stub", ] if (chip_openthread_ftd) { diff --git a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn index d74415059453fa..3ccf6f3df1b282 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lighting-app/nxp/k32w/k32w0/BUILD.gn @@ -110,9 +110,9 @@ 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", - "${k32w0_platform_dir}/common:syscalls_stub", ] if (chip_openthread_ftd) { diff --git a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn index 090ea560f3ad3d..70753788008300 100644 --- a/examples/lock-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/lock-app/nxp/k32w/k32w0/BUILD.gn @@ -109,10 +109,10 @@ 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", - "${k32w0_platform_dir}/common:syscalls_stub", ] if (chip_openthread_ftd) { diff --git a/examples/platform/nxp/k32w/k32w0/common/BUILD.gn b/examples/platform/nxp/k32w/k32w0/common/BUILD.gn deleted file mode 100644 index 83a099e4c824f2..00000000000000 --- a/examples/platform/nxp/k32w/k32w0/common/BUILD.gn +++ /dev/null @@ -1,19 +0,0 @@ -# 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. - -import("//build_overrides/chip.gni") - -source_set("syscalls_stub") { - sources = [ "syscalls_stubs.cpp" ] -} diff --git a/examples/platform/nxp/mw320/BUILD.gn b/examples/platform/nxp/mw320/BUILD.gn deleted file mode 100644 index 9528e188fd1001..00000000000000 --- a/examples/platform/nxp/mw320/BUILD.gn +++ /dev/null @@ -1,31 +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" ] -} - -source_set("syscalls_stub") { - sources = [ "syscalls_stubs.cpp" ] -} diff --git a/examples/platform/nxp/mw320/syscalls_stubs.cpp b/examples/platform/nxp/mw320/syscalls_stubs.cpp deleted file mode 100644 index f79d00e7105e7b..00000000000000 --- a/examples/platform/nxp/mw320/syscalls_stubs.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * - * 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 -#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); - -int __attribute__((weak)) _open(const char * pathname, int flags, int mode) -{ - (void) pathname; - (void) flags; - (void) mode; - return 0; -} - -/************************************************************************** - * @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 (1) - { - } /* 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/examples/shell/nxp/k32w/k32w0/BUILD.gn b/examples/shell/nxp/k32w/k32w0/BUILD.gn index e58d8349538ef0..8b062831685aea 100644 --- a/examples/shell/nxp/k32w/k32w0/BUILD.gn +++ b/examples/shell/nxp/k32w/k32w0/BUILD.gn @@ -67,10 +67,10 @@ 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", - "${k32w0_platform_dir}/common:syscalls_stub", ] cflags = [ "-Wconversion" ] diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 678cbb8778fc79..9f39a48bcdb784 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"] +} \ No newline at end of file diff --git a/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp b/src/platform/SyscallStubs.cpp similarity index 94% rename from examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp rename to src/platform/SyscallStubs.cpp index f79d00e7105e7b..12ccf8af801158 100644 --- a/examples/platform/nxp/k32w/k32w0/common/syscalls_stubs.cpp +++ b/src/platform/SyscallStubs.cpp @@ -42,12 +42,22 @@ 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 0; + return -1; } /************************************************************************** diff --git a/third_party/infineon/cyw30739_sdk/BUILD.gn b/third_party/infineon/cyw30739_sdk/BUILD.gn index acf9e1154d78b8..46ca83b4eae8e4 100644 --- a/third_party/infineon/cyw30739_sdk/BUILD.gn +++ b/third_party/infineon/cyw30739_sdk/BUILD.gn @@ -25,13 +25,13 @@ declare_args() { assert(cyw30739_sdk_target != "", "cyw30739_sdk_target must be specified") -config("cyw30739_sdk_special_linker_config") { +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_special_linker_config" ] + all_dependent_configs = [ ":cyw30739_sdk_no_warn_rwx" ] } config("mbedtls_cyw30739_config") { diff --git a/third_party/infineon/psoc6/syscalls_stubs.cpp b/third_party/infineon/psoc6/syscalls_stubs.cpp index f79d00e7105e7b..12ccf8af801158 100644 --- a/third_party/infineon/psoc6/syscalls_stubs.cpp +++ b/third_party/infineon/psoc6/syscalls_stubs.cpp @@ -42,12 +42,22 @@ 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 0; + return -1; } /************************************************************************** diff --git a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni index 8d6b6bccc9c5f0..b9900540a79169 100644 --- a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni +++ b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni @@ -458,7 +458,10 @@ template("k32w0_sdk") { cflags += [ "-fno-optimize-strlen", - # asdf + # 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", ] } diff --git a/third_party/ti_simplelink_sdk/syscalls_stubs.cpp b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp index f79d00e7105e7b..12ccf8af801158 100644 --- a/third_party/ti_simplelink_sdk/syscalls_stubs.cpp +++ b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp @@ -42,12 +42,22 @@ 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 0; + return -1; } /************************************************************************** From 747713e617904b18f533f8bd64054b3f679354bf Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 24 Apr 2023 13:43:59 +0000 Subject: [PATCH 17/19] Fix CI --- src/platform/SyscallStubs.cpp | 1 - third_party/infineon/psoc6/syscalls_stubs.cpp | 1 - third_party/ti_simplelink_sdk/syscalls_stubs.cpp | 1 - 3 files changed, 3 deletions(-) diff --git a/src/platform/SyscallStubs.cpp b/src/platform/SyscallStubs.cpp index 12ccf8af801158..644e86f367556d 100644 --- a/src/platform/SyscallStubs.cpp +++ b/src/platform/SyscallStubs.cpp @@ -21,7 +21,6 @@ (newlib/libc_nano) */ -#include #include #include #include diff --git a/third_party/infineon/psoc6/syscalls_stubs.cpp b/third_party/infineon/psoc6/syscalls_stubs.cpp index 12ccf8af801158..644e86f367556d 100644 --- a/third_party/infineon/psoc6/syscalls_stubs.cpp +++ b/third_party/infineon/psoc6/syscalls_stubs.cpp @@ -21,7 +21,6 @@ (newlib/libc_nano) */ -#include #include #include #include diff --git a/third_party/ti_simplelink_sdk/syscalls_stubs.cpp b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp index 12ccf8af801158..644e86f367556d 100644 --- a/third_party/ti_simplelink_sdk/syscalls_stubs.cpp +++ b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp @@ -21,7 +21,6 @@ (newlib/libc_nano) */ -#include #include #include #include From e0bddb90bf56b04ace9b8cc3baeab1852924bc06 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 24 Apr 2023 13:48:45 +0000 Subject: [PATCH 18/19] Restyle --- src/platform/BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 9f39a48bcdb784..b4876e13103364 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -489,5 +489,5 @@ if (chip_device_platform != "none") { } source_set("syscalls_stub") { - sources = ["SyscallStubs.cpp"] -} \ No newline at end of file + sources = [ "SyscallStubs.cpp" ] +} From 6bd98d5d575a192b943c28063f16e2d6b8d2ce39 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Mon, 24 Apr 2023 16:38:47 +0000 Subject: [PATCH 19/19] Fix CI --- src/platform/SyscallStubs.cpp | 2 +- third_party/infineon/psoc6/syscalls_stubs.cpp | 2 +- third_party/ti_simplelink_sdk/syscalls_stubs.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform/SyscallStubs.cpp b/src/platform/SyscallStubs.cpp index 644e86f367556d..8ce83ddc3ecbeb 100644 --- a/src/platform/SyscallStubs.cpp +++ b/src/platform/SyscallStubs.cpp @@ -83,7 +83,7 @@ int __attribute__((weak)) _close(int file) void __attribute__((weak)) _exit(int status) { (void) status; - while (1) + while (true) { } /* Hang here forever... */ } diff --git a/third_party/infineon/psoc6/syscalls_stubs.cpp b/third_party/infineon/psoc6/syscalls_stubs.cpp index 644e86f367556d..8ce83ddc3ecbeb 100644 --- a/third_party/infineon/psoc6/syscalls_stubs.cpp +++ b/third_party/infineon/psoc6/syscalls_stubs.cpp @@ -83,7 +83,7 @@ int __attribute__((weak)) _close(int file) void __attribute__((weak)) _exit(int status) { (void) status; - while (1) + while (true) { } /* Hang here forever... */ } diff --git a/third_party/ti_simplelink_sdk/syscalls_stubs.cpp b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp index 644e86f367556d..8ce83ddc3ecbeb 100644 --- a/third_party/ti_simplelink_sdk/syscalls_stubs.cpp +++ b/third_party/ti_simplelink_sdk/syscalls_stubs.cpp @@ -83,7 +83,7 @@ int __attribute__((weak)) _close(int file) void __attribute__((weak)) _exit(int status) { (void) status; - while (1) + while (true) { } /* Hang here forever... */ }