Update test scripts

Change-Id: I77ff10400cd37ede41db6b3f2de6ae196d994d35
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/zephyr-integration/+/150914
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Yuval Peress <peress@google.com>
diff --git a/.gitignore b/.gitignore
index ada8ad6..b4ca886 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,14 +2,6 @@
 build/
 twister-out*/
 
-# West modules and install directories
-bootloader/
-modules/
-pigweed/
-tools/
-zephyr/
-.west
-
 # IDE specific directories
 .idea/
 
diff --git a/.gitmodules b/.gitmodules
index e69de29..e6ebcb2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -0,0 +1,8 @@
+[submodule "zephyr"]
+	path = zephyr
+	url = git@github.com:zephyrproject-rtos/zephyr.git
+	branch = main
+[submodule "pigweed"]
+	path = pigweed
+	url = https://pigweed.googlesource.com/pigweed/pigweed/
+	branch = main
diff --git a/config/zephyr_integration.json b/config/zephyr_integration.json
index d38bb68..5e57a3a 100644
--- a/config/zephyr_integration.json
+++ b/config/zephyr_integration.json
@@ -27,6 +27,15 @@
       "tags": [
         "version:2@21.7"
       ]
+    },
+    {
+      "path": "infra/3pp/tools/zephyr_sdk/${platform}",
+      "platforms": [
+        "linux-amd64"
+      ],
+      "tags": [
+        "version:2@0.16.1"
+      ]
     }
   ]
 }
diff --git a/manifest/west.yml b/manifest/west.yml
deleted file mode 100644
index d095313..0000000
--- a/manifest/west.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2022 The Pigweed 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
-#
-#     https://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.
-
-manifest:
-  self:
-    path: zephyr-integration
-
-  remotes:
-    - name: zephyrproject-rtos
-      url-base: https://github.com/zephyrproject-rtos
-    - name: pigweed
-      url-base: https://pigweed.googlesource.com/pigweed
-
-  projects:
-    - name: zephyr
-      remote: zephyrproject-rtos
-      revision: main
-      clone-depth: 50
-      import: true
-    - name: pigweed
-      remote: pigweed
-      revision: main
-      clone-depth: 50
diff --git a/pigweed b/pigweed
new file mode 160000
index 0000000..e4754e7
--- /dev/null
+++ b/pigweed
@@ -0,0 +1 @@
+Subproject commit e4754e73b724bcbc82336003a43bdd87f162b8b8
diff --git a/run_tests.sh b/run_tests.sh
new file mode 100755
index 0000000..091b2d5
--- /dev/null
+++ b/run_tests.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+git config --global --add safe.directory '*'
+
+#mkdir -p build_overrides
+#touch build_overrides/pigweed_environment.gni
+
+# Set up Pigweed's environment.
+. ./bootstrap.sh
+pip install -r zephyr/scripts/requirements.txt
+
+# Use python protobuf
+export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
+export PW_ROOT=$(pwd)/pigweed
+
+./zephyr/scripts/twister -v -c -i \
+  -p native_posix \
+  --ninja \
+  -x=ZEPHYR_MODULES=${PW_ROOT} \
+  -x=ZEPHYR_BASE=$(pwd)/zephyr \
+  -T pigweed/
diff --git a/samples/pw_rpc/CMakeLists.txt b/samples/pw_rpc/CMakeLists.txt
deleted file mode 100644
index 184248f..0000000
--- a/samples/pw_rpc/CMakeLists.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 2022 The Pigweed 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
-#
-#     https://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.
-
-cmake_minimum_required(VERSION 3.20)
-
-set(BOARD native_posix)
-set(NO_BUILD_TYPE_WARNING ON)
-set(CMAKE_VERBOSE_MAKEFILE ON)
-
-# Use this copy of Pigweed
-get_filename_component(PW_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../pigweed" ABSOLUTE)
-set(ENV{PW_ROOT} ${PW_ROOT})
-
-set(pw_third_party_nanopb_ADD_SUBDIRECTORY ON CACHE BOOL "" FORCE)
-
-list(APPEND ZEPHYR_EXTRA_MODULES
-    ${PW_ROOT}
-)
-
-find_package(Zephyr REQUIRED PATHS $ENV{ZEPHYR_BASE})
-project(rpc_demo)
-
-add_definitions(-DVERSION=5)
-add_definitions(-DCONFIG_RPC_BUFFER_SIZE=1024)
-add_definitions(-DPW_LOG_LEVEL=PW_LOG_LEVEL_INFO)
-add_definitions(-DPW_LOG_SHOW_MODULE=1)
-
-# Define the proto library
-include($ENV{PW_ROOT}/pw_protobuf_compiler/proto.cmake)
-pw_proto_library(
-    rpc_demo.protos
-    SOURCES proto/demo.proto
-)
-
-file(GLOB app_sources src/*.cc)
-target_sources(app
-  PRIVATE
-    ${app_sources}
-)
-zephyr_include_directories(include)
-zephyr_link_libraries(
-    rpc_demo.protos.nanopb
-    rpc_demo.protos.nanopb_rpc
-)
-target_link_libraries(app
-  PRIVATE
-    rpc_demo.protos.nanopb
-    rpc_demo.protos.nanopb_rpc
-)
diff --git a/samples/pw_rpc/include/rpc_demo/client/client_reader.h b/samples/pw_rpc/include/rpc_demo/client/client_reader.h
deleted file mode 100644
index b9b9b64..0000000
--- a/samples/pw_rpc/include/rpc_demo/client/client_reader.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#pragma once
-
-#include <pw_hdlc/rpc_channel.h>
-#include <pw_hdlc/rpc_packets.h>
-#include <pw_rpc/client.h>
-#include <pw_stream/stream.h>
-
-#include <array>
-#include <atomic>
-
-namespace rpc_demo {
-
-class ClientReader {
- public:
-  ClientReader(pw::stream::Reader& rx, pw::rpc::Client* rpc_client);
-  bool ParsePacket();
-
- private:
-  pw::stream::Reader& rx_;
-  pw::rpc::Client* rpc_client_;
-  std::array<std::byte, CONFIG_RPC_BUFFER_SIZE> decode_buffer_;
-  pw::hdlc::Decoder decoder_;
-};
-
-}  // namespace rpc_demo
diff --git a/samples/pw_rpc/include/rpc_demo/deque_stream.h b/samples/pw_rpc/include/rpc_demo/deque_stream.h
deleted file mode 100644
index f34d07c..0000000
--- a/samples/pw_rpc/include/rpc_demo/deque_stream.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#pragma once
-
-#include <pw_stream/stream.h>
-#include <pw_sync/mutex.h>
-
-#include <deque>
-
-class DequeReadWriter : public pw::stream::NonSeekableReaderWriter {
- public:
-  DequeReadWriter() = default;
-
- protected:
-  pw::StatusWithSize DoRead(pw::ByteSpan destination) override;
-  pw::Status DoWrite(pw::ConstByteSpan data) override;
-
- private:
-  std::deque<std::byte> buff_;
-  pw::sync::Mutex mutex_;
-};
diff --git a/samples/pw_rpc/include/rpc_demo/rxtx.h b/samples/pw_rpc/include/rpc_demo/rxtx.h
deleted file mode 100644
index f20db35..0000000
--- a/samples/pw_rpc/include/rpc_demo/rxtx.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#pragma once
-
-#include <pw_stream/stream.h>
-
-/**
- * @return The ReaderWriter stream used for client-to-service communication.
- */
-pw::stream::ReaderWriter& ClientToServiceStream();
-
-/**
- * @return The ReaderWriter stream used for service-to-client communication.
- */
-pw::stream::ReaderWriter& ServiceToClientStream();
diff --git a/samples/pw_rpc/include/rpc_demo/service/demo_service.h b/samples/pw_rpc/include/rpc_demo/service/demo_service.h
deleted file mode 100644
index 377981d..0000000
--- a/samples/pw_rpc/include/rpc_demo/service/demo_service.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#pragma once
-
-#include "proto/demo.rpc.pb.h"
-
-namespace rpc_demo {
-
-class DemoService : public pw_rpc::nanopb::DemoService::Service<DemoService> {
- public:
-  ::pw::Status GetVersion(const ::rpc_demo_Empty& request,
-                          ::rpc_demo_GetVersionResponse& response);
-
-  ::pw::Status GetSensorList(const ::rpc_demo_Empty& request,
-                             ::rpc_demo_GetSensorListResponse& response);
-
-  ::pw::Status UpdateSensorFrequency(
-      const ::rpc_demo_UpdateSensorFrequencyRequest& request,
-      ::rpc_demo_UpdateSensorFrequencyResponse& response);
-
-  ::pw::Status GetSensorSamples(
-      const ::rpc_demo_GetSensorSamplesRequest& request,
-      ::rpc_demo_GetSensorSamplesResponse& response);
-};
-
-}  // namespace rpc_demo
\ No newline at end of file
diff --git a/samples/pw_rpc/include/rpc_demo/service/service_reader.h b/samples/pw_rpc/include/rpc_demo/service/service_reader.h
deleted file mode 100644
index 2f9835b..0000000
--- a/samples/pw_rpc/include/rpc_demo/service/service_reader.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#pragma once
-
-#include <pw_hdlc/rpc_channel.h>
-#include <pw_span/span.h>
-#include <pw_stream/stream.h>
-
-#include <atomic>
-#include <thread>
-
-#include "rpc_demo/service/demo_service.h"
-
-namespace rpc_demo {
-
-class ServiceReader {
- public:
-  ServiceReader(pw::stream::Reader* reader,
-                pw::stream::Writer* writer,
-                pw::hdlc::RpcChannelOutput* output,
-                pw::span<pw::rpc::Channel> channels);
-
-  bool ParsePacket();
-
- private:
-  pw::stream::Reader* reader_;
-  pw::stream::Writer* writer_;
-  pw::hdlc::RpcChannelOutput* output_;
-  pw::span<pw::rpc::Channel> channels_;
-};
-
-}  // namespace rpc_demo
diff --git a/samples/pw_rpc/prj.conf b/samples/pw_rpc/prj.conf
deleted file mode 100644
index eb7abab..0000000
--- a/samples/pw_rpc/prj.conf
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright 2022 The Pigweed 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
-#
-#     https://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.
-
-CONFIG_ASSERT=y
-CONFIG_NANOPB=y
-CONFIG_BOARD_NATIVE_POSIX_64BIT=y
-CONFIG_LOG=y
-CONFIG_LOG_DEFAULT_LEVEL=4
-
-CONFIG_PIGWEED_ASSERT=y
-CONFIG_PIGWEED_BYTES=y
-CONFIG_PIGWEED_CHECKSUM=y
-CONFIG_PIGWEED_CHRONO_SYSTEM_CLOCK=y
-CONFIG_PIGWEED_CONTAINERS=y
-CONFIG_PIGWEED_FUNCTION=y
-CONFIG_PIGWEED_HDLC_RPC=y
-CONFIG_PIGWEED_INTERRUPT_CONTEXT=y
-CONFIG_PIGWEED_LOG=y
-CONFIG_PIGWEED_POLYFILL=y
-CONFIG_PIGWEED_POLYFILL_OVERRIDES=y
-CONFIG_PIGWEED_PREPROCESSOR=y
-CONFIG_PIGWEED_RESULT=y
-CONFIG_PIGWEED_ROUTER_PACKET_PARSER=y
-CONFIG_PIGWEED_RPC_COMMON=y
-CONFIG_PIGWEED_SPAN=y
-CONFIG_PIGWEED_STATUS=y
-CONFIG_PIGWEED_STREAM=y
-CONFIG_PIGWEED_STRING=y
-CONFIG_PIGWEED_SYNC_MUTEX=y
-CONFIG_PIGWEED_SYS_IO=y
-CONFIG_PIGWEED_VARINT=y
-
-CONFIG_CPLUSPLUS=y
-CONFIG_STD_CPP17=y
-CONFIG_LIB_CPLUSPLUS=y
-CONFIG_CPP_MAIN=y
diff --git a/samples/pw_rpc/proto/demo.proto b/samples/pw_rpc/proto/demo.proto
deleted file mode 100644
index 122427f..0000000
--- a/samples/pw_rpc/proto/demo.proto
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-syntax = "proto3";
-
-package rpc_demo;
-
-message GetVersionResponse {
-  uint32 version_number = 1;
-}
-
-message ThreeAxisData {
-  float x = 1;
-  float y = 2;
-  float z = 3;
-}
-
-message SensorInfo {
-  string name = 1;
-  enum Type {
-    ACCEL = 0;
-    GYRO = 1;
-    MAG = 2;
-  }
-  Type type = 2;
-  uint32 sample_frequency_hz = 3;
-}
-
-message GetSensorListResponse {
-  repeated SensorInfo sensors = 1;
-}
-
-message UpdateSensorFrequencyRequest {
-  uint32 sensor_index = 1;
-  uint32 sample_frequency_hz = 2;
-}
-
-message UpdateSensorFrequencyResponse {
-  uint32 sample_frequency_hz = 1;
-}
-
-message GetSensorSamplesRequest {
-  uint32 sensor_index = 1;
-}
-
-message GetSensorSamplesResponse {
-  repeated ThreeAxisData data = 1;
-}
-
-message Empty {}
-
-enum RpcClientChannelId {
-  UNASSIGNED = 0;
-  DEFAULT = 1;
-}
-
-service DemoService {
-  rpc GetVersion(Empty) returns (GetVersionResponse) {}
-  rpc GetSensorList(Empty) returns (GetSensorListResponse) {}
-  rpc UpdateSensorFrequency(UpdateSensorFrequencyRequest)
-      returns (UpdateSensorFrequencyResponse) {}
-  rpc GetSensorSamples(GetSensorSamplesRequest)
-      returns (GetSensorSamplesResponse) {}
-}
diff --git a/samples/pw_rpc/sample.yaml b/samples/pw_rpc/sample.yaml
deleted file mode 100644
index acf3ad4..0000000
--- a/samples/pw_rpc/sample.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-sample:
-  name: pw_rpc sample
-tests:
-  sample.pw_rpc:
-    tags: pw_rpc
-    platform_allow: native_posix
-    timeout: 10
-    harness: console
-    harness_config:
-      type: multi_line
-      ordered: true
-      regex:
-        - "(.*)Starting RPC demo(.*)"
-        - "(.*)Service waiting for data(.*)"
-        - "(.*)Starting pw_rpc service(.*)"
-        - "(.*)Service got packet!(.*)"
-        - "(.*)Client waiting for response(.*)"
-        - "(.*)Reading bytes(.*)"
-        - "(.*)Client got packet!(.*)"
-        - "(.*)Received version #5(.*)"
diff --git a/samples/pw_rpc/src/client_reader.cc b/samples/pw_rpc/src/client_reader.cc
deleted file mode 100644
index 8e430a1..0000000
--- a/samples/pw_rpc/src/client_reader.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#define PW_LOG_MODULE_NAME "ClientReader"
-
-#include "rpc_demo/client/client_reader.h"
-
-#include <pw_hdlc/decoder.h>
-#include <pw_hdlc/rpc_packets.h>
-#include <pw_log/log.h>
-#include <pw_status/status.h>
-
-namespace rpc_demo {
-
-ClientReader::ClientReader(pw::stream::Reader &rx, pw::rpc::Client *rpc_client)
-    : rx_(rx), rpc_client_(rpc_client), decode_buffer_(),
-      decoder_(decode_buffer_) {}
-
-bool ClientReader::ParsePacket() {
-  PW_LOG_INFO("Reading bytes...");
-  while (true) {
-    std::byte data;
-    if (auto result = rx_.Read(&data, 1); !result.ok()) {
-      PW_LOG_ERROR("Failed to read data");
-      continue;
-    }
-    PW_LOG_DEBUG("0x%02x", static_cast<uint8_t>(data));
-
-    pw::Result<pw::hdlc::Frame> result = decoder_.Process(data);
-    if (!result.ok()) {
-      continue;
-    }
-
-    pw::hdlc::Frame &frame = result.value();
-    if (frame.address() != pw::hdlc::kDefaultRpcAddress) {
-      return false;
-    }
-
-    PW_LOG_INFO("Client got packet!");
-    auto client_result = rpc_client_->ProcessPacket(frame.data());
-    PW_LOG_DEBUG("Client ProcessPacket status (%s)",
-                 pw_StatusString(client_result));
-    decoder_.Clear();
-    return true;
-  }
-}
-
-} // namespace rpc_demo
diff --git a/samples/pw_rpc/src/demo_service.cc b/samples/pw_rpc/src/demo_service.cc
deleted file mode 100644
index 1707965..0000000
--- a/samples/pw_rpc/src/demo_service.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#include "rpc_demo/service/demo_service.h"
-
-namespace rpc_demo {
-
-// Method definitions for pw_demo.DemoHostService.
-::pw::Status DemoService::GetVersion(const rpc_demo_Empty& request,
-                                     rpc_demo_GetVersionResponse& response) {
-  static_cast<void>(request);
-  response.version_number = VERSION;
-  return ::pw::OkStatus();
-}
-
-::pw::Status DemoService::GetSensorList(
-    const rpc_demo_Empty& request, rpc_demo_GetSensorListResponse& response) {
-  // TODO: Read the request as appropriate for your application
-  static_cast<void>(request);
-  // TODO: Fill in the response as appropriate for your application
-  static_cast<void>(response);
-  return ::pw::Status::Unimplemented();
-}
-
-::pw::Status DemoService::UpdateSensorFrequency(
-    const rpc_demo_UpdateSensorFrequencyRequest& request,
-    rpc_demo_UpdateSensorFrequencyResponse& response) {
-  // TODO: Read the request as appropriate for your application
-  static_cast<void>(request);
-  // TODO: Fill in the response as appropriate for your application
-  static_cast<void>(response);
-  return ::pw::Status::Unimplemented();
-}
-
-::pw::Status DemoService::GetSensorSamples(
-    const rpc_demo_GetSensorSamplesRequest& request,
-    rpc_demo_GetSensorSamplesResponse& response) {
-  // TODO: Read the request as appropriate for your application
-  static_cast<void>(request);
-  // TODO: Fill in the response as appropriate for your application
-  static_cast<void>(response);
-  return ::pw::Status::Unimplemented();
-}
-
-}  // namespace rpc_demo
diff --git a/samples/pw_rpc/src/deque_stream.cc b/samples/pw_rpc/src/deque_stream.cc
deleted file mode 100644
index e05df96..0000000
--- a/samples/pw_rpc/src/deque_stream.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#include <mutex>
-#include "rpc_demo/deque_stream.h"
-
-pw::StatusWithSize DequeReadWriter::DoRead(pw::ByteSpan destination) {
-  size_t count = 0;
-  std::lock_guard lock(mutex_);
-
-  while (!buff_.empty() && count < destination.size_bytes()) {
-    destination[count++] = buff_.front();
-    buff_.pop_front();
-  }
-
-  auto status = (count == 0) ? pw::Status::OutOfRange() : pw::OkStatus();
-  return pw::StatusWithSize(status, count);
-}
-
-pw::Status DequeReadWriter::DoWrite(pw::ConstByteSpan data) {
-  std::lock_guard lock(mutex_);
-  for (size_t i = 0; i < data.size_bytes(); ++i) {
-    buff_.push_back(data[i]);
-  }
-
-  return pw::OkStatus();
-}
diff --git a/samples/pw_rpc/src/main.cc b/samples/pw_rpc/src/main.cc
deleted file mode 100644
index 35964e2..0000000
--- a/samples/pw_rpc/src/main.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#define PW_LOG_MODULE_NAME "MAIN"
-
-#include <pw_hdlc/rpc_channel.h>
-#include <pw_hdlc/rpc_packets.h>
-#include <pw_log/log.h>
-#include <pw_status/status.h>
-
-#include "proto/demo.pb.h"
-#include "rpc_demo/client/client_reader.h"
-#include "rpc_demo/service/service_reader.h"
-#include "rpc_demo/rxtx.h"
-
-
-namespace {
-// Create the client channel output with a built-in buffer.
-pw::hdlc::RpcChannelOutput
-    client_to_service_channel_output(ClientToServiceStream().as_writer(),
-                                     pw::hdlc::kDefaultRpcAddress,
-                                     "HDLC client output");
-pw::hdlc::RpcChannelOutput
-    service_to_client_channel_output(ServiceToClientStream().as_writer(),
-                                     pw::hdlc::kDefaultRpcAddress,
-                                     "HDLC service output");
-
-// Configure the channel. Is this an output channel only?
-pw::rpc::Channel client_channels[] = {
-    pw::rpc::Channel::Create<rpc_demo_RpcClientChannelId_DEFAULT,
-                             rpc_demo_RpcClientChannelId>(
-        &client_to_service_channel_output),
-};
-pw::rpc::Channel service_channels[] = {
-    pw::rpc::Channel::Create<rpc_demo_RpcClientChannelId_DEFAULT,
-                             rpc_demo_RpcClientChannelId>(
-        &service_to_client_channel_output),
-};
-
-pw::rpc::Client rpc_client(client_channels);
-rpc_demo::pw_rpc::nanopb::DemoService::Client
-    service_client(rpc_client, rpc_demo_RpcClientChannelId_DEFAULT);
-
-void GetVersionResponse(const rpc_demo_GetVersionResponse &response,
-                               pw::Status status) {
-  if (status.ok()) {
-    PW_LOG_INFO("Received version #%u", response.version_number);
-  } else {
-    PW_LOG_ERROR("Failed to get version number, status: %s",
-                 pw_StatusString(status));
-  }
-}
-
-} // namespace
-
-int main(void) {
-  PW_LOG_INFO("Starting RPC demo...");
-  rpc_demo::ServiceReader ec_service(
-      &ClientToServiceStream().as_reader(),
-      &ServiceToClientStream().as_writer(),
-      reinterpret_cast<pw::hdlc::RpcChannelOutput*>(
-          &service_to_client_channel_output),
-      service_channels);
-  rpc_demo::ClientReader ap_client(ServiceToClientStream().as_reader(), &rpc_client);
-
-  auto response = service_client.GetVersion(rpc_demo_Empty_init_default,
-                                            GetVersionResponse);
-  PW_ASSERT(response.active());
-  PW_LOG_INFO("Service waiting for data...");
-  PW_ASSERT(ec_service.ParsePacket());
-  PW_LOG_INFO("Client waiting for response...");
-  PW_ASSERT(ap_client.ParsePacket());
-
-  return 0;
-}
diff --git a/samples/pw_rpc/src/rxtx.cc b/samples/pw_rpc/src/rxtx.cc
deleted file mode 100644
index 52c1982..0000000
--- a/samples/pw_rpc/src/rxtx.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-
-#include "rpc_demo/rxtx.h"
-#include "rpc_demo/deque_stream.h"
-
-namespace {
-DequeReadWriter client_to_service_stream;
-DequeReadWriter service_to_client_stream;
-} // namespace
-
-pw::stream::ReaderWriter &ClientToServiceStream() {
-  return client_to_service_stream;
-}
-pw::stream::ReaderWriter &ServiceToClientStream() {
-  return service_to_client_stream;
-}
diff --git a/samples/pw_rpc/src/service_reader.cc b/samples/pw_rpc/src/service_reader.cc
deleted file mode 100644
index aaf888d..0000000
--- a/samples/pw_rpc/src/service_reader.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-#define PW_LOG_MODULE_NAME "ServiceReader"
-
-#include "rpc_demo/service/service_reader.h"
-
-#include <pw_hdlc/rpc_channel.h>
-#include <pw_hdlc/rpc_packets.h>
-#include <pw_log/log.h>
-#include <pw_span/span.h>
-
-namespace rpc_demo {
-
-ServiceReader::ServiceReader(pw::stream::Reader* reader,
-                             pw::stream::Writer* writer,
-                             pw::hdlc::RpcChannelOutput* output,
-                             pw::span<pw::rpc::Channel> channels)
-    : reader_(reader), writer_(writer), output_(output), channels_(channels) {}
-
-bool ServiceReader::ParsePacket() {
-  std::array<std::byte, CONFIG_RPC_BUFFER_SIZE> decode_buffer{};
-  pw::rpc::Server server(channels_);
-  pw::hdlc::Decoder decoder(decode_buffer);
-  DemoService service;
-
-  server.RegisterService(service);
-
-  // Input buffer
-  PW_LOG_INFO("Starting pw_rpc service...");
-  while (true) {
-    std::byte data;
-
-    if (auto result = reader_->Read(&data, 1); !result.ok()) {
-      std::this_thread::sleep_for(std::chrono::milliseconds(50));
-      continue;
-    }
-
-    PW_LOG_DEBUG("0x%02x", static_cast<uint8_t>(data));
-    auto result = decoder.Process(data);
-    if (!result.ok()) {
-      continue;
-    }
-
-    auto& frame = result.value();
-    if (frame.address() != pw::hdlc::kDefaultRpcAddress) {
-      decoder.Clear();
-      return false;
-    }
-
-    PW_LOG_INFO("Service got packet!");
-    auto server_result = server.ProcessPacket(frame.data());
-    PW_LOG_DEBUG("Client ProcessPacket status (%s)",
-                 pw_StatusString(server_result));
-    decoder.Clear();
-    return true;
-  }
-}
-
-}  // namespace rpc_demo
diff --git a/samples/pw_tokenizer/CMakeLists.txt b/samples/pw_tokenizer/CMakeLists.txt
deleted file mode 100644
index e042dfd..0000000
--- a/samples/pw_tokenizer/CMakeLists.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 2022 The Pigweed 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
-#
-#     https://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.
-
-cmake_minimum_required(VERSION 3.20)
-
-set(BOARD native_posix)
-set(NO_BUILD_TYPE_WARNING ON)
-set(CMAKE_VERBOSE_MAKEFILE ON)
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-
-# Use this copy of Pigweed
-get_filename_component(PW_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../pigweed" ABSOLUTE)
-set(ENV{PW_ROOT} ${PW_ROOT})
-
-set(pw_third_party_nanopb_ADD_SUBDIRECTORY ON CACHE BOOL "" FORCE)
-
-list(APPEND ZEPHYR_EXTRA_MODULES ${PW_ROOT})
-
-find_package(Zephyr REQUIRED PATHS $ENV{ZEPHYR_BASE})
-project(tokenizer_demo)
-
-target_sources(app PRIVATE src/main.cc)
-
-# Add custom logic to generate database.bin
-# The application expects it to be in the binary dir.
-add_custom_target(database_binary
-  DEPENDS
-    ${CMAKE_BINARY_DIR}/database.bin
-)
-add_custom_command(
-    OUTPUT ${CMAKE_BINARY_DIR}/database.bin
-    COMMAND
-    ${PYTHON_EXECUTABLE}
-    ${PW_ROOT}/pw_tokenizer/py/pw_tokenizer/database.py
-    create
-    --type binary
-    -d ${CMAKE_BINARY_DIR}/database.bin
-    ${CMAKE_BINARY_DIR}/zephyr/zephyr_pre0.elf
-    DEPENDS zephyr_pre0
-)
-add_dependencies(${logical_target_for_zephyr_elf} database_binary)
diff --git a/samples/pw_tokenizer/prj.conf b/samples/pw_tokenizer/prj.conf
deleted file mode 100644
index 4555b22..0000000
--- a/samples/pw_tokenizer/prj.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2022 The Pigweed 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
-#
-#     https://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.
-
-CONFIG_ASSERT=y
-
-CONFIG_PIGWEED_ASSERT=y
-CONFIG_PIGWEED_TOKENIZER=y
-CONFIG_PIGWEED_DETOKENIZER=y
-
-CONFIG_CPLUSPLUS=y
-CONFIG_STD_CPP17=y
-CONFIG_LIB_CPLUSPLUS=y
-CONFIG_CPP_MAIN=y
diff --git a/samples/pw_tokenizer/sample.yaml b/samples/pw_tokenizer/sample.yaml
deleted file mode 100644
index e4ecca8..0000000
--- a/samples/pw_tokenizer/sample.yaml
+++ /dev/null
@@ -1,14 +0,0 @@
-sample:
-  name: pw_tokenizer sample
-tests:
-  sample.pw_tokenizer:
-    tags: pw_tokenizer
-    platform_allow: native_posix
-    timeout: 10
-    harness: console
-    harness_config:
-      type: multi_line
-      regex:
-        - "token=\\d+"
-        - "tokenized buffer size is 9 bytes"
-        - "detokenized message size is 17 bytes"
diff --git a/samples/pw_tokenizer/src/main.cc b/samples/pw_tokenizer/src/main.cc
deleted file mode 100644
index efe69af..0000000
--- a/samples/pw_tokenizer/src/main.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2022 The Pigweed 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
-//
-//     https://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.
-
-#include <cstring>
-#include <fstream>
-#include <pw_assert/assert.h>
-#include <pw_tokenizer/detokenize.h>
-#include <pw_tokenizer/tokenize.h>
-#include <string_view>
-#include <vector>
-#include <zephyr/kernel.h>
-
-static std::vector<uint8_t> ReadWholeFile(const char *path) {
-  // Open the file
-  std::ifstream file(path, std::ios::binary);
-
-  // Stop eating new lines in binary mode
-  file.unsetf(std::ios::skipws);
-
-  // Get the file size
-  std::streampos file_size;
-
-  file.seekg(0, std::ios::end);
-  file_size = file.tellg();
-  file.seekg(0, std::ios::beg);
-
-  // Reserve capacity
-  std::vector<uint8_t> data;
-  data.reserve(file_size);
-
-  // Read the data
-  data.insert(data.begin(), std::istream_iterator<uint8_t>(file),
-              std::istream_iterator<uint8_t>());
-
-  return data;
-}
-
-pw::tokenizer::Detokenizer OpenDatabase(const char *path) {
-  std::vector<uint8_t> data = ReadWholeFile(path);
-
-  pw::tokenizer::TokenDatabase database =
-      pw::tokenizer::TokenDatabase::Create(data);
-
-  // This checks if the file contained a valid database.
-  PW_ASSERT(database.ok());
-  return pw::tokenizer::Detokenizer(database);
-}
-
-constexpr uint32_t kHelloWorldToken = PW_TOKENIZE_STRING("Hello tokenized world!");
-
-int main(void) {
-  char expected_string[1024];
-  uint8_t buffer[1024];
-  size_t size_bytes = sizeof(buffer);
-
-  pw::tokenizer::Detokenizer detokenizer = OpenDatabase("database.bin");
-
-  sprintf(expected_string, "token=%u\n", kHelloWorldToken);
-  printk(expected_string);
-  PW_TOKENIZE_TO_BUFFER(buffer, &size_bytes, "token=%u\n", kHelloWorldToken);
-
-  printk("tokenized buffer size is %u bytes\n", size_bytes);
-
-  auto detokenized_string = detokenizer.Detokenize(buffer, size_bytes);
-  PW_ASSERT(detokenized_string.ok());
-  PW_ASSERT(strcmp(detokenized_string.BestString().c_str(), expected_string) ==
-            0);
-  printk("detokenized message size is %u bytes\n",
-         strlen(detokenized_string.BestString().c_str()));
-
-  return 0;
-}
diff --git a/test.sh b/test.sh
index 63c181a..1a07938 100755
--- a/test.sh
+++ b/test.sh
@@ -4,23 +4,28 @@
 set -x
 set -o pipefail
 
+#function cleanup {
+#  set +e
+#  docker kill zephyr
+#  docker rm zephyr
+#}
+#
+#trap cleanup EXIT
+
 cd $(dirname "$BASH_SOURCE")
 
-# Set up Pigweed's environment.
-. ./bootstrap.sh
-pip install --upgrade pigweed
+# Needed for docker to work
+chmod a+w zephyr/scripts/pylib/twister
+chmod a+w build_overrides
 
-# Set up Zephyr's environment.
-pip install west
-west init -l manifest
-west update
-pip install -r zephyr/scripts/requirements.txt
+docker run \
+  --name zephyr \
+  --rm \
+  -v $(pwd):/workdir \
+  -e ZEPHYR_TOOLCHAIN_VARIANT=zephyr \
+	-e BSIM_COMPONENTS_PATH=/opt/bsim/components \
+	-e BSIM_OUT_PATH=/opt/bsim \
+  -w /workdir \
+	ghcr.io/zephyrproject-rtos/zephyr-build:latest \
+  ./run_tests.sh
 
-# Use host toolchain
-export ZEPHYR_TOOLCHAIN_VARIANT=host
-
-# Use python protobuf
-export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
-
-# Run Pigweed/Zephyr tests.
-./zephyr/scripts/twister -v -c -i -T samples/
diff --git a/zephyr b/zephyr
new file mode 160000
index 0000000..7b2034a
--- /dev/null
+++ b/zephyr
@@ -0,0 +1 @@
+Subproject commit 7b2034aaecc4cb2a261973b10b2fa608b29d398c