zephyr: Fixup ToT to support Zephyr builds

Add the zephyr/ prefix to the include paths needed for ToT zephyr
builds as well as removing the type-limits warning. Type limit warnings
don't work with Zephyr because of the Kconfig feature. In a given
build we can check `uintptr >= CONFIG_X` and CONFIG_X may be 0, but
in another build it might be 10.

Bug: b/236263182
Change-Id: Iaf3a5075a4af51f740efe66abcd709d6d9796396
Signed-off-by: Yuval Peress <peress@google.com>
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/108834
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Rob Barnes <robbarnes@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f27641..d4cf398 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,10 @@
   pw_set_zephyr_backend_ifdef(CONFIG_PIGWEED_SYNC_MUTEX pw_sync.mutex pw_sync_zephyr.mutex_backend)
   pw_set_zephyr_backend_ifdef(CONFIG_PIGWEED_SYNC_BINARY_SEMAPHORE pw_sync.mutex pw_sync_zephyr.binary_semaphore_backend)
   pw_set_zephyr_backend_ifdef(CONFIG_PIGWEED_SYS_IO pw_sys_io pw_sys_io_zephyr)
+
+  if(CONFIG_NANOPB AND "${dir_pw_third_party_nanopb}" STREQUAL "")
+    set(dir_pw_third_party_nanopb "${ZEPHYR_NANOPB_MODULE_DIR}" CACHE PATH "" FORCE)
+  endif()
 endif()
 
 add_subdirectory(pw_assert EXCLUDE_FROM_ALL)
diff --git a/pw_assert_zephyr/public/pw_assert_zephyr/assert_zephyr.h b/pw_assert_zephyr/public/pw_assert_zephyr/assert_zephyr.h
index cf4bba2..59c1ed0 100644
--- a/pw_assert_zephyr/public/pw_assert_zephyr/assert_zephyr.h
+++ b/pw_assert_zephyr/public/pw_assert_zephyr/assert_zephyr.h
@@ -13,6 +13,6 @@
 // the License.
 #pragma once
 
-#include <sys/__assert.h>
+#include <zephyr/sys/__assert.h>
 
 #define PW_ASSERT_HANDLE_FAILURE(condition) __ASSERT_NO_MSG(condition);
diff --git a/pw_assert_zephyr/public/pw_assert_zephyr/check_zephyr.h b/pw_assert_zephyr/public/pw_assert_zephyr/check_zephyr.h
index caee682..d5abbca 100644
--- a/pw_assert_zephyr/public/pw_assert_zephyr/check_zephyr.h
+++ b/pw_assert_zephyr/public/pw_assert_zephyr/check_zephyr.h
@@ -13,7 +13,7 @@
 // the License.
 #pragma once
 
-#include <sys/__assert.h>
+#include <zephyr/sys/__assert.h>
 
 #define PW_HANDLE_CRASH(...)        \
   {                                 \
diff --git a/pw_build/CMakeLists.txt b/pw_build/CMakeLists.txt
index 79e4bc2..c8e645b 100644
--- a/pw_build/CMakeLists.txt
+++ b/pw_build/CMakeLists.txt
@@ -72,9 +72,13 @@
 # TODO(hepler): These Zephyr exceptions should be made by overriding
 #     pw_build_WARNINGS.
 add_library(pw_build.strict_warnings INTERFACE)
-if(NOT ZEPHYR_PIGWEED_MODULE_DIR)
+if(ZEPHYR_PIGWEED_MODULE_DIR)
+  # -Wtype-limits is incompatible with Kconfig at times, disable it for Zephyr
+  # builds.
+  set(strict_warnings_cond "-Wno-type-limits")
+else()
   # Only include these flags if we're not building with Zephyr.
-  set(strict_warnings_cond "-Wcast-qual" "-Wundef")
+  set(strict_warnings_cond "-Wundef")
 endif()
 target_compile_options(pw_build.strict_warnings
   INTERFACE
diff --git a/pw_interrupt_zephyr/public/pw_interrupt_zephyr/context_inline.h b/pw_interrupt_zephyr/public/pw_interrupt_zephyr/context_inline.h
index cf8fb78..e2fda03 100644
--- a/pw_interrupt_zephyr/public/pw_interrupt_zephyr/context_inline.h
+++ b/pw_interrupt_zephyr/public/pw_interrupt_zephyr/context_inline.h
@@ -13,7 +13,7 @@
 // the License.
 #pragma once
 
-#include <kernel.h>
+#include <zephyr/kernel.h>
 
 namespace pw::interrupt {
 
diff --git a/pw_log_zephyr/log_zephyr.cc b/pw_log_zephyr/log_zephyr.cc
index 053bf54..3990d5d 100644
--- a/pw_log_zephyr/log_zephyr.cc
+++ b/pw_log_zephyr/log_zephyr.cc
@@ -12,7 +12,7 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-#include <logging/log.h>
+#include <zephyr/logging/log.h>
 
 #include "pw_log_zephyr/config.h"
 
diff --git a/pw_log_zephyr/public/pw_log_zephyr/log_zephyr.h b/pw_log_zephyr/public/pw_log_zephyr/log_zephyr.h
index 5f0b88e..d5d53ea 100644
--- a/pw_log_zephyr/public/pw_log_zephyr/log_zephyr.h
+++ b/pw_log_zephyr/public/pw_log_zephyr/log_zephyr.h
@@ -13,8 +13,8 @@
 // the License.
 #pragma once
 
-#include <logging/log.h>
-#include <logging/log_ctrl.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/logging/log_ctrl.h>
 
 #include "pw_log_zephyr/config.h"
 
diff --git a/pw_sync_zephyr/public/pw_sync_zephyr/mutex_inline.h b/pw_sync_zephyr/public/pw_sync_zephyr/mutex_inline.h
index cbc9772..c118064 100644
--- a/pw_sync_zephyr/public/pw_sync_zephyr/mutex_inline.h
+++ b/pw_sync_zephyr/public/pw_sync_zephyr/mutex_inline.h
@@ -13,7 +13,7 @@
 // the License.
 #pragma once
 
-#include <kernel.h>
+#include <zephyr/kernel.h>
 
 #include "pw_assert/assert.h"
 #include "pw_interrupt/context.h"
diff --git a/pw_sync_zephyr/public/pw_sync_zephyr/mutex_native.h b/pw_sync_zephyr/public/pw_sync_zephyr/mutex_native.h
index e1099e9..bfb604e 100644
--- a/pw_sync_zephyr/public/pw_sync_zephyr/mutex_native.h
+++ b/pw_sync_zephyr/public/pw_sync_zephyr/mutex_native.h
@@ -13,7 +13,7 @@
 // the License.
 #pragma once
 
-#include <kernel.h>
+#include <zephyr/kernel.h>
 
 namespace pw::sync::backend {
 
diff --git a/pw_sys_io_zephyr/sys_io.cc b/pw_sys_io_zephyr/sys_io.cc
index c86e38b..024f651 100644
--- a/pw_sys_io_zephyr/sys_io.cc
+++ b/pw_sys_io_zephyr/sys_io.cc
@@ -14,10 +14,10 @@
 
 #include "pw_sys_io/sys_io.h"
 
-#include <console/console.h>
-#include <init.h>
-#include <usb/usb_device.h>
-#include <zephyr.h>
+#include <zephyr/console/console.h>
+#include <zephyr/init.h>
+#include <zephyr/usb/usb_device.h>
+#include <zephyr/zephyr.h>
 
 static int sys_io_init(const struct device* dev) {
   int err;