diff --git a/config/ameba/args.gni b/config/ameba/args.gni index 57c21e2d02e8c2..d09b1f5cba9843 100755 --- a/config/ameba/args.gni +++ b/config/ameba/args.gni @@ -15,6 +15,9 @@ # Options from standalone-chip.mk that differ from configure defaults. These # options are used from examples/. +import("//build_overrides/pigweed.gni") +import("$dir_pw_span/polyfill.gni") + chip_device_platform = "ameba" chip_project_config_include = "" @@ -35,4 +38,5 @@ custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba" pw_build_PIP_CONSTRAINTS = [ "//third_party/connectedhomeip/scripts/constraints.txt" ] +pw_span_ENABLE_STD_SPAN_POLYFILL = false cpp_standard = "c++17" diff --git a/config/bouffalolab/bl602/lib/pw_rpc/pw_rpc.gni b/config/bouffalolab/bl602/lib/pw_rpc/pw_rpc.gni index 69bd1634363ebc..172d2f366d3212 100644 --- a/config/bouffalolab/bl602/lib/pw_rpc/pw_rpc.gni +++ b/config/bouffalolab/bl602/lib/pw_rpc/pw_rpc.gni @@ -19,6 +19,7 @@ pw_log_BACKEND = "$dir_pw_log_basic" pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" pw_sys_io_BACKEND = "${chip_root}/examples/platform/bl602/pw_sys_io:pw_sys_io_bl602" +pw_span_ENABLE_STD_SPAN_POLYFILL = false pw_build_LINK_DEPS = [ "$dir_pw_assert:impl", diff --git a/config/efr32/lib/pw_rpc/pw_rpc.gni b/config/efr32/lib/pw_rpc/pw_rpc.gni index 68f1c6154f4a91..2c8aaf4d14fba1 100644 --- a/config/efr32/lib/pw_rpc/pw_rpc.gni +++ b/config/efr32/lib/pw_rpc/pw_rpc.gni @@ -19,6 +19,7 @@ pw_log_BACKEND = "$dir_pw_log_basic" pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" pw_sys_io_BACKEND = "${chip_root}/examples/platform/efr32/pw_sys_io:pw_sys_io_efr32" +pw_span_ENABLE_STD_SPAN_POLYFILL = false pw_build_LINK_DEPS = [ "$dir_pw_assert:impl", diff --git a/config/esp32/args.gni b/config/esp32/args.gni index 01308ef61f809c..1f6a6bf0987103 100644 --- a/config/esp32/args.gni +++ b/config/esp32/args.gni @@ -14,7 +14,8 @@ # Options from standalone-chip.mk that differ from configure defaults. These # options are used from examples/. - +import("//build_overrides/pigweed.gni") +import("$dir_pw_span/polyfill.gni") chip_device_platform = "esp32" chip_project_config_include = "" @@ -38,3 +39,4 @@ custom_toolchain = "//third_party/connectedhomeip/config/esp32/toolchain:esp32" # whatever pigweed ships with pw_build_PIP_CONSTRAINTS = [ "//third_party/connectedhomeip/scripts/constraints.txt" ] +pw_span_ENABLE_STD_SPAN_POLYFILL = false diff --git a/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni b/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni index 2b03f6b4c9958c..b2033e5280c539 100644 --- a/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni +++ b/config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni @@ -21,6 +21,7 @@ pw_sys_io_BACKEND = "${chip_root}/examples/platform/mbed/pw_sys_io:pw_sys_io_mbed" pw_rpc_system_server_BACKEND = "${chip_root}/examples/common/pigweed:system_rpc_server" +pw_span_ENABLE_STD_SPAN_POLYFILL = false pw_build_LINK_DEPS = [ "$dir_pw_assert:impl", diff --git a/config/qpg/lib/pw_rpc/pw_rpc.gni b/config/qpg/lib/pw_rpc/pw_rpc.gni index 60fb93e6b8fc44..4100605a1445b1 100644 --- a/config/qpg/lib/pw_rpc/pw_rpc.gni +++ b/config/qpg/lib/pw_rpc/pw_rpc.gni @@ -18,6 +18,7 @@ import("//build_overrides/pigweed.gni") pw_log_BACKEND = "$dir_pw_log_basic" pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" pw_sys_io_BACKEND = "${chip_root}/examples/platform/qpg/pw_sys_io:pw_sys_io_qpg" +pw_span_ENABLE_STD_SPAN_POLYFILL = false pw_build_LINK_DEPS = [ "$dir_pw_assert:impl", diff --git a/examples/chef/linux/with_pw_rpc.gni b/examples/chef/linux/with_pw_rpc.gni index 416733753a8909..756a93469bf072 100644 --- a/examples/chef/linux/with_pw_rpc.gni +++ b/examples/chef/linux/with_pw_rpc.gni @@ -32,6 +32,7 @@ pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock" pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend" +pw_span_ENABLE_STD_SPAN_POLYFILL = false pw_build_LINK_DEPS = [ "$dir_pw_assert:impl", diff --git a/examples/common/pigweed/RpcService.cpp b/examples/common/pigweed/RpcService.cpp index 9616b61b49e4be..a60827236f6299 100644 --- a/examples/common/pigweed/RpcService.cpp +++ b/examples/common/pigweed/RpcService.cpp @@ -18,8 +18,8 @@ #include "RpcService.h" +#include "pw_span/span.h" #include -#include #include #include "pw_hdlc/rpc_channel.h" @@ -56,7 +56,7 @@ class ChipRpcChannelOutput : public pw::rpc::ChannelOutput pw::rpc::ChannelOutput(channel_name), mWriter(writer), mAddress(address) {} - pw::Status Send(std::span buffer) override + pw::Status Send(pw::span buffer) override { if (buffer.empty()) { @@ -102,7 +102,7 @@ void Start(void (*RegisterServices)(pw::rpc::Server &), ::chip::rpc::Mutex * uar { uart_mutex->Lock(); } - pw::hdlc::WriteUIFrame(1, std::as_bytes(std::span(log)), sysIoWriter); + pw::hdlc::WriteUIFrame(1, pw::as_bytes(pw::span(log)), sysIoWriter); if (uart_mutex) { uart_mutex->Unlock(); diff --git a/examples/common/pigweed/mbed/Rpc.cpp b/examples/common/pigweed/mbed/Rpc.cpp index e16c3afc816673..65e9d48824160a 100644 --- a/examples/common/pigweed/mbed/Rpc.cpp +++ b/examples/common/pigweed/mbed/Rpc.cpp @@ -123,10 +123,10 @@ Thread * Init() ChipLogProgress(NotSpecified, "RPC service starting...\r\n"); - auto error = rpcThread.start(RunRpcService); + long error = rpcThread.start(RunRpcService); if (error != osOK) { - ChipLogError(NotSpecified, "Run RPC service failed[%d]", error); + ChipLogError(NotSpecified, "Run RPC service failed[%ld]", error); return NULL; } diff --git a/examples/common/pigweed/system_rpc_server.cc b/examples/common/pigweed/system_rpc_server.cc index 6fe87c6e877dea..25097eb16ea124 100644 --- a/examples/common/pigweed/system_rpc_server.cc +++ b/examples/common/pigweed/system_rpc_server.cc @@ -43,7 +43,7 @@ void Init() { // Send log messages to HDLC address 1. This prevents logs from interfering // with pw_rpc communications. - pw::log_basic::SetOutput([](std::string_view log) { pw::hdlc::WriteUIFrame(1, std::as_bytes(std::span(log)), writer); }); + pw::log_basic::SetOutput([](std::string_view log) { pw::hdlc::WriteUIFrame(1, pw::as_bytes(pw::span(log)), writer); }); } rpc::Server & Server() diff --git a/examples/lighting-app/linux/with_pw_rpc.gni b/examples/lighting-app/linux/with_pw_rpc.gni index 416733753a8909..756a93469bf072 100644 --- a/examples/lighting-app/linux/with_pw_rpc.gni +++ b/examples/lighting-app/linux/with_pw_rpc.gni @@ -32,6 +32,7 @@ pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock" pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend" +pw_span_ENABLE_STD_SPAN_POLYFILL = false pw_build_LINK_DEPS = [ "$dir_pw_assert:impl", diff --git a/examples/platform/ameba/PigweedLogger.cpp b/examples/platform/ameba/PigweedLogger.cpp index 625c6c4a901586..5713cec0920354 100644 --- a/examples/platform/ameba/PigweedLogger.cpp +++ b/examples/platform/ameba/PigweedLogger.cpp @@ -22,8 +22,8 @@ #include #include +#include "pw_span/span.h" #include -#include namespace PigweedLogger { namespace { @@ -41,7 +41,7 @@ bool uartInitialised; void send() { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/ameba/pw_sys_io/sys_io_ameba.cc b/examples/platform/ameba/pw_sys_io/sys_io_ameba.cc index a57880bc4780f9..f7b622861bee4f 100644 --- a/examples/platform/ameba/pw_sys_io/sys_io_ameba.cc +++ b/examples/platform/ameba/pw_sys_io/sys_io_ameba.cc @@ -72,13 +72,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/bouffalolab/bl602/PigweedLogger.cpp b/examples/platform/bouffalolab/bl602/PigweedLogger.cpp index 065161021f6b51..5ab24767a47ab2 100644 --- a/examples/platform/bouffalolab/bl602/PigweedLogger.cpp +++ b/examples/platform/bouffalolab/bl602/PigweedLogger.cpp @@ -31,9 +31,9 @@ #include #include +#include "pw_span/span.h" #include #include -#include #include namespace PigweedLogger { @@ -52,7 +52,7 @@ static char sWriteBuffer[kWriteBufferSize]; static void send(void) { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc b/examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc index aff53278e1a2af..4bc7d98f7477c4 100644 --- a/examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc +++ b/examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc @@ -66,13 +66,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/efr32/PigweedLogger.cpp b/examples/platform/efr32/PigweedLogger.cpp index a7d25c6f5157de..de816da1cc6b81 100644 --- a/examples/platform/efr32/PigweedLogger.cpp +++ b/examples/platform/efr32/PigweedLogger.cpp @@ -31,9 +31,9 @@ #include #include +#include "pw_span/span.h" #include #include -#include #include namespace PigweedLogger { @@ -52,7 +52,7 @@ static char sWriteBuffer[kWriteBufferSize]; static void send(void) { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc b/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc index aff53278e1a2af..4bc7d98f7477c4 100644 --- a/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc +++ b/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc @@ -66,13 +66,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/esp32/PigweedLogger.cpp b/examples/platform/esp32/PigweedLogger.cpp index 39851850bfa34c..cc75c60043683d 100644 --- a/examples/platform/esp32/PigweedLogger.cpp +++ b/examples/platform/esp32/PigweedLogger.cpp @@ -39,7 +39,7 @@ bool uartInitialised; void send() { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc b/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc index 84dc2a23ff54a8..c5591a1f129762 100644 --- a/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc +++ b/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc @@ -95,13 +95,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp b/examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp index eb7ebc9b520e61..1a753e8e7a71c3 100644 --- a/examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp +++ b/examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp @@ -60,7 +60,7 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s))); if (!result.ok()) { return result; @@ -68,7 +68,7 @@ StatusWithSize WriteLine(const std::string_view & s) chars_written += result.size(); // Write trailing newline. - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/mbed/util/PigweedLogger.cpp b/examples/platform/mbed/util/PigweedLogger.cpp index 32b033be44e6e6..1fefd2d614afba 100644 --- a/examples/platform/mbed/util/PigweedLogger.cpp +++ b/examples/platform/mbed/util/PigweedLogger.cpp @@ -44,7 +44,7 @@ char sWriteBuffer[kWriteBufferSize]; void send() { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc b/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc index 3781eaa738d45f..f41dce65b59ff7 100644 --- a/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc +++ b/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc @@ -61,7 +61,7 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s))); if (!result.ok()) { return result; @@ -69,7 +69,7 @@ StatusWithSize WriteLine(const std::string_view & s) chars_written += result.size(); // Write trailing newline. - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/nrfconnect/util/PigweedLogger.cpp b/examples/platform/nrfconnect/util/PigweedLogger.cpp index f3d0fa61a18406..0cb97ecb3bb109 100644 --- a/examples/platform/nrfconnect/util/PigweedLogger.cpp +++ b/examples/platform/nrfconnect/util/PigweedLogger.cpp @@ -34,9 +34,9 @@ #include #include +#include "pw_span/span.h" #include #include -#include #include namespace PigweedLogger { @@ -61,7 +61,7 @@ bool sIsPanicMode; void flush() { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/qpg/PigweedLogger.cpp b/examples/platform/qpg/PigweedLogger.cpp index 5b9324ec67b754..d4f46136c5f7a5 100644 --- a/examples/platform/qpg/PigweedLogger.cpp +++ b/examples/platform/qpg/PigweedLogger.cpp @@ -32,9 +32,9 @@ #include #include +#include "pw_span/span.h" #include #include -#include #include namespace PigweedLogger { @@ -54,7 +54,7 @@ static char sWriteBuffer[kWriteBufferSize]; static void send(void) { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/qpg/pw_sys_io/sys_io_qpg.cc b/examples/platform/qpg/pw_sys_io/sys_io_qpg.cc index ce3e424253b24f..e53b9c0091e113 100644 --- a/examples/platform/qpg/pw_sys_io/sys_io_qpg.cc +++ b/examples/platform/qpg/pw_sys_io/sys_io_qpg.cc @@ -61,13 +61,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp b/src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp index d313f426df9948..2efee2c2d4be99 100644 --- a/src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp +++ b/src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp @@ -111,7 +111,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key) // size_t offset_bytes) const // { // assert(CHIP_KVS_AVAILABLE); -// auto status_and_size = mKvs.Get(key, std::span(reinterpret_cast(value), value_size), offset_bytes); +// auto status_and_size = mKvs.Get(key, pw::span(reinterpret_cast(value), value_size), offset_bytes); // if (read_bytes_size) // { // *read_bytes_size = status_and_size.size(); @@ -139,7 +139,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key) // CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, size_t value_size) // { // assert(CHIP_KVS_AVAILABLE); -// auto status = mKvs.Put(key, std::span(reinterpret_cast(value), value_size)); +// auto status = mKvs.Put(key, pw::span(reinterpret_cast(value), value_size)); // switch (status.code()) // { // case pw::OkStatus().code(): diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 7e48ff5ba896ae..07b7abddc3e858 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 7e48ff5ba896ae6f0687612d5ab56eda42433338 +Subproject commit 07b7abddc3e8587018c18883752555c88db7ed3b