Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pw_trace functionality to esp32 all cluster app #11203

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/all-clusters-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ include(third_party/connectedhomeip/third_party/pigweed/repo/pw_build/pigweed.cm
pw_set_backend(pw_log pw_log_basic)
pw_set_backend(pw_assert pw_assert_log)
pw_set_backend(pw_sys_io pw_sys_io.esp32)
pw_set_backend(pw_trace pw_trace_tokenized)

add_subdirectory(third_party/connectedhomeip/third_party/pigweed/repo)
add_subdirectory(third_party/connectedhomeip/third_party/nanopb/repo)
Expand Down
4 changes: 4 additions & 0 deletions examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ target_link_libraries(${COMPONENT_LIB} PUBLIC
pw_hdlc
pw_log
pw_rpc.server
pw_trace_tokenized
pw_trace_tokenized.trace_buffer
pw_trace_tokenized.rpc_service
pw_trace_tokenized.protos.nanopb_rpc
)

set_property(TARGET ${chip_lib} APPEND PROPERTY LINK_LIBRARIES ${COMPONENT_LIB})
Expand Down
16 changes: 16 additions & 0 deletions examples/all-clusters-app/esp32/main/Rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,27 @@
#include "pw_containers/flat_map.h"
#include "pw_status/status.h"
#include "pw_status/try.h"
#include "pw_trace_tokenized/trace_rpc_service_nanopb.h"
#include "wifi_service/wifi_service.rpc.pb.h"
#include <pw_trace/trace.h>

#include "WiFiProvisioning.h"

#include "ESP32Utils.h"

static const char * TAG = "RPC";

// Define trace time for pw_trace
PW_TRACE_TIME_TYPE pw_trace_GetTraceTime()
{
return (PW_TRACE_TIME_TYPE) chip::System::SystemClock().GetMonotonicMicroseconds64().count();
}
// Microsecond time source
size_t pw_trace_GetTraceTimeTicksPerSecond()
{
return 1000000;
}

namespace chip {
namespace rpc {
namespace {
Expand Down Expand Up @@ -291,13 +304,16 @@ Esp32Button button_service;
Esp32Device device_service;
Lighting lighting_service;
Wifi wifi_service;
pw::trace::TraceService trace_service;

void RegisterServices(pw::rpc::Server & server)
{
server.RegisterService(button_service);
server.RegisterService(device_service);
server.RegisterService(lighting_service);
server.RegisterService(wifi_service);
server.RegisterService(trace_service);
PW_TRACE_SET_ENABLED(true);
}

void RunRpcService(void *)
Expand Down