Skip to content

Commit 8138897

Browse files
andy31415pull[bot]
authored andcommitted
Pull latest pigweed version. (#20158)
* Pull latest pigweed version. ``` cd third_party/pigweed/repo git fetch https://github.com/google/pigweed.git main git checkout FETCH_HEAD ``` * change std::span/std::as_bytes to pw::span/pw::as_bytes to make pigweed polyfill happy * Switch include: from span to pw_span.h * More replacing of std::span with pw::span * Restyle * Set pw_span_ENABLE_STD_SPAN_POLYFILL to false for anything that sets a sys_io_BACKEND * fix amebad-pigweed builds * Ensure import is done for polyfill settings for Amebad * Fix ESP32 builds with pw_span * Restyle
1 parent 28e80d8 commit 8138897

File tree

27 files changed

+48
-36
lines changed

27 files changed

+48
-36
lines changed

config/ameba/args.gni

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
# Options from standalone-chip.mk that differ from configure defaults. These
1616
# options are used from examples/.
1717

18+
import("//build_overrides/pigweed.gni")
19+
import("$dir_pw_span/polyfill.gni")
20+
1821
chip_device_platform = "ameba"
1922

2023
chip_project_config_include = ""
@@ -35,4 +38,5 @@ custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba"
3538

3639
pw_build_PIP_CONSTRAINTS =
3740
[ "//third_party/connectedhomeip/scripts/constraints.txt" ]
41+
pw_span_ENABLE_STD_SPAN_POLYFILL = false
3842
cpp_standard = "c++17"

config/bouffalolab/bl602/lib/pw_rpc/pw_rpc.gni

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pw_log_BACKEND = "$dir_pw_log_basic"
1919
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"
2020
pw_sys_io_BACKEND =
2121
"${chip_root}/examples/platform/bl602/pw_sys_io:pw_sys_io_bl602"
22+
pw_span_ENABLE_STD_SPAN_POLYFILL = false
2223

2324
pw_build_LINK_DEPS = [
2425
"$dir_pw_assert:impl",

config/efr32/lib/pw_rpc/pw_rpc.gni

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pw_log_BACKEND = "$dir_pw_log_basic"
1919
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"
2020
pw_sys_io_BACKEND =
2121
"${chip_root}/examples/platform/efr32/pw_sys_io:pw_sys_io_efr32"
22+
pw_span_ENABLE_STD_SPAN_POLYFILL = false
2223

2324
pw_build_LINK_DEPS = [
2425
"$dir_pw_assert:impl",

config/esp32/args.gni

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
# Options from standalone-chip.mk that differ from configure defaults. These
1616
# options are used from examples/.
17-
17+
import("//build_overrides/pigweed.gni")
18+
import("$dir_pw_span/polyfill.gni")
1819
chip_device_platform = "esp32"
1920

2021
chip_project_config_include = ""
@@ -38,3 +39,4 @@ custom_toolchain = "//third_party/connectedhomeip/config/esp32/toolchain:esp32"
3839
# whatever pigweed ships with
3940
pw_build_PIP_CONSTRAINTS =
4041
[ "//third_party/connectedhomeip/scripts/constraints.txt" ]
42+
pw_span_ENABLE_STD_SPAN_POLYFILL = false

config/mbed/chip-gn/lib/pw_rpc/pw_rpc.gni

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pw_sys_io_BACKEND =
2121
"${chip_root}/examples/platform/mbed/pw_sys_io:pw_sys_io_mbed"
2222
pw_rpc_system_server_BACKEND =
2323
"${chip_root}/examples/common/pigweed:system_rpc_server"
24+
pw_span_ENABLE_STD_SPAN_POLYFILL = false
2425

2526
pw_build_LINK_DEPS = [
2627
"$dir_pw_assert:impl",

config/qpg/lib/pw_rpc/pw_rpc.gni

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import("//build_overrides/pigweed.gni")
1818
pw_log_BACKEND = "$dir_pw_log_basic"
1919
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"
2020
pw_sys_io_BACKEND = "${chip_root}/examples/platform/qpg/pw_sys_io:pw_sys_io_qpg"
21+
pw_span_ENABLE_STD_SPAN_POLYFILL = false
2122

2223
pw_build_LINK_DEPS = [
2324
"$dir_pw_assert:impl",

examples/chef/linux/with_pw_rpc.gni

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc"
3232
dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo"
3333
pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock"
3434
pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend"
35+
pw_span_ENABLE_STD_SPAN_POLYFILL = false
3536

3637
pw_build_LINK_DEPS = [
3738
"$dir_pw_assert:impl",

examples/common/pigweed/RpcService.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#include "RpcService.h"
2020

21+
#include "pw_span/span.h"
2122
#include <array>
22-
#include <span>
2323
#include <string_view>
2424

2525
#include "pw_hdlc/rpc_channel.h"
@@ -56,7 +56,7 @@ class ChipRpcChannelOutput : public pw::rpc::ChannelOutput
5656
pw::rpc::ChannelOutput(channel_name), mWriter(writer), mAddress(address)
5757
{}
5858

59-
pw::Status Send(std::span<const std::byte> buffer) override
59+
pw::Status Send(pw::span<const std::byte> buffer) override
6060
{
6161
if (buffer.empty())
6262
{
@@ -102,7 +102,7 @@ void Start(void (*RegisterServices)(pw::rpc::Server &), ::chip::rpc::Mutex * uar
102102
{
103103
uart_mutex->Lock();
104104
}
105-
pw::hdlc::WriteUIFrame(1, std::as_bytes(std::span(log)), sysIoWriter);
105+
pw::hdlc::WriteUIFrame(1, pw::as_bytes(pw::span(log)), sysIoWriter);
106106
if (uart_mutex)
107107
{
108108
uart_mutex->Unlock();

examples/common/pigweed/mbed/Rpc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ Thread * Init()
123123

124124
ChipLogProgress(NotSpecified, "RPC service starting...\r\n");
125125

126-
auto error = rpcThread.start(RunRpcService);
126+
long error = rpcThread.start(RunRpcService);
127127
if (error != osOK)
128128
{
129-
ChipLogError(NotSpecified, "Run RPC service failed[%d]", error);
129+
ChipLogError(NotSpecified, "Run RPC service failed[%ld]", error);
130130
return NULL;
131131
}
132132

examples/common/pigweed/system_rpc_server.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void Init()
4343
{
4444
// Send log messages to HDLC address 1. This prevents logs from interfering
4545
// with pw_rpc communications.
46-
pw::log_basic::SetOutput([](std::string_view log) { pw::hdlc::WriteUIFrame(1, std::as_bytes(std::span(log)), writer); });
46+
pw::log_basic::SetOutput([](std::string_view log) { pw::hdlc::WriteUIFrame(1, pw::as_bytes(pw::span(log)), writer); });
4747
}
4848

4949
rpc::Server & Server()

examples/lighting-app/linux/with_pw_rpc.gni

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc"
3232
dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo"
3333
pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock"
3434
pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend"
35+
pw_span_ENABLE_STD_SPAN_POLYFILL = false
3536

3637
pw_build_LINK_DEPS = [
3738
"$dir_pw_assert:impl",

examples/platform/ameba/PigweedLogger.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include <pw_hdlc/encoder.h>
2323
#include <pw_stream/sys_io_stream.h>
2424

25+
#include "pw_span/span.h"
2526
#include <assert.h>
26-
#include <span>
2727

2828
namespace PigweedLogger {
2929
namespace {
@@ -41,7 +41,7 @@ bool uartInitialised;
4141

4242
void send()
4343
{
44-
pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter);
44+
pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter);
4545
sWriteBufferPos = 0;
4646
}
4747

examples/platform/ameba/pw_sys_io/sys_io_ameba.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ Status WriteByte(std::byte b)
7272
StatusWithSize WriteLine(const std::string_view & s)
7373
{
7474
size_t chars_written = 0;
75-
StatusWithSize result = WriteBytes(std::as_bytes(std::span(s)));
75+
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));
7676
if (!result.ok())
7777
{
7878
return result;
7979
}
8080
chars_written += result.size();
81-
result = WriteBytes(std::as_bytes(std::span("\r\n", 2)));
81+
result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2)));
8282
chars_written += result.size();
8383

8484
return StatusWithSize(result.status(), chars_written);

examples/platform/bouffalolab/bl602/PigweedLogger.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
#include <pw_stream/sys_io_stream.h>
3232
#include <pw_sys_io_efr32/init.h>
3333

34+
#include "pw_span/span.h"
3435
#include <cassert>
3536
#include <cstdint>
36-
#include <span>
3737
#include <string_view>
3838

3939
namespace PigweedLogger {
@@ -52,7 +52,7 @@ static char sWriteBuffer[kWriteBufferSize];
5252

5353
static void send(void)
5454
{
55-
pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter);
55+
pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter);
5656
sWriteBufferPos = 0;
5757
}
5858

examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ Status WriteByte(std::byte b)
6666
StatusWithSize WriteLine(const std::string_view & s)
6767
{
6868
size_t chars_written = 0;
69-
StatusWithSize result = WriteBytes(std::as_bytes(std::span(s)));
69+
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));
7070
if (!result.ok())
7171
{
7272
return result;
7373
}
7474
chars_written += result.size();
75-
result = WriteBytes(std::as_bytes(std::span("\r\n", 2)));
75+
result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2)));
7676
chars_written += result.size();
7777

7878
return StatusWithSize(result.status(), chars_written);

examples/platform/efr32/PigweedLogger.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
#include <pw_stream/sys_io_stream.h>
3232
#include <pw_sys_io_efr32/init.h>
3333

34+
#include "pw_span/span.h"
3435
#include <cassert>
3536
#include <cstdint>
36-
#include <span>
3737
#include <string_view>
3838

3939
namespace PigweedLogger {
@@ -52,7 +52,7 @@ static char sWriteBuffer[kWriteBufferSize];
5252

5353
static void send(void)
5454
{
55-
pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter);
55+
pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter);
5656
sWriteBufferPos = 0;
5757
}
5858

examples/platform/efr32/pw_sys_io/sys_io_efr32.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ Status WriteByte(std::byte b)
6666
StatusWithSize WriteLine(const std::string_view & s)
6767
{
6868
size_t chars_written = 0;
69-
StatusWithSize result = WriteBytes(std::as_bytes(std::span(s)));
69+
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));
7070
if (!result.ok())
7171
{
7272
return result;
7373
}
7474
chars_written += result.size();
75-
result = WriteBytes(std::as_bytes(std::span("\r\n", 2)));
75+
result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2)));
7676
chars_written += result.size();
7777

7878
return StatusWithSize(result.status(), chars_written);

examples/platform/esp32/PigweedLogger.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bool uartInitialised;
3939

4040
void send()
4141
{
42-
pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter);
42+
pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter);
4343
sWriteBufferPos = 0;
4444
}
4545

examples/platform/esp32/pw_sys_io/sys_io_esp32.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ Status WriteByte(std::byte b)
9595
StatusWithSize WriteLine(const std::string_view & s)
9696
{
9797
size_t chars_written = 0;
98-
StatusWithSize result = WriteBytes(std::as_bytes(std::span(s)));
98+
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));
9999
if (!result.ok())
100100
{
101101
return result;
102102
}
103103
chars_written += result.size();
104-
result = WriteBytes(std::as_bytes(std::span("\r\n", 2)));
104+
result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2)));
105105
chars_written += result.size();
106106

107107
return StatusWithSize(result.status(), chars_written);

examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ Status WriteByte(std::byte b)
6060
StatusWithSize WriteLine(const std::string_view & s)
6161
{
6262
size_t chars_written = 0;
63-
StatusWithSize result = WriteBytes(std::as_bytes(std::span(s)));
63+
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));
6464
if (!result.ok())
6565
{
6666
return result;
6767
}
6868
chars_written += result.size();
6969

7070
// Write trailing newline.
71-
result = WriteBytes(std::as_bytes(std::span("\r\n", 2)));
71+
result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2)));
7272
chars_written += result.size();
7373

7474
return StatusWithSize(result.status(), chars_written);

examples/platform/mbed/util/PigweedLogger.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ char sWriteBuffer[kWriteBufferSize];
4444

4545
void send()
4646
{
47-
pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter);
47+
pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter);
4848
sWriteBufferPos = 0;
4949
}
5050

examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ Status WriteByte(std::byte b)
6161
StatusWithSize WriteLine(const std::string_view & s)
6262
{
6363
size_t chars_written = 0;
64-
StatusWithSize result = WriteBytes(std::as_bytes(std::span(s)));
64+
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));
6565
if (!result.ok())
6666
{
6767
return result;
6868
}
6969
chars_written += result.size();
7070

7171
// Write trailing newline.
72-
result = WriteBytes(std::as_bytes(std::span("\r\n", 2)));
72+
result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2)));
7373
chars_written += result.size();
7474

7575
return StatusWithSize(result.status(), chars_written);

examples/platform/nrfconnect/util/PigweedLogger.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
#include <pw_stream/sys_io_stream.h>
3535
#include <pw_sys_io_nrfconnect/init.h>
3636

37+
#include "pw_span/span.h"
3738
#include <cassert>
3839
#include <cstdint>
39-
#include <span>
4040
#include <string_view>
4141

4242
namespace PigweedLogger {
@@ -61,7 +61,7 @@ bool sIsPanicMode;
6161

6262
void flush()
6363
{
64-
pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter);
64+
pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter);
6565
sWriteBufferPos = 0;
6666
}
6767

examples/platform/qpg/PigweedLogger.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
#include <pw_stream/sys_io_stream.h>
3333
#include <pw_sys_io_qpg/init.h>
3434

35+
#include "pw_span/span.h"
3536
#include <cassert>
3637
#include <cstdint>
37-
#include <span>
3838
#include <string_view>
3939

4040
namespace PigweedLogger {
@@ -54,7 +54,7 @@ static char sWriteBuffer[kWriteBufferSize];
5454

5555
static void send(void)
5656
{
57-
pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter);
57+
pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter);
5858
sWriteBufferPos = 0;
5959
}
6060

examples/platform/qpg/pw_sys_io/sys_io_qpg.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ Status WriteByte(std::byte b)
6161
StatusWithSize WriteLine(const std::string_view & s)
6262
{
6363
size_t chars_written = 0;
64-
StatusWithSize result = WriteBytes(std::as_bytes(std::span(s)));
64+
StatusWithSize result = WriteBytes(pw::as_bytes(pw::span(s)));
6565
if (!result.ok())
6666
{
6767
return result;
6868
}
6969
chars_written += result.size();
70-
result = WriteBytes(std::as_bytes(std::span("\r\n", 2)));
70+
result = WriteBytes(pw::as_bytes(pw::span("\r\n", 2)));
7171
chars_written += result.size();
7272

7373
return StatusWithSize(result.status(), chars_written);

src/platform/bouffalolab/BL602/KeyValueStoreManagerImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key)
111111
// size_t offset_bytes) const
112112
// {
113113
// assert(CHIP_KVS_AVAILABLE);
114-
// auto status_and_size = mKvs.Get(key, std::span<std::byte>(reinterpret_cast<std::byte *>(value), value_size), offset_bytes);
114+
// auto status_and_size = mKvs.Get(key, pw::span<std::byte>(reinterpret_cast<std::byte *>(value), value_size), offset_bytes);
115115
// if (read_bytes_size)
116116
// {
117117
// *read_bytes_size = status_and_size.size();
@@ -139,7 +139,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key)
139139
// CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, size_t value_size)
140140
// {
141141
// assert(CHIP_KVS_AVAILABLE);
142-
// auto status = mKvs.Put(key, std::span<const std::byte>(reinterpret_cast<const std::byte *>(value), value_size));
142+
// auto status = mKvs.Put(key, pw::span<const std::byte>(reinterpret_cast<const std::byte *>(value), value_size));
143143
// switch (status.code())
144144
// {
145145
// case pw::OkStatus().code():

third_party/pigweed/repo

Submodule repo updated 425 files

0 commit comments

Comments
 (0)