diff options
-rw-r--r-- | BUILD.gn | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | docs/BUILD.gn | 6 | ||||
-rw-r--r-- | modules.gni | 7 | ||||
-rw-r--r-- | pw_assert_basic/BUILD | 2 | ||||
-rw-r--r-- | pw_assert_basic/BUILD.gn | 2 | ||||
-rw-r--r-- | pw_assert_basic/CMakeLists.txt | 2 | ||||
-rw-r--r-- | pw_assert_basic/assert_basic.cc | 6 | ||||
-rw-r--r-- | pw_boot_armv7m/BUILD | 2 | ||||
-rw-r--r-- | pw_cpu_exception_armv7m/BUILD.gn | 2 | ||||
-rw-r--r-- | pw_log_basic/BUILD | 2 | ||||
-rw-r--r-- | pw_log_basic/BUILD.gn | 2 | ||||
-rw-r--r-- | pw_log_basic/CMakeLists.txt | 2 | ||||
-rw-r--r-- | pw_log_basic/log_basic.cc | 4 | ||||
-rw-r--r-- | pw_sys_io/BUILD (renamed from pw_dumb_io/BUILD) | 14 | ||||
-rw-r--r-- | pw_sys_io/BUILD.gn (renamed from pw_dumb_io/BUILD.gn) | 8 | ||||
-rw-r--r-- | pw_sys_io/CMakeLists.txt (renamed from pw_dumb_io/CMakeLists.txt) | 4 | ||||
-rw-r--r-- | pw_sys_io/docs.rst (renamed from pw_dumb_io/docs.rst) | 19 | ||||
-rw-r--r-- | pw_sys_io/public/pw_sys_io/sys_io.h (renamed from pw_dumb_io/public/pw_dumb_io/dumb_io.h) | 20 | ||||
-rw-r--r-- | pw_sys_io/sys_io.cc (renamed from pw_dumb_io/dumb_io.cc) | 6 | ||||
-rw-r--r-- | pw_sys_io_baremetal_stm32f429/BUILD (renamed from pw_dumb_io_baremetal_stm32f429/BUILD) | 4 | ||||
-rw-r--r-- | pw_sys_io_baremetal_stm32f429/BUILD.gn (renamed from pw_dumb_io_baremetal_stm32f429/BUILD.gn) | 10 | ||||
-rw-r--r-- | pw_sys_io_baremetal_stm32f429/docs.rst (renamed from pw_dumb_io_baremetal_stm32f429/docs.rst) | 20 | ||||
-rw-r--r-- | pw_sys_io_baremetal_stm32f429/sys_io_baremetal.cc (renamed from pw_dumb_io_baremetal_stm32f429/dumb_io_baremetal.cc) | 8 | ||||
-rw-r--r-- | pw_sys_io_stdio/BUILD (renamed from pw_dumb_io_stdio/BUILD) | 8 | ||||
-rw-r--r-- | pw_sys_io_stdio/BUILD.gn (renamed from pw_dumb_io_stdio/BUILD.gn) | 10 | ||||
-rw-r--r-- | pw_sys_io_stdio/CMakeLists.txt (renamed from pw_dumb_io_stdio/CMakeLists.txt) | 10 | ||||
-rw-r--r-- | pw_sys_io_stdio/docs.rst (renamed from pw_dumb_io_stdio/docs.rst) | 22 | ||||
-rw-r--r-- | pw_sys_io_stdio/sys_io.cc (renamed from pw_dumb_io_stdio/dumb_io.cc) | 6 | ||||
-rw-r--r-- | pw_unit_test/BUILD | 2 | ||||
-rw-r--r-- | pw_unit_test/BUILD.gn | 4 | ||||
-rw-r--r-- | pw_unit_test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | pw_unit_test/simple_printing_main.cc | 6 | ||||
-rw-r--r-- | pw_vars_default.gni | 6 | ||||
-rw-r--r-- | targets/host/host_common.gni | 6 | ||||
-rw-r--r-- | targets/stm32f429i-disc1/target_config.gni | 6 |
36 files changed, 123 insertions, 123 deletions
@@ -43,7 +43,7 @@ group("host_tools") { 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 c9e6b7d06..3631ad956 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,6 @@ add_subdirectory(pw_checksum) 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_preprocessor) 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 8d5b7c8ed..5bc0f00b8 100644 --- a/docs/BUILD.gn +++ b/docs/BUILD.gn @@ -46,9 +46,6 @@ pw_doc_gen("docs") { "$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 @@ pw_doc_gen("docs") { "$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 6138f24c5..ddc253fde 100644 --- a/modules.gni +++ b/modules.gni @@ -28,10 +28,6 @@ dir_pw_cpu_exception = "$dir_pigweed/pw_cpu_exception" 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_protobuf_compiler = "$dir_pigweed/pw_protobuf_compiler" 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 6a04d08fc..418de2442 100644 --- a/pw_assert_basic/BUILD +++ b/pw_assert_basic/BUILD @@ -35,8 +35,8 @@ pw_cc_library( "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 dab76066f..9b39a97f8 100644 --- a/pw_assert_basic/BUILD.gn +++ b/pw_assert_basic/BUILD.gn @@ -36,9 +36,9 @@ source_set("core") { 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 432e5f92b..7e6c46aef 100644 --- a/pw_assert_basic/CMakeLists.txt +++ b/pw_assert_basic/CMakeLists.txt @@ -16,9 +16,9 @@ pw_auto_add_simple_module(pw_assert_basic 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 b6abdb101..3046ba636 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 @@ static const char* kCrashBanner[] = { " ", }; -using pw::dumb_io::WriteLine; +using pw::sys_io::WriteLine; typedef pw::StringBuffer<150> Buffer; @@ -104,7 +104,7 @@ extern "C" void pw_Crash(const char* file_name, 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 0c7862720..0980c0a20 100644 --- a/pw_boot_armv7m/BUILD +++ b/pw_boot_armv7m/BUILD @@ -17,7 +17,7 @@ package(default_visibility = ["//visibility:public"]) 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 d627ab7f0..a23a39629 100644 --- a/pw_cpu_exception_armv7m/BUILD.gn +++ b/pw_cpu_exception_armv7m/BUILD.gn @@ -27,8 +27,8 @@ if (dir_pw_cpu_exception_backend == dir_pw_cpu_exception_armv7m) { 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_log_basic/BUILD b/pw_log_basic/BUILD index fd9105df6..ad7ac0719 100644 --- a/pw_log_basic/BUILD +++ b/pw_log_basic/BUILD @@ -35,8 +35,8 @@ pw_cc_library( "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 2b895ace6..0efa82dd1 100644 --- a/pw_log_basic/BUILD.gn +++ b/pw_log_basic/BUILD.gn @@ -35,10 +35,10 @@ if (dir_pw_log_backend == dir_pw_log_basic) { 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 c85276d13..5c66fe041 100644 --- a/pw_log_basic/CMakeLists.txt +++ b/pw_log_basic/CMakeLists.txt @@ -16,8 +16,8 @@ pw_auto_add_simple_module(pw_log_basic 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 c586830a8..e67d6d134 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 @@ extern "C" void pw_Log(int level, 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 index a25a8451f..11e8201c6 100644 --- a/pw_dumb_io/BUILD +++ b/pw_sys_io/BUILD @@ -23,7 +23,7 @@ licenses(["notice"]) 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( 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( ) 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 index b451afa04..0c48cf65d 100644 --- a/pw_dumb_io/BUILD.gn +++ b/pw_sys_io/BUILD.gn @@ -19,19 +19,19 @@ config("default_config") { 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 index 182890430..7ca3860d9 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 index a431f202e..38b5ef78f 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 @@ Setup ===== 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 index 8f7ce70a8..3010de1ff 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 @@ Status WriteByte(std::byte b); // 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 @@ StatusWithSize WriteLine(const std::string_view& s); // 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 @@ StatusWithSize ReadBytes(span<std::byte> dest); // 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 index 26b9f620e..ed0ab5c5a 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 @@ StatusWithSize WriteBytes(span<const std::byte> src) { 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 index 595b3c44a..42f5c32b5 100644 --- a/pw_dumb_io_baremetal_stm32f429/BUILD +++ b/pw_sys_io_baremetal_stm32f429/BUILD @@ -17,8 +17,8 @@ package(default_visibility = ["//visibility:public"]) 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 index bdd2aedec..5bff1c206 100644 --- a/pw_dumb_io_baremetal_stm32f429/BUILD.gn +++ b/pw_sys_io_baremetal_stm32f429/BUILD.gn @@ -16,15 +16,15 @@ import("$dir_pw_docgen/docs.gni") # 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 index b47b88ced..934deca7f 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 @@ 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 + 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 @@ Sample connection diagram 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 index 1810d28bc..3b7415ac3 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 @@ extern "C" void pw_PreMainInit() { #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 @@ Status WriteByte(std::byte b) { 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 @@ StatusWithSize WriteLine(const std::string_view& s) { 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 index 0f8da676f..333bd540e 100644 --- a/pw_dumb_io_stdio/BUILD +++ b/pw_sys_io_stdio/BUILD @@ -22,10 +22,10 @@ package(default_visibility = ["//visibility:public"]) 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 index 82e4c78c3..a683ab90d 100644 --- a/pw_dumb_io_stdio/BUILD.gn +++ b/pw_sys_io_stdio/BUILD.gn @@ -16,13 +16,13 @@ import("$dir_pw_docgen/docs.gni") # 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 index 696b0a7fb..5b76f6447 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_dumb_io_stdio/docs.rst b/pw_sys_io_stdio/docs.rst index c97a16b57..553efbfa3 100644 --- a/pw_dumb_io_stdio/docs.rst +++ b/pw_sys_io_stdio/docs.rst @@ -1,32 +1,32 @@ -.. _chapter-pw-dumb-io-stdio: +.. _chapter-pw-sys-io-stdio: .. default-domain:: cpp .. highlight:: sh ----------------- -pw_dumb_io_stdio ----------------- -The ``pw_dumb_io_stdio`` backend implements the ``pw_dumb_io`` facade using +--------------- +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_dumb_io`` is that it's rather easy to get a +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_dumb_io`` and, with some +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_dumb_io`` for any production +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_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. Module usage @@ -36,4 +36,4 @@ to an application built directly against stdio. Dependencies ============ - * pw_dumb_io facade + * pw_sys_io facade diff --git a/pw_dumb_io_stdio/dumb_io.cc b/pw_sys_io_stdio/sys_io.cc index 66a1f45f8..72e4df624 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 @@ StatusWithSize WriteLine(const std::string_view& s) { 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 c4d51f49f..053653c65 100644 --- a/pw_unit_test/BUILD +++ b/pw_unit_test/BUILD @@ -81,7 +81,7 @@ pw_cc_library( 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 0906df2f2..4283c1438 100644 --- a/pw_unit_test/BUILD.gn +++ b/pw_unit_test/BUILD.gn @@ -55,7 +55,7 @@ source_set("simple_printing_main") { 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 @@ if (dir_pw_log_backend != "") { 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 7a7e26270..3767b4eff 100644 --- a/pw_unit_test/CMakeLists.txt +++ b/pw_unit_test/CMakeLists.txt @@ -32,6 +32,6 @@ pw_add_module_library(pw_unit_test.main 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 96fb4dbd7..859f5f878 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 @@ int main() { 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 b7c9ae48e..6de484f35 100644 --- a/pw_vars_default.gni +++ b/pw_vars_default.gni @@ -103,12 +103,12 @@ dir_pw_boot_backend = "" # 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 4a890c369..bfe5db294 100644 --- a/targets/host/host_common.gni +++ b/targets/host/host_common.gni @@ -24,8 +24,8 @@ pw_unit_test_main = "$dir_pw_unit_test:logging_main" # 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 0e589b159..582f18d39 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 @@ template("stm32f429i_executable") { if (!defined(deps)) { deps = [] } - deps += [ dir_pw_dumb_io_baremetal_stm32f429 ] + deps += [ dir_pw_sys_io_baremetal_stm32f429 ] } } @@ -64,8 +64,8 @@ if (pw_use_test_server) { 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", |