Rename pw_dumb_io to pw_sys_io Rename pw_dumb_io facade and backends to use the more deliberate name pw_sys_io moving forward. Change-Id: I968480715967ab8de491856afa1b7692b973ed7e
diff --git a/BUILD.gn b/BUILD.gn index 738f087..c63a20b 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -43,7 +43,7 @@ group("pw_facades") { deps = [ "$dir_pw_cpu_exception", - "$dir_pw_dumb_io", + "$dir_pw_sys_io", ] }
diff --git a/CMakeLists.txt b/CMakeLists.txt index c9e6b7d..3631ad9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -25,8 +25,6 @@ add_subdirectory(pw_containers) add_subdirectory(pw_cpu_exception) add_subdirectory(pw_cpu_exception_armv7m) -add_subdirectory(pw_dumb_io) -add_subdirectory(pw_dumb_io_stdio) add_subdirectory(pw_kvs) add_subdirectory(pw_log) add_subdirectory(pw_log_basic) @@ -36,6 +34,8 @@ add_subdirectory(pw_span) add_subdirectory(pw_status) add_subdirectory(pw_string) +add_subdirectory(pw_sys_io) +add_subdirectory(pw_sys_io_stdio) add_subdirectory(pw_tokenizer) add_subdirectory(pw_unit_test) add_subdirectory(pw_varint)
diff --git a/docs/BUILD.gn b/docs/BUILD.gn index 8d5b7c8..5bc0f00 100644 --- a/docs/BUILD.gn +++ b/docs/BUILD.gn
@@ -46,9 +46,6 @@ "$dir_pw_cpu_exception_armv7m:docs", "$dir_pw_docgen:docs", "$dir_pw_doctor:docs", - "$dir_pw_dumb_io:docs", - "$dir_pw_dumb_io_baremetal_stm32f429:docs", - "$dir_pw_dumb_io_stdio:docs", "$dir_pw_log:docs", "$dir_pw_minimal_cpp_stdlib:docs", "$dir_pw_module:docs", @@ -60,6 +57,9 @@ "$dir_pw_span:docs", "$dir_pw_status:docs", "$dir_pw_string:docs", + "$dir_pw_sys_io:docs", + "$dir_pw_sys_io_baremetal_stm32f429:docs", + "$dir_pw_sys_io_stdio:docs", "$dir_pw_target_runner:docs", "$dir_pw_tokenizer:docs", ]
diff --git a/modules.gni b/modules.gni index 6138f24..ddc253f 100644 --- a/modules.gni +++ b/modules.gni
@@ -28,10 +28,6 @@ dir_pw_cpu_exception_armv7m = "$dir_pigweed/pw_cpu_exception_armv7m" dir_pw_docgen = "$dir_pigweed/pw_docgen" dir_pw_doctor = "$dir_pigweed/pw_doctor" -dir_pw_dumb_io = "$dir_pigweed/pw_dumb_io" -dir_pw_dumb_io_baremetal_stm32f429 = - "$dir_pigweed/pw_dumb_io_baremetal_stm32f429" -dir_pw_dumb_io_stdio = "$dir_pigweed/pw_dumb_io_stdio" dir_pw_kvs = "$dir_pigweed/pw_kvs" dir_pw_log = "$dir_pigweed/pw_log" dir_pw_log_basic = "$dir_pigweed/pw_log_basic" @@ -45,6 +41,9 @@ dir_pw_span = "$dir_pigweed/pw_span" dir_pw_status = "$dir_pigweed/pw_status" dir_pw_string = "$dir_pigweed/pw_string" +dir_pw_sys_io = "$dir_pigweed/pw_sys_io" +dir_pw_sys_io_baremetal_stm32f429 = "$dir_pigweed/pw_sys_io_baremetal_stm32f429" +dir_pw_sys_io_stdio = "$dir_pigweed/pw_sys_io_stdio" dir_pw_target_runner = "$dir_pigweed/pw_target_runner" dir_pw_tokenizer = "$dir_pigweed/pw_tokenizer" dir_pw_toolchain = "$dir_pigweed/pw_toolchain"
diff --git a/pw_assert_basic/BUILD b/pw_assert_basic/BUILD index 6a04d08..418de24 100644 --- a/pw_assert_basic/BUILD +++ b/pw_assert_basic/BUILD
@@ -35,8 +35,8 @@ "public_overrides", ], deps = [ - "//pw_dumb_io", "//pw_assert:facade", "//pw_string", + "//pw_sys_io", ], )
diff --git a/pw_assert_basic/BUILD.gn b/pw_assert_basic/BUILD.gn index dab7606..9b39a97 100644 --- a/pw_assert_basic/BUILD.gn +++ b/pw_assert_basic/BUILD.gn
@@ -36,9 +36,9 @@ public_configs = [ ":default_config" ] deps = [ "$dir_pw_assert:facade", - "$dir_pw_dumb_io", "$dir_pw_preprocessor", "$dir_pw_string", + "$dir_pw_sys_io", ] public = [ "public/pw_assert_basic/assert_basic.h" ] sources = public + [ "assert_basic.cc" ]
diff --git a/pw_assert_basic/CMakeLists.txt b/pw_assert_basic/CMakeLists.txt index 432e5f9..7e6c46a 100644 --- a/pw_assert_basic/CMakeLists.txt +++ b/pw_assert_basic/CMakeLists.txt
@@ -16,9 +16,9 @@ IMPLEMENTS_FACADE pw_assert PRIVATE_DEPS - pw_dumb_io pw_preprocessor pw_string + pw_sys_io ) target_include_directories(pw_assert_basic PUBLIC public_overrides)
diff --git a/pw_assert_basic/assert_basic.cc b/pw_assert_basic/assert_basic.cc index b6abdb1..3046ba6 100644 --- a/pw_assert_basic/assert_basic.cc +++ b/pw_assert_basic/assert_basic.cc
@@ -21,9 +21,9 @@ #include <cstring> -#include "pw_dumb_io/dumb_io.h" #include "pw_preprocessor/util.h" #include "pw_string/string_builder.h" +#include "pw_sys_io/sys_io.h" // TODO(pwbug/17): Expose these through the config system. #define PW_ASSERT_BASIC_SHOW_BANNER 1 @@ -73,7 +73,7 @@ " ", }; -using pw::dumb_io::WriteLine; +using pw::sys_io::WriteLine; typedef pw::StringBuffer<150> Buffer; @@ -104,7 +104,7 @@ va_start(args, message); buffer.FormatVaList(message, args); va_end(args); - pw::dumb_io::WriteLine(buffer.view()); + WriteLine(buffer.view()); } WriteLine("");
diff --git a/pw_boot_armv7m/BUILD b/pw_boot_armv7m/BUILD index 0c78627..0980c0a 100644 --- a/pw_boot_armv7m/BUILD +++ b/pw_boot_armv7m/BUILD
@@ -17,7 +17,7 @@ licenses(["notice"]) # Apache License 2.0 filegroup( - name = "pw_dumb_io_baremetal_stm32f429", + name = "pw_boot_armv7m", srcs = [ "core_init.c", "public/pw_boot_armv7m/boot.h",
diff --git a/pw_cpu_exception_armv7m/BUILD.gn b/pw_cpu_exception_armv7m/BUILD.gn index d627ab7..a23a396 100644 --- a/pw_cpu_exception_armv7m/BUILD.gn +++ b/pw_cpu_exception_armv7m/BUILD.gn
@@ -27,8 +27,8 @@ public_configs = [ ":default_config" ] deps = [ "$dir_pw_cpu_exception:facade", - "$dir_pw_dumb_io:default_putget_bytes", "$dir_pw_preprocessor", + "$dir_pw_sys_io:default_putget_bytes", ] public = [ "public/pw_cpu_exception_armv7m/cpu_state.h" ] sources = [
diff --git a/pw_dumb_io_stdio/docs.rst b/pw_dumb_io_stdio/docs.rst deleted file mode 100644 index c97a16b..0000000 --- a/pw_dumb_io_stdio/docs.rst +++ /dev/null
@@ -1,39 +0,0 @@ -.. _chapter-pw-dumb-io-stdio: - -.. default-domain:: cpp - -.. highlight:: sh - ----------------- -pw_dumb_io_stdio ----------------- -The ``pw_dumb_io_stdio`` backend implements the ``pw_dumb_io`` facade using -stdio. - -Why not just use stdio directly? --------------------------------- - -The nice thing about using ``pw_dumb_io`` is that it's rather easy to get a -board up and running with a target-specific backend. This means when drafting -out a quick application you can write it against ``pw_dumb_io`` and, with some -care, the application will be able to run on both host and target devices. - -While it's not recommended to use ``pw_dumb_io`` for any production -applications, it can be rather helpful for early prototyping. - -Setup -===== -This module requires relatively minimal setup: - - 1. Write code against the ``pw_dumb_io`` facade. - 2. Specify the ``dir_pw_dumb_io_backend`` GN global variable to point to this - backend. - -Module usage -============ -For the most part, applications built with this backend will behave similarly -to an application built directly against stdio. - -Dependencies -============ - * pw_dumb_io facade
diff --git a/pw_log_basic/BUILD b/pw_log_basic/BUILD index fd9105d..ad7ac07 100644 --- a/pw_log_basic/BUILD +++ b/pw_log_basic/BUILD
@@ -35,8 +35,8 @@ "public_overrides", ], deps = [ - "//pw_dumb_io", "//pw_log:facade", "//pw_string", + "//pw_sys_io", ], )
diff --git a/pw_log_basic/BUILD.gn b/pw_log_basic/BUILD.gn index 2b895ac..0efa82d 100644 --- a/pw_log_basic/BUILD.gn +++ b/pw_log_basic/BUILD.gn
@@ -35,10 +35,10 @@ source_set("pw_log_basic_core") { public_configs = [ ":default_config" ] deps = [ - "$dir_pw_dumb_io", "$dir_pw_log:facade", "$dir_pw_preprocessor", "$dir_pw_string", + "$dir_pw_sys_io", ] public = [ "public/pw_log_basic/log_basic.h" ] sources = public + [ "log_basic.cc" ]
diff --git a/pw_log_basic/CMakeLists.txt b/pw_log_basic/CMakeLists.txt index c85276d..5c66fe0 100644 --- a/pw_log_basic/CMakeLists.txt +++ b/pw_log_basic/CMakeLists.txt
@@ -16,8 +16,8 @@ IMPLEMENTS_FACADE pw_log PRIVATE_DEPS - pw_dumb_io pw_string + pw_sys_io ) target_include_directories(pw_log_basic PUBLIC public_overrides)
diff --git a/pw_log_basic/log_basic.cc b/pw_log_basic/log_basic.cc index c586830..e67d6d1 100644 --- a/pw_log_basic/log_basic.cc +++ b/pw_log_basic/log_basic.cc
@@ -18,9 +18,9 @@ #include <cstring> -#include "pw_dumb_io/dumb_io.h" #include "pw_log/levels.h" #include "pw_string/string_builder.h" +#include "pw_sys_io/sys_io.h" // ANSI color constants to control the terminal. Not Windows compatible. // clang-format off @@ -148,5 +148,5 @@ va_end(args); // All done; flush the log. - pw::dumb_io::WriteLine(buffer.view()); + pw::sys_io::WriteLine(buffer.view()); }
diff --git a/pw_dumb_io/BUILD b/pw_sys_io/BUILD similarity index 87% rename from pw_dumb_io/BUILD rename to pw_sys_io/BUILD index a25a845..11e8201 100644 --- a/pw_dumb_io/BUILD +++ b/pw_sys_io/BUILD
@@ -23,7 +23,7 @@ pw_cc_library( name = "facade", - hdrs = ["public/pw_dumb_io/dumb_io.h"], + hdrs = ["public/pw_sys_io/sys_io.h"], includes = ["public"], deps = [ "//pw_span", @@ -33,7 +33,7 @@ pw_cc_library( name = "default_putget_bytes", - srcs = ["dumb_io.cc"], + srcs = ["sys_io.cc"], deps = [ ":facade", "//pw_span", @@ -42,14 +42,14 @@ ) pw_cc_library( - name = "pw_dumb_io", - hdrs = ["public/pw_dumb_io/dumb_io.h"], + name = "pw_sys_io", + hdrs = ["public/pw_sys_io/sys_io.h"], deps = [ ":facade", - # For now, hard-code to depend on stdio until bazel build is updated - # to support multiple target configurations. - "//pw_dumb_io_stdio", "//pw_span", "//pw_status", + # For now, hard-code to depend on stdio until bazel build is updated + # to support multiple target configurations. + "//pw_sys_io_stdio", ], )
diff --git a/pw_dumb_io/BUILD.gn b/pw_sys_io/BUILD.gn similarity index 87% rename from pw_dumb_io/BUILD.gn rename to pw_sys_io/BUILD.gn index b451afa..0c48cf6 100644 --- a/pw_dumb_io/BUILD.gn +++ b/pw_sys_io/BUILD.gn
@@ -19,19 +19,19 @@ include_dirs = [ "public" ] } -pw_facade("pw_dumb_io") { - backend = dir_pw_dumb_io_backend +pw_facade("pw_sys_io") { + backend = dir_pw_sys_io_backend public_configs = [ ":default_config" ] public_deps = [ "$dir_pw_span", "$dir_pw_status", ] - public = [ "public/pw_dumb_io/dumb_io.h" ] + public = [ "public/pw_sys_io/sys_io.h" ] } source_set("default_putget_bytes") { deps = [ ":facade" ] - sources = [ "dumb_io.cc" ] + sources = [ "sys_io.cc" ] } pw_doc_group("docs") {
diff --git a/pw_dumb_io/CMakeLists.txt b/pw_sys_io/CMakeLists.txt similarity index 93% rename from pw_dumb_io/CMakeLists.txt rename to pw_sys_io/CMakeLists.txt index 1828904..7ca3860 100644 --- a/pw_dumb_io/CMakeLists.txt +++ b/pw_sys_io/CMakeLists.txt
@@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations under # the License. -pw_add_facade(pw_dumb_io +pw_add_facade(pw_sys_io SOURCES - dumb_io.cc + sys_io.cc PUBLIC_DEPS pw_span pw_status
diff --git a/pw_dumb_io/docs.rst b/pw_sys_io/docs.rst similarity index 79% rename from pw_dumb_io/docs.rst rename to pw_sys_io/docs.rst index a431f20..38b5ef7 100644 --- a/pw_dumb_io/docs.rst +++ b/pw_sys_io/docs.rst
@@ -1,12 +1,12 @@ -.. _chapter-pw-dumb-io: +.. _chapter-pw-sys-io: .. default-domain:: cpp .. highlight:: sh ----------- -pw_dumb_io ----------- +--------- +pw_sys_io +--------- This module defines a simple and unoptimized interface for byte-by-byte input/output. This can be done over a logging system, stdio, UART, via a photodiode and modulated kazoo, or basically any way to get data in and out @@ -34,16 +34,17 @@ ===== This module requires relatively minimal setup: - 1. Chose a ``pw_dumb_io`` backend, or write one yourself. - 2. If using GN build, Specify the ``dir_pw_dumb_io_backend`` GN global - variable to point to your ``pw_dumb_io`` backend. + 1. Chose a ``pw_sys_io`` backend, or write one yourself. + 2. If using GN build, Specify the ``dir_pw_sys_io_backend`` GN global + variable to point to your ``pw_sys_io`` backend. Module usage ============ -See backend docs for how to interact with the underlying dumb io implementation. +See backend docs for how to interact with the underlying system I/O +implementation. Dependencies ============ - * pw_dumb_io_backend + * pw_sys_io_backend * pw_span * pw_status
diff --git a/pw_dumb_io/public/pw_dumb_io/dumb_io.h b/pw_sys_io/public/pw_sys_io/sys_io.h similarity index 90% rename from pw_dumb_io/public/pw_dumb_io/dumb_io.h rename to pw_sys_io/public/pw_sys_io/sys_io.h index 8f7ce70..3010de1 100644 --- a/pw_dumb_io/public/pw_dumb_io/dumb_io.h +++ b/pw_sys_io/public/pw_sys_io/sys_io.h
@@ -43,30 +43,30 @@ #include "pw_status/status.h" #include "pw_status/status_with_size.h" -namespace pw::dumb_io { +namespace pw::sys_io { -// Read a single byte from the dumb io backend. +// Read a single byte from the sys io backend. // Implemented by: Backend // // This function will block until it either succeeds or fails to read a byte -// from the pw_dumb_io backend. +// from the pw_sys_io backend. // // Returns Status::OK if a byte was successfully read. Status ReadByte(std::byte* dest); -// Write a single byte out the dumb io backend. +// Write a single byte out the sys io backend. // Implemented by: Backend // // This function will block until it either succeeds or fails to write a byte -// out the pw_dumb_io backend. +// out the pw_sys_io backend. // // Returns Status::OK if a byte was successfully read. Status WriteByte(std::byte b); -// Write a string out the dumb io backend. +// Write a string out the sys io backend. // Implemented by: Backend // -// This function takes a null-terminated string and writes it out the dumb io +// This function takes a null-terminated string and writes it out the sys io // backend, adding any platform-specific newline character(s) (these are // accounted for in the returned StatusWithSize). // @@ -75,7 +75,7 @@ // are returned as part of the StatusWithSize. StatusWithSize WriteLine(const std::string_view& s); -// Fill a byte span from the dumb io backend using ReadByte(). +// Fill a byte span from the sys io backend using ReadByte(). // Implemented by: Facade // // This function is implemented by this facade and simply uses ReadByte() to @@ -89,7 +89,7 @@ // are returned as part of the StatusWithSize. StatusWithSize ReadBytes(span<std::byte> dest); -// Write span of bytes out the dumb io backend using WriteByte(). +// Write span of bytes out the sys io backend using WriteByte(). // Implemented by: Facade // // This function is implemented by this facade and simply writes the source @@ -103,4 +103,4 @@ // are returned as part of the StatusWithSize. StatusWithSize WriteBytes(span<const std::byte> src); -} // namespace pw::dumb_io +} // namespace pw::sys_io
diff --git a/pw_dumb_io/dumb_io.cc b/pw_sys_io/sys_io.cc similarity index 92% rename from pw_dumb_io/dumb_io.cc rename to pw_sys_io/sys_io.cc index 26b9f62..ed0ab5c 100644 --- a/pw_dumb_io/dumb_io.cc +++ b/pw_sys_io/sys_io.cc
@@ -12,9 +12,9 @@ // License for the specific language governing permissions and limitations under // the License. -#include "pw_dumb_io/dumb_io.h" +#include "pw_sys_io/sys_io.h" -namespace pw::dumb_io { +namespace pw::sys_io { StatusWithSize ReadBytes(span<std::byte> dest) { for (size_t i = 0; i < dest.size_bytes(); ++i) { @@ -36,4 +36,4 @@ return StatusWithSize(src.size_bytes()); } -} // namespace pw::dumb_io +} // namespace pw::sys_io
diff --git a/pw_dumb_io_baremetal_stm32f429/BUILD b/pw_sys_io_baremetal_stm32f429/BUILD similarity index 90% rename from pw_dumb_io_baremetal_stm32f429/BUILD rename to pw_sys_io_baremetal_stm32f429/BUILD index 595b3c4..42f5c32 100644 --- a/pw_dumb_io_baremetal_stm32f429/BUILD +++ b/pw_sys_io_baremetal_stm32f429/BUILD
@@ -17,8 +17,8 @@ licenses(["notice"]) # Apache License 2.0 filegroup( - name = "pw_dumb_io_baremetal_stm32f429", + name = "pw_sys_io_baremetal_stm32f429", srcs = [ - "dumb_io_baremetal.cc", + "sys_io_baremetal.cc", ], )
diff --git a/pw_dumb_io_baremetal_stm32f429/BUILD.gn b/pw_sys_io_baremetal_stm32f429/BUILD.gn similarity index 78% rename from pw_dumb_io_baremetal_stm32f429/BUILD.gn rename to pw_sys_io_baremetal_stm32f429/BUILD.gn index bdd2aed..5bff1c2 100644 --- a/pw_dumb_io_baremetal_stm32f429/BUILD.gn +++ b/pw_sys_io_baremetal_stm32f429/BUILD.gn
@@ -16,15 +16,15 @@ # This if statement allows docs to always build even if the target isn't # compatible with this backend. -if (dir_pw_dumb_io_backend == dir_pw_dumb_io_baremetal_stm32f429) { - source_set("pw_dumb_io_baremetal_stm32f429") { +if (dir_pw_sys_io_backend == dir_pw_sys_io_baremetal_stm32f429) { + source_set("pw_sys_io_baremetal_stm32f429") { public_deps = [ "$dir_pw_boot_armv7m" ] deps = [ - "$dir_pw_dumb_io:default_putget_bytes", - "$dir_pw_dumb_io:facade", "$dir_pw_preprocessor", + "$dir_pw_sys_io:default_putget_bytes", + "$dir_pw_sys_io:facade", ] - sources = [ "dumb_io_baremetal.cc" ] + sources = [ "sys_io_baremetal.cc" ] } }
diff --git a/pw_dumb_io_baremetal_stm32f429/docs.rst b/pw_sys_io_baremetal_stm32f429/docs.rst similarity index 76% rename from pw_dumb_io_baremetal_stm32f429/docs.rst rename to pw_sys_io_baremetal_stm32f429/docs.rst index b47b88c..934deca 100644 --- a/pw_dumb_io_baremetal_stm32f429/docs.rst +++ b/pw_sys_io_baremetal_stm32f429/docs.rst
@@ -1,18 +1,18 @@ -.. _chapter-pw-dumb-io-baremetal-stm32f429: +.. _chapter-pw-sys-io-baremetal-stm32f429: .. default-domain:: cpp .. highlight:: sh ------------------------------- -pw_dumb_io_baremetal_stm32f429 ------------------------------- +----------------------------- +pw_sys_io_baremetal_stm32f429 +----------------------------- -``pw_dumb_io_baremetal_stm32f429`` implements the ``pw_dumb_io`` facade over +``pw_sys_io_baremetal_stm32f429`` implements the ``pw_sys_io`` facade over UART. -The STM32F429 baremetal dumb IO backend provides device startup code and a UART -driver layer that allows applications built against the ``pw_dumb_io`` interface +The STM32F429 baremetal sys IO backend provides device startup code and a UART +driver layer that allows applications built against the ``pw_sys_io`` interface to run on a STM32F429 chip and do simple input/output via UART. The code is optimized for the STM32F429I-DISC1, using USART1 (which is connected to the virtual COM port on the embedded ST-LINKv2 chip). However, this should work with @@ -25,8 +25,8 @@ ===== This module requires relatively minimal setup: - 1. Write code against the ``pw_dumb_io`` facade. - 2. Specify the ``dir_pw_dumb_io_backend`` GN global variable to point to this + 1. Write code against the ``pw_sys_io`` facade. + 2. Specify the ``dir_pw_sys_io_backend`` GN global variable to point to this backend. 3. Build an executable with a main() function using a toolchain that supports Cortex-M4. @@ -61,5 +61,5 @@ Dependencies ============ - * pw_dumb_io facade + * pw_sys_io facade * pw_preprocessor module
diff --git a/pw_dumb_io_baremetal_stm32f429/dumb_io_baremetal.cc b/pw_sys_io_baremetal_stm32f429/sys_io_baremetal.cc similarity index 97% rename from pw_dumb_io_baremetal_stm32f429/dumb_io_baremetal.cc rename to pw_sys_io_baremetal_stm32f429/sys_io_baremetal.cc index 1810d28..3b7415a 100644 --- a/pw_dumb_io_baremetal_stm32f429/dumb_io_baremetal.cc +++ b/pw_sys_io_baremetal_stm32f429/sys_io_baremetal.cc
@@ -15,8 +15,8 @@ #include <cinttypes> #include "pw_boot_armv7m/boot.h" -#include "pw_dumb_io/dumb_io.h" #include "pw_preprocessor/compiler.h" +#include "pw_sys_io/sys_io.h" namespace { @@ -217,7 +217,7 @@ #endif // defined(PW_ARMV7M_ENABLE_FPU) && PW_ARMV7M_ENABLE_FPU == 1 } -namespace pw::dumb_io { +namespace pw::sys_io { // Wait for a byte to read on USART1. This blocks until a byte is read. This is // extremely inefficient as it requires the target to burn CPU cycles polling to @@ -244,7 +244,7 @@ return Status::OK; } -// Writes a string using pw::dumb_io, and add newline characters at the end. +// Writes a string using pw::sys_io, and add newline characters at the end. StatusWithSize WriteLine(const std::string_view& s) { size_t chars_written = 0; StatusWithSize result = WriteBytes(as_bytes(span(s))); @@ -260,4 +260,4 @@ return StatusWithSize(result.status(), chars_written); } -} // namespace pw::dumb_io +} // namespace pw::sys_io
diff --git a/pw_dumb_io_stdio/BUILD b/pw_sys_io_stdio/BUILD similarity index 85% rename from pw_dumb_io_stdio/BUILD rename to pw_sys_io_stdio/BUILD index 0f8da67..333bd54 100644 --- a/pw_dumb_io_stdio/BUILD +++ b/pw_sys_io_stdio/BUILD
@@ -22,10 +22,10 @@ licenses(["notice"]) # Apache License 2.0 pw_cc_library( - name = "pw_dumb_io_stdio", - srcs = ["dumb_io.cc"], + name = "pw_sys_io_stdio", + srcs = ["sys_io.cc"], deps = [ - "//pw_dumb_io:default_putget_bytes", - "//pw_dumb_io:facade", + "//pw_sys_io:default_putget_bytes", + "//pw_sys_io:facade", ], )
diff --git a/pw_dumb_io_stdio/BUILD.gn b/pw_sys_io_stdio/BUILD.gn similarity index 80% rename from pw_dumb_io_stdio/BUILD.gn rename to pw_sys_io_stdio/BUILD.gn index 82e4c78..a683ab9 100644 --- a/pw_dumb_io_stdio/BUILD.gn +++ b/pw_sys_io_stdio/BUILD.gn
@@ -16,13 +16,13 @@ # This if statement allows docs to always build even if the target isn't # compatible with this backend. -if (dir_pw_dumb_io_backend == dir_pw_dumb_io_stdio) { - source_set("pw_dumb_io_stdio") { +if (dir_pw_sys_io_backend == dir_pw_sys_io_stdio) { + source_set("pw_sys_io_stdio") { deps = [ - "$dir_pw_dumb_io:default_putget_bytes", - "$dir_pw_dumb_io:facade", + "$dir_pw_sys_io:default_putget_bytes", + "$dir_pw_sys_io:facade", ] - sources = [ "dumb_io.cc" ] + sources = [ "sys_io.cc" ] } }
diff --git a/pw_dumb_io_stdio/CMakeLists.txt b/pw_sys_io_stdio/CMakeLists.txt similarity index 71% rename from pw_dumb_io_stdio/CMakeLists.txt rename to pw_sys_io_stdio/CMakeLists.txt index 696b0a7..5b76f64 100644 --- a/pw_dumb_io_stdio/CMakeLists.txt +++ b/pw_sys_io_stdio/CMakeLists.txt
@@ -12,11 +12,11 @@ # License for the specific language governing permissions and limitations under # the License. -pw_auto_add_simple_module(pw_dumb_io_stdio +pw_auto_add_simple_module(pw_sys_io_stdio IMPLEMENTS_FACADE - pw_dumb_io + pw_sys_io ) -# TODO(hepler): Declare pw_dumb_io_stdio as the pw_dumb_io backend for now. -add_library(pw_dumb_io.backend INTERFACE) -target_link_libraries(pw_dumb_io.backend INTERFACE pw_dumb_io_stdio) +# TODO(hepler): Declare pw_sys_io_stdio as the pw_sys_io backend for now. +add_library(pw_sys_io.backend INTERFACE) +target_link_libraries(pw_sys_io.backend INTERFACE pw_sys_io_stdio)
diff --git a/pw_sys_io_stdio/docs.rst b/pw_sys_io_stdio/docs.rst new file mode 100644 index 0000000..553efbf --- /dev/null +++ b/pw_sys_io_stdio/docs.rst
@@ -0,0 +1,39 @@ +.. _chapter-pw-sys-io-stdio: + +.. default-domain:: cpp + +.. highlight:: sh + +--------------- +pw_sys_io_stdio +--------------- +The ``pw_sys_io_stdio`` backend implements the ``pw_sys_io`` facade using +stdio. + +Why not just use stdio directly? +-------------------------------- + +The nice thing about using ``pw_sys_io`` is that it's rather easy to get a +board up and running with a target-specific backend. This means when drafting +out a quick application you can write it against ``pw_sys_io`` and, with some +care, the application will be able to run on both host and target devices. + +While it's not recommended to use ``pw_sys_io`` for any production +applications, it can be rather helpful for early prototyping. + +Setup +===== +This module requires relatively minimal setup: + + 1. Write code against the ``pw_sys_io`` facade. + 2. Specify the ``dir_pw_sys_io_backend`` GN global variable to point to this + backend. + +Module usage +============ +For the most part, applications built with this backend will behave similarly +to an application built directly against stdio. + +Dependencies +============ + * pw_sys_io facade
diff --git a/pw_dumb_io_stdio/dumb_io.cc b/pw_sys_io_stdio/sys_io.cc similarity index 94% rename from pw_dumb_io_stdio/dumb_io.cc rename to pw_sys_io_stdio/sys_io.cc index 66a1f45..72e4df6 100644 --- a/pw_dumb_io_stdio/dumb_io.cc +++ b/pw_sys_io_stdio/sys_io.cc
@@ -12,11 +12,11 @@ // License for the specific language governing permissions and limitations under // the License. -#include "pw_dumb_io/dumb_io.h" +#include "pw_sys_io/sys_io.h" #include <cstdio> -namespace pw::dumb_io { +namespace pw::sys_io { Status ReadByte(std::byte* dest) { if (dest == nullptr) { @@ -55,4 +55,4 @@ return StatusWithSize(result, chars_written); } -} // namespace pw::dumb_io +} // namespace pw::sys_io
diff --git a/pw_unit_test/BUILD b/pw_unit_test/BUILD index c4d51f4..053653c 100644 --- a/pw_unit_test/BUILD +++ b/pw_unit_test/BUILD
@@ -81,7 +81,7 @@ deps = [ ":pw_unit_test", ":simple_printing_event_handler", - "//pw_dumb_io", + "//pw_sys_io", ], )
diff --git a/pw_unit_test/BUILD.gn b/pw_unit_test/BUILD.gn index 0906df2..4283c14 100644 --- a/pw_unit_test/BUILD.gn +++ b/pw_unit_test/BUILD.gn
@@ -55,7 +55,7 @@ public_deps = [ ":pw_unit_test" ] deps = [ ":simple_printing_event_handler", - "$dir_pw_dumb_io", + "$dir_pw_sys_io", ] sources = [ "simple_printing_main.cc" ] } @@ -76,7 +76,7 @@ public_deps = [ ":pw_unit_test" ] deps = [ ":logging_event_handler", - "$dir_pw_dumb_io", + "$dir_pw_sys_io", ] sources = [ "logging_main.cc" ] }
diff --git a/pw_unit_test/CMakeLists.txt b/pw_unit_test/CMakeLists.txt index 7a7e262..3767b4e 100644 --- a/pw_unit_test/CMakeLists.txt +++ b/pw_unit_test/CMakeLists.txt
@@ -32,6 +32,6 @@ pw_unit_test PRIVATE_DEPS pw_preprocessor - pw_dumb_io pw_string + pw_sys_io )
diff --git a/pw_unit_test/simple_printing_main.cc b/pw_unit_test/simple_printing_main.cc index 96fb4db..859f5f8 100644 --- a/pw_unit_test/simple_printing_main.cc +++ b/pw_unit_test/simple_printing_main.cc
@@ -14,8 +14,8 @@ #include <string_view> -#include "pw_dumb_io/dumb_io.h" #include "pw_span/span.h" +#include "pw_sys_io/sys_io.h" #include "pw_unit_test/framework.h" #include "pw_unit_test/simple_printing_event_handler.h" @@ -23,9 +23,9 @@ pw::unit_test::SimplePrintingEventHandler handler( [](const std::string_view& s, bool append_newline) { if (append_newline) { - pw::dumb_io::WriteLine(s); + pw::sys_io::WriteLine(s); } else { - pw::dumb_io::WriteBytes(pw::as_bytes(pw::span(s))); + pw::sys_io::WriteBytes(pw::as_bytes(pw::span(s))); } });
diff --git a/pw_vars_default.gni b/pw_vars_default.gni index b7c9ae4..6de484f 100644 --- a/pw_vars_default.gni +++ b/pw_vars_default.gni
@@ -103,12 +103,12 @@ # Backend for the pw_cpu_exception module. dir_pw_cpu_exception_backend = "" -# Backend for the pw_dumb_io module. -dir_pw_dumb_io_backend = "" - # Backend for the pw_log module. dir_pw_log_backend = "" +# Backend for the pw_sys_io module. +dir_pw_sys_io_backend = "" + ############################## MODULE CONFIGS ################################## # Module configuration options for pw_boot_armv7m.
diff --git a/targets/host/host_common.gni b/targets/host/host_common.gni index 4a890c3..bfe5db2 100644 --- a/targets/host/host_common.gni +++ b/targets/host/host_common.gni
@@ -24,8 +24,8 @@ # Configure backend for assert facade. dir_pw_assert_backend = "$dir_pw_assert_basic" -# Configure backend for pw_dumb_io facade. -dir_pw_dumb_io_backend = "$dir_pw_dumb_io_stdio" - # Configure backend for logging facade. dir_pw_log_backend = "$dir_pw_log_basic" + +# Configure backend for pw_sys_io facade. +dir_pw_sys_io_backend = "$dir_pw_sys_io_stdio"
diff --git a/targets/stm32f429i-disc1/target_config.gni b/targets/stm32f429i-disc1/target_config.gni index 0e589b1..582f18d 100644 --- a/targets/stm32f429i-disc1/target_config.gni +++ b/targets/stm32f429i-disc1/target_config.gni
@@ -15,7 +15,7 @@ # Target configuration for the STM32f429I-DISC1 development board. # # TODO(amontanez): This target configuration treats -# pw_dumb_io_baremetal_stm32f429 as if it were a platform. This is for +# pw_sys_io_baremetal_stm32f429 as if it were a platform. This is for # testing/development and should eventually point to something more # sophisticated. @@ -44,7 +44,7 @@ if (!defined(deps)) { deps = [] } - deps += [ dir_pw_dumb_io_baremetal_stm32f429 ] + deps += [ dir_pw_sys_io_baremetal_stm32f429 ] } } @@ -64,8 +64,8 @@ dir_pw_assert_backend = dir_pw_assert_basic dir_pw_boot_backend = dir_pw_boot_armv7m dir_pw_cpu_exception_backend = dir_pw_cpu_exception_armv7m -dir_pw_dumb_io_backend = dir_pw_dumb_io_baremetal_stm32f429 dir_pw_log_backend = dir_pw_log_basic +dir_pw_sys_io_backend = dir_pw_sys_io_baremetal_stm32f429 pw_boot_armv7m_config.defines += [ "PW_BOOT_FLASH_BEGIN=0x08000200",