Example Pico builds working pw_sys_io_pico
- Added pico_core_sources and pico_executable
- pico_base toolchain for building bs2_default.elf
- pw_sys_io_pico hooked up but not working in blinky yet
Still need to call pw_pico_Init() on start
- pw_sys_io_pico over usb serial works
But blinky/main.cc needs to manually call pw_sys_io_pico_Init();
Change-Id: I5b2c2e5a2528a0b36c7572b5921d781b6eb811ff
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9bdb44e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,50 @@
+# Build
+out/
+outcmake/
+.presubmit/
+compile_commands.json
+
+# Environment
+.environment/
+
+# Editors
+.idea/
+.project
+.cproject
+.vscode
+.clangd/
+*.swp
+*.swo
+.#*
+
+# Python
+python*-env/
+.python*-env/
+venv/
+*.pyc
+*.egg/
+*.eggs/
+*.egg-info/
+.cache/
+.mypy_cache/
+__pycache__/
+
+# Mac
+.DS_Store
+
+# GDB
+.gdb_history
+
+# Git
+*.orig
+*.BACKUP.*
+*.BASE.*
+*.LOCAL.*
+*.REMOTE.*
+*_BACKUP_*.txt
+*_BASE_*.txt
+*_LOCAL_*.txt
+*_REMOTE_*.txt
+
+# Other
+logfile.txt
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..4219bc8
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,9 @@
+[submodule "third_party/pico-extras"]
+ path = third_party/pico-extras
+ url = https://github.com/raspberrypi/pico-extras.git
+[submodule "third_party/pico-sdk"]
+ path = third_party/pico-sdk
+ url = https://github.com/raspberrypi/pico-sdk.git
+[submodule "third_party/pigweed"]
+ path = third_party/pigweed
+ url = https://pigweed.googlesource.com/pigweed/pigweed
diff --git a/.gn b/.gn
new file mode 100644
index 0000000..4a6a9cc
--- /dev/null
+++ b/.gn
@@ -0,0 +1,18 @@
+# Copyright 2021 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.
+
+buildconfig = "//BUILDCONFIG.gn"
+
+default_args = {
+}
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..8d57764
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,65 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+import("$dir_pw_tokenizer/database.gni")
+import("$dir_pw_unit_test/test.gni")
+
+# Lists all the targets build by default with e.g. `ninja -C out`.
+group("default") {
+ deps = [
+ ":host",
+ ":pico",
+ ":python",
+
+ # ":python.lint",
+ # ":python.tests",
+ ]
+}
+
+# Group all targets that run on host only, e.g. tests, utils.
+group("host") {
+ deps = [
+ # No host tests yet
+ # ":host_tests(//targets/host:host_debug_tests)"
+ # "//applications/blinky:blinky(//targets/host:host_debug)",
+
+ # elf2uf2 Host tool
+ "//third_party/elf2uf2:elf2uf2(//targets/host:host_debug)",
+ ]
+}
+
+group("pico") {
+ deps = [
+ # Typical pico executables use the pico_debug toolchain.
+ "//applications/blinky:blinky(//targets/pico:pico_debug)",
+ "//pico_build(//targets/pico:pico_debug)",
+
+ # bs2_default uses the pico_base_debug toolchain.
+ "//pico_build/bs2_default(//targets/pico_base:pico_base_debug)",
+ ]
+}
+
+# Python packages are built using the host toolchain.
+pw_python_group("python") {
+ # This depends on the 'tools' target in //tools/BUILD.gn
+ python_deps = [
+ "tools",
+ "//pico_build/py:py",
+ "//third_party/pigweed/pw_env_setup:python",
+ "//third_party/pigweed/pw_env_setup:target_support_packages",
+ ]
+}
diff --git a/BUILDCONFIG.gn b/BUILDCONFIG.gn
new file mode 100644
index 0000000..d798e4a
--- /dev/null
+++ b/BUILDCONFIG.gn
@@ -0,0 +1,28 @@
+# Copyright 2021 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.
+
+# This is imported into a scope so as not to pollute the global variable space.
+_pigweed_directory = {
+ import("//build_overrides/pigweed.gni")
+}
+
+declare_args() {
+ dir_third_party_pico_sdk = "//third_party/pico-sdk"
+ dir_third_party_pico_extras = "//third_party/pico-extras"
+}
+
+# The default toolchain is not used in Pigweed builds, so it is set to an empty
+# toolchain. The top-level BUILD.gn should stamp a group with all of the build
+# targets and their toolchains.
+set_default_toolchain("${_pigweed_directory.dir_pw_toolchain}/default")
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..dcd2316
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required(VERSION 3.13)
+
+include(pico_sdk_import.cmake)
+
+project(picohellousbserial C CXX ASM)
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+if (PICO_SDK_VERSION_STRING VERSION_LESS "1.3.0")
+ message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.3.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
+endif()
+
+# initialize the Raspberry Pi Pico SDK
+pico_sdk_init()
+
+add_compile_options(-Wall
+ -Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
+ -Wno-unused-function # we have some for the docs that aren't called
+ -Wno-maybe-uninitialized
+ )
+
+
+if (TARGET tinyusb_device)
+ add_executable(hello_usb
+ hello_usb.c
+ )
+
+ # pull in common dependencies
+ target_link_libraries(hello_usb pico_stdlib)
+
+ # enable usb output, disable uart output
+ pico_enable_stdio_usb(hello_usb 1)
+ pico_enable_stdio_uart(hello_usb 0)
+
+ # create map/bin/hex/uf2 file etc.
+ pico_add_extra_outputs(hello_usb)
+
+ # add url via pico_set_program_url
+ # example_auto_set_url(hello_usb)
+
+elseif(PICO_ON_DEVICE)
+ message(WARNING "not building hello_usb because TinyUSB submodule is not initialized in the SDK")
+endif()
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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
+
+ http://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.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b21708b
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# picohellousb
\ No newline at end of file
diff --git a/activate.bat b/activate.bat
new file mode 100644
index 0000000..303ce4f
--- /dev/null
+++ b/activate.bat
@@ -0,0 +1,31 @@
+:<<"::WINDOWS_ONLY"
+@echo off
+:: Copyright 2021 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.
+::WINDOWS_ONLY
+:; echo "ERROR: Attempting to run Windows .bat from a Unix/POSIX shell!"
+:; echo "Instead, run the following command."
+:; echo ""
+:; echo " source ./activate.sh"
+:; echo ""
+:<<"::WINDOWS_ONLY"
+
+:: First, activate the development environment.
+set PW_SKIP_BOOTSTRAP=1
+call "%~dp0\bootstrap.bat"
+set PW_SKIP_BOOTSTRAP=
+
+:: Add user-defined environment configuration here.
+
+::WINDOWS_ONLY
diff --git a/activate.sh b/activate.sh
new file mode 120000
index 0000000..eba5389
--- /dev/null
+++ b/activate.sh
@@ -0,0 +1 @@
+bootstrap.sh
\ No newline at end of file
diff --git a/applications/blinky/BUILD.gn b/applications/blinky/BUILD.gn
new file mode 100644
index 0000000..757068b
--- /dev/null
+++ b/applications/blinky/BUILD.gn
@@ -0,0 +1,30 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+pw_executable("blinky") {
+ sources = [ "main.cc" ]
+ deps = [
+ "$dir_pw_log",
+
+ # The assert backend is defined in the toolchain with `pw_assert_BACKEND`.
+ "$dir_pw_assert",
+ "$dir_pw_board_led",
+ "$dir_pw_spin_delay",
+ "$dir_pw_sys_io_pico",
+ ]
+}
diff --git a/applications/blinky/main.cc b/applications/blinky/main.cc
new file mode 100644
index 0000000..bc31973
--- /dev/null
+++ b/applications/blinky/main.cc
@@ -0,0 +1,37 @@
+// Copyright 2021 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 "pw_board_led/led.h"
+#include "pw_log/log.h"
+#include "pw_spin_delay/delay.h"
+#include "pw_sys_io_pico/init.h"
+
+int main() {
+ pw_sys_io_pico_Init();
+
+ pw::board_led::Init();
+ int i = 0;
+
+ while (true) {
+ PW_LOG_INFO("Blink %d", i++);
+
+ pw::board_led::TurnOn();
+ pw::spin_delay::WaitMillis(1000);
+
+ pw::board_led::TurnOff();
+ pw::spin_delay::WaitMillis(1000);
+ }
+
+ return 0;
+}
diff --git a/banner.txt b/banner.txt
new file mode 100644
index 0000000..7a6b653
--- /dev/null
+++ b/banner.txt
@@ -0,0 +1,2 @@
+[1m[35m ╱╱╱ [1m[35m█▀█ █░█░█ █▀▀ ▀▄▀ █▀█ █▀▀ █▀█ █ █▀▄▀█ █▀▀ █▄░█ ▀█▀ ▄▀█ █░░
+[1m[35m ╱╱╱ [1m[35m█▀▀ ▀▄▀▄▀ ██▄ █░█ █▀▀ ██▄ █▀▄ █ █░▀░█ ██▄ █░▀█ ░█░ █▀█ █▄▄
diff --git a/bootstrap.bat b/bootstrap.bat
new file mode 100644
index 0000000..3ded860
--- /dev/null
+++ b/bootstrap.bat
@@ -0,0 +1,50 @@
+:<<"::WINDOWS_ONLY"
+@echo off
+:: Copyright 2021 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.
+::WINDOWS_ONLY
+:; echo "ERROR: Attempting to run Windows .bat from a Unix/POSIX shell!"
+:; echo "Instead, run the following command."
+:; echo ""
+:; echo " source ./activate.sh"
+:; echo ""
+:<<"::WINDOWS_ONLY"
+
+:: The bootstrap.bat must be run initially to install all required programs.
+:: After that, use activate.bat to enter the environment in a shell.
+
+:: First, activate the Pigweed development environment.
+set "_pw_bootstrap_script=%~dp0.\third_party\pigweed\bootstrap.bat"
+set "PW_PROJECT_ROOT=%~dp0."
+set "PIGWEED_EXPERIMENTAL_ROOT=%PW_PROJECT_ROOT%"
+
+:: Set your project's banner and color.
+set "PW_BRANDING_BANNER=%PW_PROJECT_ROOT%\banner.txt"
+set "PW_BRANDING_BANNER_COLOR=cyan"
+
+if not exist "%_pw_bootstrap_script%" (
+ echo Error: "%_pw_bootstrap_script%" not found.
+ echo Did you forget to initialize the git submodules?
+ echo To setup the git submodules run:
+ echo git submodule init
+ echo git submodule update
+ goto finish
+)
+
+call "%_pw_bootstrap_script%"
+
+:: Add user-defined initial setup here.
+
+:finish
+::WINDOWS_ONLY
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100755
index 0000000..fce93af
--- /dev/null
+++ b/bootstrap.sh
@@ -0,0 +1,134 @@
+# Copyright 2021 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.
+
+# This script must be sourced, not executed.
+#
+# Create a new environment:
+#
+# source bootstrap.sh
+#
+# Activate an existing environment:
+#
+# source activate.sh
+
+_bootstrap_abspath () {
+ $(command -v python3 || command -v python2 || command -v python) -c "import os.path; print(os.path.abspath('$@'))"
+}
+
+# Shell: bash.
+if test -n "$BASH"; then
+ _BOOTSTRAP_PATH="$(_bootstrap_abspath "$BASH_SOURCE")"
+# Shell: zsh.
+elif test -n "$ZSH_NAME"; then
+ _BOOTSTRAP_PATH="$(_bootstrap_abspath "${(%):-%N}")"
+# Shell: dash.
+elif test ${0##*/} = dash; then
+ _BOOTSTRAP_PATH="$(_bootstrap_abspath \
+ "$(lsof -p $$ -Fn0 | tail -1 | sed 's#^[^/]*##;')")"
+# If everything else fails, try $0. It could work.
+else
+ _BOOTSTRAP_PATH="$(_bootstrap_abspath "$0")"
+fi
+
+# Check if this file is being executed or sourced.
+_pw_sourced=0
+if [ -n "$SWARMING_BOT_ID" ]; then
+ # If set we're running on swarming and don't need this check.
+ _pw_sourced=1
+elif [ -n "$ZSH_EVAL_CONTEXT" ]; then
+ case $ZSH_EVAL_CONTEXT in *:file) _pw_sourced=1;; esac
+elif [ -n "$KSH_VERSION" ]; then
+ [ "$(cd $(dirname -- $0) && pwd -P)/$(basename -- $0)" != \
+ "$(cd $(dirname -- ${.sh.file}) && pwd -P)/$(basename -- ${.sh.file})" ] \
+ && _pw_sourced=1
+elif [ -n "$BASH_VERSION" ]; then
+ (return 0 2>/dev/null) && _pw_sourced=1
+else # All other shells: examine $0 for known shell binary filenames
+ # Detects `sh` and `dash`; add additional shell filenames as needed.
+ case ${0##*/} in sh|dash) _pw_sourced=1;; esac
+fi
+
+# Downstream projects need to set something other than PW_ROOT here, like
+# YOUR_PROJECT_ROOT. Please also set PW_PROJECT_ROOT and PW_ROOT before
+# invoking pw_bootstrap or pw_activate.
+######### BEGIN PROJECT-SPECIFIC CODE #########
+PIGWEED_EXPERIMENTAL_ROOT="$(_bootstrap_abspath "$(dirname "$_BOOTSTRAP_PATH")")"
+export PIGWEED_EXPERIMENTAL_ROOT
+PW_PROJECT_ROOT="$PIGWEED_EXPERIMENTAL_ROOT"
+PW_ROOT="$PIGWEED_EXPERIMENTAL_ROOT/third_party/pigweed"
+
+# Set your project's banner and color.
+export PW_BRANDING_BANNER="$PIGWEED_EXPERIMENTAL_ROOT/banner.txt"
+export PW_BRANDING_BANNER_COLOR=magenta
+
+PIGWEED_EXPERIMENTAL_banner() {
+ cat "$PW_BRANDING_BANNER"
+ echo
+}
+
+PW_BANNER_FUNC="PIGWEED_EXPERIMENTAL_banner"
+########## END PROJECT-SPECIFIC CODE ##########
+export PW_BANNER_FUNC
+export PW_PROJECT_ROOT
+export PW_ROOT
+
+_util_sh="$PW_ROOT/pw_env_setup/util.sh"
+
+# Double-check that the Pigweed submodule has been checked out.
+if [ ! -e "$_util_sh" ]; then
+ echo "Error: $_util_sh not found."
+ echo "Did you forget to initialize the git submodules?"
+ echo "To setup the git submodules run:"
+ echo " git submodule update --init"
+ return
+fi
+
+. "$_util_sh"
+
+pw_deactivate
+pw_eval_sourced "$_pw_sourced"
+pw_check_root "$PW_ROOT"
+_PW_ACTUAL_ENVIRONMENT_ROOT="$(pw_get_env_root)"
+export _PW_ACTUAL_ENVIRONMENT_ROOT
+SETUP_SH="$_PW_ACTUAL_ENVIRONMENT_ROOT/activate.sh"
+
+export PICO_SDK_PATH=$PIGWEED_EXPERIMENTAL_ROOT/third_party/pico-sdk
+export PICO_EXTRAS_PATH=$PIGWEED_EXPERIMENTAL_ROOT/third_party/pico-extras
+
+# Run full bootstrap when invoked as bootstrap, or env file is missing/empty.
+if [ "$(basename "$_BOOTSTRAP_PATH")" = "bootstrap.sh" ] || \
+ [ ! -f "$SETUP_SH" ] || \
+ [ ! -s "$SETUP_SH" ]; then
+# This is where pw_bootstrap is called. Most small projects will include
+# --use-pigweed-defaults.
+######### BEGIN PROJECT-SPECIFIC CODE #########
+ pw_bootstrap --shell-file "$SETUP_SH" --install-dir "$_PW_ACTUAL_ENVIRONMENT_ROOT" --config-file "$PW_PROJECT_ROOT/env_setup.json"
+########## END PROJECT-SPECIFIC CODE ##########
+ pw_finalize bootstrap "$SETUP_SH"
+else
+ pw_activate
+ pw_finalize activate "$SETUP_SH"
+fi
+
+# This is where any additional checks about the environment should go.
+######### BEGIN PROJECT-SPECIFIC CODE #########
+########## END PROJECT-SPECIFIC CODE ##########
+
+unset _pw_sourced
+unset _BOOTSTRAP_PATH
+unset SETUP_SH
+unset _bootstrap_abspath
+unset _util_sh
+
+pw_cleanup
diff --git a/build_overrides/pigweed.gni b/build_overrides/pigweed.gni
new file mode 100644
index 0000000..dffa7a5
--- /dev/null
+++ b/build_overrides/pigweed.gni
@@ -0,0 +1,33 @@
+# Copyright 2021 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.
+
+declare_args() {
+ # Location of the Pigweed repository.
+ dir_pigweed = "//third_party/pigweed/"
+}
+
+# Upstream Pigweed modules.
+import("$dir_pigweed/modules.gni")
+
+# Experimental modules.
+declare_args() {
+ dir_pico_build = get_path_info("//pico_build", "abspath")
+ dir_pw_board_led = get_path_info("//pw_board_led", "abspath")
+ dir_pw_board_led_host = get_path_info("//pw_board_led_host", "abspath")
+ dir_pw_board_led_pico = get_path_info("//pw_board_led_pico", "abspath")
+ dir_pw_spin_delay = get_path_info("//pw_spin_delay", "abspath")
+ dir_pw_spin_delay_host = get_path_info("//pw_spin_delay_host", "abspath")
+ dir_pw_spin_delay_pico = get_path_info("//pw_spin_delay_pico", "abspath")
+ dir_pw_sys_io_pico = get_path_info("//pw_sys_io_pico", "abspath")
+}
diff --git a/buildcmake.sh b/buildcmake.sh
new file mode 100755
index 0000000..a8be8bd
--- /dev/null
+++ b/buildcmake.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+mkdir -p outcmake
+cd outcmake
+cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .. && make -j4
+
diff --git a/env_setup.json b/env_setup.json
new file mode 100644
index 0000000..fddf704
--- /dev/null
+++ b/env_setup.json
@@ -0,0 +1,60 @@
+{
+ "root_variable": "PIGWEED_EXPERIMENTAL_ROOT",
+ "cipd_package_files": [
+ "third_party/pigweed/pw_env_setup/py/pw_env_setup/cipd_setup/pigweed.json",
+ "third_party/pigweed/pw_env_setup/py/pw_env_setup/cipd_setup/bazel.json",
+ "third_party/pigweed/pw_env_setup/py/pw_env_setup/cipd_setup/python.json",
+ "third_party/pigweed/pw_env_setup/py/pw_env_setup/cipd_setup/luci.json"
+ ],
+ "virtualenv": {
+ "gn_root": ".",
+ "gn_targets": [
+ ":python.install"
+ ]
+ },
+ "optional_submodules": [
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32l0xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/tools/uf2",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_f3",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_l5",
+ "third_party/pico-sdk/lib/tinyusb/lib/CMSIS_5",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_f1",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_l4",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32f7xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_l1",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/silabs/cmsis-dfp-efm32gg12b",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32f1xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32l1xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/nxp/lpcopen",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_g0",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32g0xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32g4xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/nordic/nrfx",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/mindmotion/mm32sdk",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/gd/nuclei-sdk",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32f0xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_f7",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_h7",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32f4xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/renesas/rx",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/sony/cxd56/spresense-exported-sdk",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/ti",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_f0",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32l4xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/lib/sct_neopixel",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32l5xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32h7xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32f2xx_hal_driver",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_l0",
+ "third_party/pico-sdk/lib/tinyusb/lib/FreeRTOS-Kernel",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/nxp/nxp_sdk",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_f4",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/nxp/mcux-sdk",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_g4",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/cmsis_device_f2",
+ "third_party/pico-sdk/lib/tinyusb/lib/lwip",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/nuvoton",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/microchip",
+ "third_party/pico-sdk/lib/tinyusb/hw/mcu/st/stm32f3xx_hal_driver"
+ ]
+}
diff --git a/hello_usb.c b/hello_usb.c
new file mode 100644
index 0000000..f21dc3a
--- /dev/null
+++ b/hello_usb.c
@@ -0,0 +1,17 @@
+/**
+ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "pico/stdlib.h"
+#include <stdio.h>
+
+int main() {
+ stdio_init_all();
+ while (true) {
+ printf("Hello, world!\n");
+ sleep_ms(1000);
+ }
+ return 0;
+}
diff --git a/pico_build/BUILD.gn b/pico_build/BUILD.gn
new file mode 100644
index 0000000..cb34363
--- /dev/null
+++ b/pico_build/BUILD.gn
@@ -0,0 +1,7 @@
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+pw_executable("pico_build") {
+ sources = [ "//hello_usb.c" ]
+}
diff --git a/pico_build/bs2_default/BUILD.gn b/pico_build/bs2_default/BUILD.gn
new file mode 100644
index 0000000..89c0f2a
--- /dev/null
+++ b/pico_build/bs2_default/BUILD.gn
@@ -0,0 +1,58 @@
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+_pico_sdk_dir = rebase_path(dir_third_party_pico_sdk)
+
+pw_executable("bs2_default") {
+ defines = [
+ "PICO_H_LOCATION=\"${_pico_sdk_dir}/src/boards/include/boards/pico.h\"",
+ "RENAME_EXCEPTIONS_H_LOCATION=\"$_pico_sdk_dir/src/rp2_common/cmsis/include/cmsis/rename_exceptions.h\"",
+ "PICO_BOARD=\"pico\"",
+ "PICO_BUILD=1",
+ "PICO_NO_HARDWARE=0",
+ "PICO_ON_DEVICE=1",
+ ]
+ asmflags = [
+ "-mcpu=cortex-m0plus",
+ "-mthumb",
+ "-O3",
+ "-DNDEBUG",
+ ]
+ include_dirs = [
+ "${_pico_sdk_dir}/src/boards/include",
+ "${_pico_sdk_dir}/src/common/pico_base/include",
+ "${_pico_sdk_dir}/src/rp2040/hardware_regs/include",
+ "${_pico_sdk_dir}/src/rp2_common/boot_stage2/asminclude",
+ "${_pico_sdk_dir}/src/rp2_common/boot_stage2/include",
+ "${_pico_sdk_dir}/src/rp2_common/hardware_base/include",
+ "${_pico_sdk_dir}/src/rp2_common/pico_platform/include",
+ "$dir_pico_build/public_overrides",
+ ]
+ sources =
+ [ "${_pico_sdk_dir}/src/rp2_common/boot_stage2/compile_time_choice.S" ]
+ ldflags = [
+ "-Wl,--build-id=none",
+ "-nostartfiles",
+ "-Wl,--script=${_pico_sdk_dir}/src/rp2_common/boot_stage2/boot_stage2.ld",
+ "-Wl,-Map=bs2_default.elf.map",
+ ]
+}
+
+# Followup steps for bs2_default.elf
+
+# 1. arm-none-eabi-objdump -h bs2_default.elf >bs2_default.dis
+# 2. arm-none-eabi-objdump -d bs2_default.elf >>bs2_default.dis
+# 3. Generating bs2_default.bin
+# cd pico-sdk/src/rp2_common/boot_stage2 &&
+# ../../../../../.environment/cipd/pigweed/bin/arm-none-eabi-objcopy
+# -Obinary
+# /home/tonymd/pico/picohellousbserial/outcmake/pico-sdk/src/rp2_common/boot_stage2/bs2_default.elf
+# /home/tonymd/pico/picohellousbserial/outcmake/pico-sdk/src/rp2_common/boot_stage2/bs2_default.bin
+# 4. Generating bs2_default_padded_checksummed.S
+# cd pico-sdk/src/rp2_common/boot_stage2 &&
+# /usr/bin/python3.8
+# ./picohellousbserial/third_party/pico-sdk/src/rp2_common/boot_stage2/pad_checksum
+# -s 0xffffffff
+# ./picohellousbserial/outcmake/pico-sdk/src/rp2_common/boot_stage2/bs2_default.bin
+# ./picohellousbserial/outcmake/pico-sdk/src/rp2_common/boot_stage2/bs2_default_padded_checksummed.S
diff --git a/pico_build/bs2_default_padded_checksummed.S b/pico_build/bs2_default_padded_checksummed.S
new file mode 100644
index 0000000..d64917b
--- /dev/null
+++ b/pico_build/bs2_default_padded_checksummed.S
@@ -0,0 +1,23 @@
+// Padded and checksummed version of: out/cmake_build/pico-sdk/src/rp2_common/boot_stage2/bs2_default.bin
+
+.cpu cortex-m0plus
+.thumb
+
+.section .boot2, "ax"
+
+.byte 0x00, 0xb5, 0x32, 0x4b, 0x21, 0x20, 0x58, 0x60, 0x98, 0x68, 0x02, 0x21, 0x88, 0x43, 0x98, 0x60
+.byte 0xd8, 0x60, 0x18, 0x61, 0x58, 0x61, 0x2e, 0x4b, 0x00, 0x21, 0x99, 0x60, 0x02, 0x21, 0x59, 0x61
+.byte 0x01, 0x21, 0xf0, 0x22, 0x99, 0x50, 0x2b, 0x49, 0x19, 0x60, 0x01, 0x21, 0x99, 0x60, 0x35, 0x20
+.byte 0x00, 0xf0, 0x44, 0xf8, 0x02, 0x22, 0x90, 0x42, 0x14, 0xd0, 0x06, 0x21, 0x19, 0x66, 0x00, 0xf0
+.byte 0x34, 0xf8, 0x19, 0x6e, 0x01, 0x21, 0x19, 0x66, 0x00, 0x20, 0x18, 0x66, 0x1a, 0x66, 0x00, 0xf0
+.byte 0x2c, 0xf8, 0x19, 0x6e, 0x19, 0x6e, 0x19, 0x6e, 0x05, 0x20, 0x00, 0xf0, 0x2f, 0xf8, 0x01, 0x21
+.byte 0x08, 0x42, 0xf9, 0xd1, 0x00, 0x21, 0x99, 0x60, 0x1b, 0x49, 0x19, 0x60, 0x00, 0x21, 0x59, 0x60
+.byte 0x1a, 0x49, 0x1b, 0x48, 0x01, 0x60, 0x01, 0x21, 0x99, 0x60, 0xeb, 0x21, 0x19, 0x66, 0xa0, 0x21
+.byte 0x19, 0x66, 0x00, 0xf0, 0x12, 0xf8, 0x00, 0x21, 0x99, 0x60, 0x16, 0x49, 0x14, 0x48, 0x01, 0x60
+.byte 0x01, 0x21, 0x99, 0x60, 0x01, 0xbc, 0x00, 0x28, 0x00, 0xd0, 0x00, 0x47, 0x12, 0x48, 0x13, 0x49
+.byte 0x08, 0x60, 0x03, 0xc8, 0x80, 0xf3, 0x08, 0x88, 0x08, 0x47, 0x03, 0xb5, 0x99, 0x6a, 0x04, 0x20
+.byte 0x01, 0x42, 0xfb, 0xd0, 0x01, 0x20, 0x01, 0x42, 0xf8, 0xd1, 0x03, 0xbd, 0x02, 0xb5, 0x18, 0x66
+.byte 0x18, 0x66, 0xff, 0xf7, 0xf2, 0xff, 0x18, 0x6e, 0x18, 0x6e, 0x02, 0xbd, 0x00, 0x00, 0x02, 0x40
+.byte 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x5f, 0x00, 0x21, 0x22, 0x00, 0x00
+.byte 0xf4, 0x00, 0x00, 0x18, 0x22, 0x20, 0x00, 0xa0, 0x00, 0x01, 0x00, 0x10, 0x08, 0xed, 0x00, 0xe0
+.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0xb2, 0x4e, 0x7a
diff --git a/pico_build/public_overrides/pico/config_autogen.h b/pico_build/public_overrides/pico/config_autogen.h
new file mode 100644
index 0000000..4bbfecf
--- /dev/null
+++ b/pico_build/public_overrides/pico/config_autogen.h
@@ -0,0 +1,4 @@
+#pragma once
+
+#include PICO_H_LOCATION
+#include RENAME_EXCEPTIONS_H_LOCATION
diff --git a/pico_build/public_overrides/pico/version.h b/pico_build/public_overrides/pico/version.h
new file mode 100644
index 0000000..015270c
--- /dev/null
+++ b/pico_build/public_overrides/pico/version.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+// ---------------------------------------
+// THIS FILE IS AUTOGENERATED; DO NOT EDIT
+// ---------------------------------------
+
+#ifndef _PICO_VERSION_H
+#define _PICO_VERSION_H
+
+#define PICO_SDK_VERSION_MAJOR 1
+#define PICO_SDK_VERSION_MINOR 3
+#define PICO_SDK_VERSION_REVISION 0
+#define PICO_SDK_VERSION_STRING "1.3.0"
+
+#endif
diff --git a/pico_build/py/BUILD.gn b/pico_build/py/BUILD.gn
new file mode 100644
index 0000000..09b5f03
--- /dev/null
+++ b/pico_build/py/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("py") {
+ setup = [
+ "pyproject.toml",
+ "setup.cfg",
+ "setup.py",
+ ]
+ sources = [
+ "pico_build/__init__.py",
+ "pico_build/generate_bs2.py",
+ ]
+
+ pylintrc = "$dir_pigweed/.pylintrc"
+}
diff --git a/pico_build/py/pico_build/__init__.py b/pico_build/py/pico_build/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pico_build/py/pico_build/__init__.py
diff --git a/pico_build/py/pico_build/generate_bs2.py b/pico_build/py/pico_build/generate_bs2.py
new file mode 100644
index 0000000..64d1c35
--- /dev/null
+++ b/pico_build/py/pico_build/generate_bs2.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+# Copyright 2021 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.
+"""PNG to rgb565 header file converter."""
+
+import argparse
+import logging
+from pathlib import Path
+
+from jinja2 import Environment, FileSystemLoader, make_logging_undefined
+
+jinja_env = Environment(
+ # Load templates automatically from pw_console/templates
+ loader=FileSystemLoader(Path(__file__).parent / 'templates'),
+ # Raise errors if variables are undefined in templates
+ undefined=make_logging_undefined(logger=logging.getLogger(__package__), ),
+ # Trim whitespace in templates
+ trim_blocks=True,
+ lstrip_blocks=True,
+)
+
+
+def _arg_parser():
+ """Setup argparse."""
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('OUTPUT_PATH', type=Path, help="output_path")
+ return parser.parse_args()
+
+
+def main() -> None:
+ args = _arg_parser()
+
+ output_path = args.output_path
+ if not output_path.is_dir():
+ raise FileNotFoundError
+
+ template = jinja_env.get_template('bs2.jinja')
+ output_file = output_path / 'bs2_generated.h'
+ output_file.write_text(template.render(text="hello"))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/pico_build/py/pico_build/templates/bs2.jinja b/pico_build/py/pico_build/templates/bs2.jinja
new file mode 100644
index 0000000..1fb1127
--- /dev/null
+++ b/pico_build/py/pico_build/templates/bs2.jinja
@@ -0,0 +1,3 @@
+#pragma once
+
+{{ '// hello' }}
diff --git a/pico_build/py/pyproject.toml b/pico_build/py/pyproject.toml
new file mode 100644
index 0000000..798b747
--- /dev/null
+++ b/pico_build/py/pyproject.toml
@@ -0,0 +1,16 @@
+# Copyright 2021 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.
+[build-system]
+requires = ['setuptools', 'wheel']
+build-backend = 'setuptools.build_meta'
diff --git a/pico_build/py/setup.cfg b/pico_build/py/setup.cfg
new file mode 100644
index 0000000..cb20f67
--- /dev/null
+++ b/pico_build/py/setup.cfg
@@ -0,0 +1,32 @@
+# Copyright 2021 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.
+[metadata]
+name = pico_build
+version = 0.0.1
+author = Pigweed Authors
+author_email = pigweed-developers@googlegroups.com
+description = Pigweed Pico Build
+
+[options]
+packages = find:
+zip_safe = False
+install_requires =
+ jinja2
+
+[options.entry_points]
+console_scripts = generate_bs2_checksumed = pico_build.generate_bs2:main
+
+[options.package_data]
+pico_build =
+ py.typed
\ No newline at end of file
diff --git a/pico_build/py/setup.py b/pico_build/py/setup.py
new file mode 100644
index 0000000..de3c949
--- /dev/null
+++ b/pico_build/py/setup.py
@@ -0,0 +1,18 @@
+# Copyright 2021 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.
+"""pico_build"""
+
+import setuptools # type: ignore
+
+setuptools.setup() # Package definition in setup.cfg
diff --git a/pico_sdk_import.cmake b/pico_sdk_import.cmake
new file mode 120000
index 0000000..7461ddb
--- /dev/null
+++ b/pico_sdk_import.cmake
@@ -0,0 +1 @@
+third_party/pico-sdk/external/pico_sdk_import.cmake
\ No newline at end of file
diff --git a/pw_board_led/BUILD.gn b/pw_board_led/BUILD.gn
new file mode 100644
index 0000000..bf09f23
--- /dev/null
+++ b/pw_board_led/BUILD.gn
@@ -0,0 +1,32 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/facade.gni")
+
+declare_args() {
+ # The backend (driver) to use for the board LED.
+ pw_board_led_BACKEND = ""
+}
+
+config("public_includes") {
+ include_dirs = [ "public" ]
+}
+
+pw_facade("pw_board_led") {
+ backend = pw_board_led_BACKEND
+ public_configs = [ ":public_includes" ]
+ public = [ "public/pw_board_led/led.h" ]
+}
diff --git a/pw_board_led/public/pw_board_led/led.h b/pw_board_led/public/pw_board_led/led.h
new file mode 100644
index 0000000..ab03651
--- /dev/null
+++ b/pw_board_led/public/pw_board_led/led.h
@@ -0,0 +1,25 @@
+// Copyright 2021 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
+
+namespace pw::board_led {
+
+void Init();
+void TurnOn();
+void TurnOff();
+void Toggle();
+
+// TODO(amontanez): Maybe we should add a GetState()? 🤔
+
+} // namespace pw::board_led
diff --git a/pw_board_led_host/BUILD.gn b/pw_board_led_host/BUILD.gn
new file mode 100644
index 0000000..0266972
--- /dev/null
+++ b/pw_board_led_host/BUILD.gn
@@ -0,0 +1,25 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+pw_source_set("pw_board_led_host") {
+ deps = [
+ "$dir_pw_board_led:pw_board_led.facade",
+ dir_pw_log,
+ ]
+ sources = [ "led.cc" ]
+}
diff --git a/pw_board_led_host/led.cc b/pw_board_led_host/led.cc
new file mode 100644
index 0000000..71f520c
--- /dev/null
+++ b/pw_board_led_host/led.cc
@@ -0,0 +1,49 @@
+// Copyright 2021 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 "pw_board_led/led.h"
+
+#include <cinttypes>
+
+#include "pw_log/log.h"
+
+namespace pw::board_led {
+namespace {
+
+bool led_on = false;
+
+} // namespace
+
+void Init() { TurnOff(); }
+
+void TurnOff() {
+ PW_LOG_INFO("[ ]");
+ led_on = false;
+}
+
+void TurnOn() {
+ PW_LOG_INFO("[*]");
+ led_on = true;
+}
+
+void Toggle() {
+ // Check if the LED is on. If so, turn it off.
+ if (led_on) {
+ TurnOff();
+ } else {
+ TurnOn();
+ }
+}
+
+} // namespace pw::board_led
diff --git a/pw_board_led_pico/BUILD.gn b/pw_board_led_pico/BUILD.gn
new file mode 100644
index 0000000..b4795a5
--- /dev/null
+++ b/pw_board_led_pico/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+pw_source_set("pw_board_led_pico") {
+ deps = [
+ "$dir_pw_board_led:pw_board_led.facade",
+ "//targets/pico:pico_core_sources",
+ ]
+ sources = [ "led.cc" ]
+ remove_configs = [ "$dir_pw_build:strict_warnings" ]
+}
diff --git a/pw_board_led_pico/led.cc b/pw_board_led_pico/led.cc
new file mode 100644
index 0000000..a286056
--- /dev/null
+++ b/pw_board_led_pico/led.cc
@@ -0,0 +1,53 @@
+// Copyright 2021 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 "pico/stdlib.h"
+
+#include "pw_board_led/led.h"
+
+#include <cinttypes>
+
+namespace pw::board_led {
+namespace {
+
+constexpr uint kLedPin = PICO_DEFAULT_LED_PIN;
+bool led_on = false;
+
+} // namespace
+
+void Init() {
+ gpio_init(kLedPin);
+ gpio_set_dir(kLedPin, GPIO_OUT);
+}
+
+void TurnOff() {
+ gpio_put(kLedPin, 0);
+ led_on = false;
+}
+
+void TurnOn() {
+ gpio_put(kLedPin, 1);
+ led_on = true;
+}
+
+void Toggle() {
+ // Check if the LED is on. If so, turn it off.
+ if (led_on) {
+ TurnOff();
+ } else {
+ TurnOn();
+ }
+}
+
+} // namespace pw::board_led
diff --git a/pw_spin_delay/BUILD.gn b/pw_spin_delay/BUILD.gn
new file mode 100644
index 0000000..41b9275
--- /dev/null
+++ b/pw_spin_delay/BUILD.gn
@@ -0,0 +1,32 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/facade.gni")
+
+declare_args() {
+ # The backend (driver) to use for the board LED.
+ pw_spin_delay_BACKEND = ""
+}
+
+config("public_includes") {
+ include_dirs = [ "public" ]
+}
+
+pw_facade("pw_spin_delay") {
+ backend = pw_spin_delay_BACKEND
+ public_configs = [ ":public_includes" ]
+ public = [ "public/pw_spin_delay/delay.h" ]
+}
diff --git a/pw_spin_delay/public/pw_spin_delay/delay.h b/pw_spin_delay/public/pw_spin_delay/delay.h
new file mode 100644
index 0000000..d6b701b
--- /dev/null
+++ b/pw_spin_delay/public/pw_spin_delay/delay.h
@@ -0,0 +1,25 @@
+// Copyright 2021 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 <cinttypes>
+#include <cstddef>
+
+namespace pw::spin_delay {
+
+void WaitMillis(size_t delay_ms);
+uint32_t Millis();
+uint32_t Micros();
+
+} // namespace pw::spin_delay
diff --git a/pw_spin_delay_host/BUILD.gn b/pw_spin_delay_host/BUILD.gn
new file mode 100644
index 0000000..fea87c4
--- /dev/null
+++ b/pw_spin_delay_host/BUILD.gn
@@ -0,0 +1,22 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+pw_source_set("pw_spin_delay_host") {
+ deps = [ "$dir_pw_spin_delay:pw_spin_delay.facade" ]
+ sources = [ "delay.cc" ]
+}
diff --git a/pw_spin_delay_host/delay.cc b/pw_spin_delay_host/delay.cc
new file mode 100644
index 0000000..44415d4
--- /dev/null
+++ b/pw_spin_delay_host/delay.cc
@@ -0,0 +1,61 @@
+// Copyright 2021 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 "pw_spin_delay/delay.h"
+
+#include <chrono>
+#include <cstddef>
+#include <cstdint>
+
+namespace {
+std::chrono::system_clock::time_point kProgramStart =
+ std::chrono::system_clock::now();
+}
+
+namespace pw::spin_delay {
+
+void WaitMillis(size_t delay_ms) {
+ std::chrono::system_clock::time_point start =
+ std::chrono::system_clock::now();
+ std::chrono::system_clock::time_point now;
+ size_t difference;
+ do {
+ now = std::chrono::system_clock::now();
+ difference =
+ std::chrono::duration_cast<std::chrono::milliseconds>(now - start)
+ .count();
+ } while (difference < delay_ms);
+}
+
+uint32_t Millis() {
+ std::chrono::system_clock::time_point now;
+ uint32_t difference;
+ now = std::chrono::system_clock::now();
+ difference =
+ std::chrono::duration_cast<std::chrono::milliseconds>(now - kProgramStart)
+ .count();
+ return difference;
+}
+
+uint32_t Micros() {
+ std::chrono::system_clock::time_point now;
+ uint32_t difference;
+ now = std::chrono::system_clock::now();
+ difference =
+ std::chrono::duration_cast<std::chrono::microseconds>(now - kProgramStart)
+ .count();
+ return difference;
+}
+
+} // namespace pw::spin_delay
diff --git a/pw_spin_delay_pico/BUILD.gn b/pw_spin_delay_pico/BUILD.gn
new file mode 100644
index 0000000..b84dd84
--- /dev/null
+++ b/pw_spin_delay_pico/BUILD.gn
@@ -0,0 +1,26 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+pw_source_set("pw_spin_delay_pico") {
+ deps = [
+ "$dir_pw_spin_delay:pw_spin_delay.facade",
+ "//targets/pico:pico_core_sources",
+ ]
+ sources = [ "delay.cc" ]
+ remove_configs = [ "$dir_pw_build:strict_warnings" ]
+}
diff --git a/pw_spin_delay_pico/delay.cc b/pw_spin_delay_pico/delay.cc
new file mode 100644
index 0000000..05cc712
--- /dev/null
+++ b/pw_spin_delay_pico/delay.cc
@@ -0,0 +1,27 @@
+// Copyright 2021 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 "pw_spin_delay/delay.h"
+
+#include <cstddef>
+
+#include "pico/stdlib.h"
+
+namespace pw::spin_delay {
+
+void WaitMillis(size_t delay_ms) { sleep_ms(delay_ms); }
+uint32_t Millis() { return 0; }
+uint32_t Micros() { return 0; }
+
+} // namespace pw::spin_delay
diff --git a/pw_sys_io_pico/BUILD.gn b/pw_sys_io_pico/BUILD.gn
new file mode 100644
index 0000000..bcbe437
--- /dev/null
+++ b/pw_sys_io_pico/BUILD.gn
@@ -0,0 +1,41 @@
+# Copyright 2019 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+import("$dir_pw_docgen/docs.gni")
+
+config("default_config") {
+ include_dirs = [ "public" ]
+}
+
+if (dir_third_party_pico_sdk != "") {
+ pw_source_set("pw_sys_io_pico") {
+ remove_configs = [ "$dir_pw_build:strict_warnings" ]
+ public_configs = [ ":default_config" ]
+ public = [ "public/pw_sys_io_pico/init.h" ]
+ public_deps = [ "$dir_pw_preprocessor" ]
+ deps = [
+ "$dir_pw_sys_io:default_putget_bytes",
+ "$dir_pw_sys_io:facade",
+ "//targets/pico:pico_core_sources",
+ ]
+ sources = [ "sys_io_pico.cc" ]
+ }
+}
+
+pw_doc_group("docs") {
+ sources = [ "docs.rst" ]
+}
diff --git a/pw_sys_io_pico/public/pw_sys_io_pico/init.h b/pw_sys_io_pico/public/pw_sys_io_pico/init.h
new file mode 100644
index 0000000..c3177ec
--- /dev/null
+++ b/pw_sys_io_pico/public/pw_sys_io_pico/init.h
@@ -0,0 +1,23 @@
+// Copyright 2020 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_preprocessor/util.h"
+
+PW_EXTERN_C_START
+
+// The actual implement of PreMainInit() in sys_io_BACKEND.
+void pw_sys_io_pico_Init();
+
+PW_EXTERN_C_END
diff --git a/pw_sys_io_pico/sys_io_pico.cc b/pw_sys_io_pico/sys_io_pico.cc
new file mode 100644
index 0000000..1b02ba8
--- /dev/null
+++ b/pw_sys_io_pico/sys_io_pico.cc
@@ -0,0 +1,68 @@
+// Copyright 2019 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 <cinttypes>
+#include <cstdint>
+
+#include "hardware/irq.h"
+#include "hardware/uart.h"
+#include "pico/stdio.h"
+#include "pico/stdlib.h"
+
+#include "pw_preprocessor/compiler.h"
+#include "pw_sys_io/sys_io.h"
+
+extern "C" void pw_sys_io_pico_Init() { stdio_init_all(); }
+
+namespace pw::sys_io {
+
+Status ReadByte(std::byte *dest) {
+ while (true) {
+ if (TryReadByte(dest).ok()) {
+ return OkStatus();
+ }
+ }
+}
+
+Status TryReadByte(std::byte *dest) {
+ int c = getchar_timeout_us(0);
+ if (c == PICO_ERROR_TIMEOUT) {
+ return Status::Unavailable();
+ }
+ *dest = static_cast<std::byte>(c);
+ return OkStatus();
+}
+
+Status WriteByte(std::byte b) {
+ putchar_raw((uint8_t)b);
+ return OkStatus();
+}
+
+// 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(std::as_bytes(std::span(s)));
+ if (!result.ok()) {
+ return result;
+ }
+ chars_written += result.size();
+
+ // Write trailing newline.
+ result = WriteBytes(std::as_bytes(std::span("\r\n", 2)));
+ chars_written += result.size();
+
+ return StatusWithSize(result.status(), chars_written);
+}
+
+} // namespace pw::sys_io
diff --git a/targets/common_backends.gni b/targets/common_backends.gni
new file mode 100644
index 0000000..00c4edf
--- /dev/null
+++ b/targets/common_backends.gni
@@ -0,0 +1,37 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+# Inherit from a Pigweed upstream toolchain and override backends as needed.
+toolchain_overrides = {
+ # Configure backend for assert facade.
+ pw_assert_BACKEND = dir_pw_assert_basic
+
+ # Configure the pw_log facade for Base64 tokenized logging.
+ pw_log_BACKEND = dir_pw_log_tokenized
+ pw_tokenizer_GLOBAL_HANDLER_WITH_PAYLOAD_BACKEND =
+ "$dir_pw_log_tokenized:base64_over_hdlc"
+
+ # Alternately, configure pw_log for plain text logging
+ # pw_log_BACKEND = dir_pw_log_basic
+
+ # Path to the nanopb installation. Defaults to included git module.
+ dir_pw_third_party_nanopb = "//third_party/nanopb"
+
+ pw_build_LINK_DEPS = [
+ "$dir_pw_assert:impl",
+ "$dir_pw_log:impl",
+ ]
+}
diff --git a/targets/host/BUILD.gn b/targets/host/BUILD.gn
new file mode 100644
index 0000000..200c021
--- /dev/null
+++ b/targets/host/BUILD.gn
@@ -0,0 +1,22 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_toolchain/generate_toolchain.gni")
+import("target_toolchains.gni")
+
+generate_toolchains("toolchains") {
+ toolchains = toolchains_list
+}
diff --git a/targets/host/target_toolchains.gni b/targets/host/target_toolchains.gni
new file mode 100644
index 0000000..c27aabc
--- /dev/null
+++ b/targets/host/target_toolchains.gni
@@ -0,0 +1,80 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("//targets/common_backends.gni")
+import("$dir_pigweed/targets/host/target_toolchains.gni")
+import("$dir_pw_protobuf_compiler/proto.gni")
+import("$dir_pw_third_party/nanopb/nanopb.gni")
+
+target_toolchain_host = {
+ _excluded_members = [
+ "defaults",
+ "name",
+ ]
+
+ _excluded_defaults = [
+ "pw_trace_BACKEND",
+ "pw_trace_tokenizer_time",
+ ]
+
+ clang_debug = {
+ name = "host_debug"
+ if (host_os == "win") {
+ _toolchain_base = pw_target_toolchain_host.gcc_debug
+ } else {
+ _toolchain_base = pw_target_toolchain_host.clang_debug
+ }
+ forward_variables_from(_toolchain_base, "*", _excluded_members)
+ defaults = {
+ forward_variables_from(_toolchain_base.defaults, "*", _excluded_defaults)
+ forward_variables_from(toolchain_overrides, "*")
+
+ # Force hosts to use basic log backend to avoid generating and loading its
+ # own tokenized database.
+ pw_log_BACKEND = dir_pw_log_basic
+
+ # Configure backend for pw_sys_io facade.
+ pw_sys_io_BACKEND = dir_pw_sys_io_stdio
+
+ pw_board_led_BACKEND = dir_pw_board_led_host
+ pw_spin_delay_BACKEND = dir_pw_spin_delay_host
+ }
+ }
+
+ # Toolchain for tests only.
+ clang_debug_tests = {
+ name = "host_debug_tests"
+ if (host_os == "win") {
+ _toolchain_base = pw_target_toolchain_host.gcc_debug
+ } else {
+ _toolchain_base = pw_target_toolchain_host.clang_debug
+ }
+ forward_variables_from(_toolchain_base, "*", _excluded_members)
+ defaults = {
+ forward_variables_from(_toolchain_base.defaults, "*", _excluded_defaults)
+ forward_variables_from(toolchain_overrides, "*")
+
+ # Force tests to use basic log backend to avoid generating and loading its
+ # own tokenized database.
+ pw_log_BACKEND = dir_pw_log_basic
+ }
+ }
+}
+
+toolchains_list = [
+ target_toolchain_host.clang_debug,
+ target_toolchain_host.clang_debug_tests,
+]
diff --git a/targets/pico/BUILD.gn b/targets/pico/BUILD.gn
new file mode 100644
index 0000000..0ed5c36
--- /dev/null
+++ b/targets/pico/BUILD.gn
@@ -0,0 +1,328 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_toolchain/generate_toolchain.gni")
+
+if (dir_third_party_pico_sdk != "") {
+ import("target_toolchains.gni")
+
+ generate_toolchains("toolchains") {
+ toolchains = toolchains_list
+ }
+
+ if (current_toolchain != default_toolchain) {
+ _pico_sdk_dir = rebase_path(dir_third_party_pico_sdk)
+
+ config("pico_config") {
+ defines = [
+ "DIR_THIRD_PARTY_PICO_SDK=\"$_pico_sdk_dir\"",
+ "PICO_H_LOCATION=\"${_pico_sdk_dir}/src/boards/include/boards/pico.h\"",
+ "RENAME_EXCEPTIONS_H_LOCATION=\"$_pico_sdk_dir/src/rp2_common/cmsis/include/cmsis/rename_exceptions.h\"",
+ "CFG_TUSB_DEBUG=0",
+ "CFG_TUSB_MCU=OPT_MCU_RP2040",
+ "CFG_TUSB_OS=OPT_OS_PICO",
+ "LIB_PICO_BIT_OPS=1",
+ "LIB_PICO_BIT_OPS_PICO=1",
+ "LIB_PICO_DIVIDER=1",
+ "LIB_PICO_DIVIDER_HARDWARE=1",
+ "LIB_PICO_DOUBLE=1",
+ "LIB_PICO_DOUBLE_PICO=1",
+ "LIB_PICO_FIX_RP2040_USB_DEVICE_ENUMERATION=1",
+ "LIB_PICO_FLOAT=1",
+ "LIB_PICO_FLOAT_PICO=1",
+ "LIB_PICO_INT64_OPS=1",
+ "LIB_PICO_INT64_OPS_PICO=1",
+ "LIB_PICO_MALLOC=1",
+ "LIB_PICO_MEM_OPS=1",
+ "LIB_PICO_MEM_OPS_PICO=1",
+ "LIB_PICO_PLATFORM=1",
+ "LIB_PICO_PRINTF=1",
+ "LIB_PICO_PRINTF_PICO=1",
+ "LIB_PICO_RUNTIME=1",
+ "LIB_PICO_STANDARD_LINK=1",
+ "LIB_PICO_STDIO=1",
+ "LIB_PICO_STDIO_USB=1",
+ "LIB_PICO_STDLIB=1",
+ "LIB_PICO_SYNC=1",
+ "LIB_PICO_SYNC_CORE=1",
+ "LIB_PICO_SYNC_CRITICAL_SECTION=1",
+ "LIB_PICO_SYNC_MUTEX=1",
+ "LIB_PICO_SYNC_SEM=1",
+ "LIB_PICO_TIME=1",
+ "LIB_PICO_UNIQUE_ID=1",
+ "LIB_PICO_UTIL=1",
+ "PICO_BOARD=\"pico\"",
+ "PICO_BUILD=1",
+ "PICO_CMAKE_BUILD_TYPE=\"Release\"",
+ "PICO_COPY_TO_RAM=0",
+ "PICO_CXX_ENABLE_EXCEPTIONS=0",
+ "PICO_NO_FLASH=0",
+ "PICO_NO_HARDWARE=0",
+ "PICO_ON_DEVICE=1",
+
+ # "PICO_TARGET_NAME=\"hello_usb\"",
+ "PICO_USE_BLOCKED_RAM=0",
+ ]
+ include_dirs = [
+ "$dir_third_party_pico_sdk/src/common/pico_stdlib/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_gpio/include",
+ "$dir_third_party_pico_sdk/src/common/pico_base/include",
+ "$dir_pico_build/public_overrides",
+ "$dir_third_party_pico_sdk/src/boards/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_platform/include",
+ "$dir_third_party_pico_sdk/src/rp2040/hardware_regs/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_base/include",
+ "$dir_third_party_pico_sdk/src/rp2040/hardware_structs/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_claim/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_sync/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_uart/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_divider/include",
+ "$dir_third_party_pico_sdk/src/common/pico_time/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_timer/include",
+ "$dir_third_party_pico_sdk/src/common/pico_sync/include",
+ "$dir_third_party_pico_sdk/src/common/pico_util/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_runtime/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_clocks/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_irq/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_resets/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_pll/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_vreg/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_watchdog/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_xosc/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_printf/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_bootrom/include",
+ "$dir_third_party_pico_sdk/src/common/pico_bit_ops/include",
+ "$dir_third_party_pico_sdk/src/common/pico_divider/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_double/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_int64_ops/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_float/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_malloc/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/boot_stage2/include",
+ "$dir_third_party_pico_sdk/src/common/pico_binary_info/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_stdio/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_stdio_usb/include",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/common",
+ "$dir_third_party_pico_sdk/lib/tinyusb/hw",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_unique_id/include",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_flash/include",
+ "$dir_third_party_pico_sdk/src/common/pico_usb_reset_interface/include",
+ "-NDEBUG",
+ ]
+ cflags = [
+ "-Wno-unused-function",
+ "-Wno-maybe-uninitialized",
+ "-ffunction-sections",
+ "-fdata-sections",
+ "-Wno-error=undef",
+ "-Wno-error=cast-qual",
+ "-Wno-error=pointer-arith",
+ ]
+ cflags_c = [ "-std=gnu11" ]
+ ldflags = [
+ "-Wl,--wrap=sprintf",
+ "-Wl,--wrap=snprintf",
+ "-Wl,--wrap=vsnprintf",
+ "-Wl,--wrap=__clzsi2",
+ "-Wl,--wrap=__clzdi2",
+ "-Wl,--wrap=__ctzsi2",
+ "-Wl,--wrap=__ctzdi2",
+ "-Wl,--wrap=__popcountsi2",
+ "-Wl,--wrap=__popcountdi2",
+ "-Wl,--wrap=__clz",
+ "-Wl,--wrap=__clzl",
+ "-Wl,--wrap=__clzll",
+ "-Wl,--wrap=__aeabi_idiv",
+ "-Wl,--wrap=__aeabi_idivmod",
+ "-Wl,--wrap=__aeabi_ldivmod",
+ "-Wl,--wrap=__aeabi_uidiv",
+ "-Wl,--wrap=__aeabi_uidivmod",
+ "-Wl,--wrap=__aeabi_uldivmod",
+ "-Wl,--wrap=__aeabi_lmul",
+ "-Wl,--wrap=__aeabi_fadd",
+ "-Wl,--wrap=__aeabi_fdiv",
+ "-Wl,--wrap=__aeabi_fmul",
+ "-Wl,--wrap=__aeabi_frsub",
+ "-Wl,--wrap=__aeabi_fsub",
+ "-Wl,--wrap=__aeabi_cfcmpeq",
+ "-Wl,--wrap=__aeabi_cfrcmple",
+ "-Wl,--wrap=__aeabi_cfcmple",
+ "-Wl,--wrap=__aeabi_fcmpeq",
+ "-Wl,--wrap=__aeabi_fcmplt",
+ "-Wl,--wrap=__aeabi_fcmple",
+ "-Wl,--wrap=__aeabi_fcmpge",
+ "-Wl,--wrap=__aeabi_fcmpgt",
+ "-Wl,--wrap=__aeabi_fcmpun",
+ "-Wl,--wrap=__aeabi_i2f",
+ "-Wl,--wrap=__aeabi_l2f",
+ "-Wl,--wrap=__aeabi_ui2f",
+ "-Wl,--wrap=__aeabi_ul2f",
+ "-Wl,--wrap=__aeabi_f2iz",
+ "-Wl,--wrap=__aeabi_f2lz",
+ "-Wl,--wrap=__aeabi_f2uiz",
+ "-Wl,--wrap=__aeabi_f2ulz",
+ "-Wl,--wrap=__aeabi_f2d",
+ "-Wl,--wrap=sqrtf",
+ "-Wl,--wrap=cosf",
+ "-Wl,--wrap=sinf",
+ "-Wl,--wrap=tanf",
+ "-Wl,--wrap=atan2f",
+ "-Wl,--wrap=expf",
+ "-Wl,--wrap=logf",
+ "-Wl,--wrap=ldexpf",
+ "-Wl,--wrap=copysignf",
+ "-Wl,--wrap=truncf",
+ "-Wl,--wrap=floorf",
+ "-Wl,--wrap=ceilf",
+ "-Wl,--wrap=roundf",
+ "-Wl,--wrap=sincosf",
+ "-Wl,--wrap=asinf",
+ "-Wl,--wrap=acosf",
+ "-Wl,--wrap=atanf",
+ "-Wl,--wrap=sinhf",
+ "-Wl,--wrap=coshf",
+ "-Wl,--wrap=tanhf",
+ "-Wl,--wrap=asinhf",
+ "-Wl,--wrap=acoshf",
+ "-Wl,--wrap=atanhf",
+ "-Wl,--wrap=exp2f",
+ "-Wl,--wrap=log2f",
+ "-Wl,--wrap=exp10f",
+ "-Wl,--wrap=log10f",
+ "-Wl,--wrap=powf",
+ "-Wl,--wrap=powintf",
+ "-Wl,--wrap=hypotf",
+ "-Wl,--wrap=cbrtf",
+ "-Wl,--wrap=fmodf",
+ "-Wl,--wrap=dremf",
+ "-Wl,--wrap=remainderf",
+ "-Wl,--wrap=remquof",
+ "-Wl,--wrap=expm1f",
+ "-Wl,--wrap=log1pf",
+ "-Wl,--wrap=fmaf",
+ "-Wl,--wrap=malloc",
+ "-Wl,--wrap=calloc",
+ "-Wl,--wrap=free",
+ "-Wl,--wrap=memcpy",
+ "-Wl,--wrap=memset",
+ "-Wl,--wrap=__aeabi_memcpy",
+ "-Wl,--wrap=__aeabi_memset",
+ "-Wl,--wrap=__aeabi_memcpy4",
+ "-Wl,--wrap=__aeabi_memset4",
+ "-Wl,--wrap=__aeabi_memcpy8",
+ "-Wl,--wrap=__aeabi_memset8",
+ "-Wl,-Map=hello_usb.elf.map",
+ "-Wl,--script=${_pico_sdk_dir}/src/rp2_common/pico_standard_link/memmap_default.ld",
+ "-Wl,-z,max-page-size=4096",
+ "-Wl,--gc-sections",
+ "-Wl,--wrap=printf",
+ "-Wl,--wrap=vprintf",
+ "-Wl,--wrap=puts",
+ "-Wl,--wrap=putchar",
+ "-Wl,--wrap=getchar",
+ ]
+ }
+
+ pw_source_set("pre_init") {
+ sources = [ "init.cc" ]
+
+ public_deps = [
+ "$dir_pw_sys_io_pico",
+ "//targets/pico:pico_core_sources",
+ ]
+ deps = []
+ remove_configs = [ "$dir_pw_build:strict_warnings" ]
+ }
+
+ pw_source_set("pico_core_sources") {
+ public_configs = [ ":pico_config" ]
+ sources = [
+ "$dir_pico_build/bs2_default_padded_checksummed.S",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/audio/audio_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/cdc/cdc_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/dfu/dfu_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/dfu/dfu_rt_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/hid/hid_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/midi/midi_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/msc/msc_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/net/ecm_rndis_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/net/ncm_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/usbtmc/usbtmc_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/vendor/vendor_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/class/video/video_device.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/common/tusb_fifo.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/device/usbd.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/device/usbd_control.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c",
+ "$dir_third_party_pico_sdk/lib/tinyusb/src/tusb.c",
+ "$dir_third_party_pico_sdk/src/common/pico_sync/critical_section.c",
+ "$dir_third_party_pico_sdk/src/common/pico_sync/lock_core.c",
+ "$dir_third_party_pico_sdk/src/common/pico_sync/mutex.c",
+ "$dir_third_party_pico_sdk/src/common/pico_sync/sem.c",
+ "$dir_third_party_pico_sdk/src/common/pico_time/time.c",
+ "$dir_third_party_pico_sdk/src/common/pico_time/timeout_helper.c",
+ "$dir_third_party_pico_sdk/src/common/pico_util/datetime.c",
+ "$dir_third_party_pico_sdk/src/common/pico_util/pheap.c",
+ "$dir_third_party_pico_sdk/src/common/pico_util/queue.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_claim/claim.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_clocks/clocks.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_flash/flash.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_gpio/gpio.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_irq/irq.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_irq/irq_handler_chain.S",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_pll/pll.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_sync/sync.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_timer/timer.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_uart/uart.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_vreg/vreg.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_watchdog/watchdog.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/hardware_xosc/xosc.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_bit_ops/bit_ops_aeabi.S",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_bootrom/bootrom.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_divider/divider.S",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_double/double_aeabi.S",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_double/double_init_rom.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_double/double_math.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_double/double_v1_rom_shim.S",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/rp2040_usb_device_enumeration.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_float/float_init_rom.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_float/float_math.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_malloc/pico_malloc.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_mem_ops/mem_ops_aeabi.S",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_platform/platform.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_printf/printf.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_runtime/runtime.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_standard_link/binary_info.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_standard_link/crt0.S",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_standard_link/new_delete.cpp",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_stdio/stdio.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_stdio_usb/reset_interface.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_stdio_usb/stdio_usb.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_stdlib/stdlib.c",
+ "$dir_third_party_pico_sdk/src/rp2_common/pico_unique_id/unique_id.c",
+ ]
+ }
+ }
+} else {
+ config("pico_config") {
+ }
+ group("pre_init") {
+ }
+}
diff --git a/targets/pico/init.cc b/targets/pico/init.cc
new file mode 100644
index 0000000..26926c3
--- /dev/null
+++ b/targets/pico/init.cc
@@ -0,0 +1,25 @@
+// Copyright 2020 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 "pico/stdlib.h"
+
+#include "pw_sys_io_pico/init.h"
+
+// Pico target specific init. For Pigweed, this calls pw_sys_io's init. User
+// projects may chose to provide something different if they need more pre-main
+// init functionality.
+extern "C" void pw_pico_Init() {
+ stdio_init_all();
+ pw_sys_io_pico_Init();
+}
diff --git a/targets/pico/pico_executable.gni b/targets/pico/pico_executable.gni
new file mode 100644
index 0000000..d823d0a
--- /dev/null
+++ b/targets/pico/pico_executable.gni
@@ -0,0 +1,30 @@
+# Copyright 2020 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.
+
+import("//build_overrides/pigweed.gni")
+import("$dir_pw_malloc/backend.gni")
+
+# Executable wrapper that includes some baremetal startup code.
+template("pico_executable") {
+ target("executable", target_name) {
+ forward_variables_from(invoker, "*")
+ if (!defined(deps)) {
+ deps = []
+ }
+ deps += [
+ "//targets/pico:pico_core_sources",
+ "//targets/pico:pre_init",
+ ]
+ }
+}
diff --git a/targets/pico/target_toolchains.gni b/targets/pico/target_toolchains.gni
new file mode 100644
index 0000000..a379781
--- /dev/null
+++ b/targets/pico/target_toolchains.gni
@@ -0,0 +1,107 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+# import("//targets/common_backends.gni")
+
+import("$dir_pw_protobuf_compiler/proto.gni")
+import("$dir_pw_third_party/nanopb/nanopb.gni")
+import("$dir_pw_toolchain/arm_gcc/toolchains.gni")
+
+_target_config = {
+ # Use the logging main.
+ # pw_unit_test_MAIN = "$dir_pw_unit_test:simple_printing_main"
+
+ # Configuration options for Pigweed executable targets.
+ pw_build_EXECUTABLE_TARGET_TYPE = "pico_executable"
+
+ pw_build_EXECUTABLE_TARGET_TYPE_FILE =
+ get_path_info("pico_executable.gni", "abspath")
+
+ # Path to the bloaty config file for the output binaries.
+ # pw_bloat_BLOATY_CONFIG = "$dir_pw_boot_cortex_m/bloaty_config.bloaty"
+
+ # if (pw_pico_use_test_server) {
+ # _test_runner_script =
+ # "$dir_pico_build/py/pico_build/unit_test_client.py"
+ # pw_unit_test_AUTOMATIC_RUNNER =
+ # get_path_info(_test_runner_script, "abspath")
+ # }
+
+ # Facade backends
+ pw_assert_BACKEND = dir_pw_assert_basic
+ pw_log_BACKEND = dir_pw_log_basic
+
+ # pw_sync_INTERRUPT_SPIN_LOCK_BACKEND =
+ # "$dir_pw_sync_baremetal:interrupt_spin_lock"
+ # pw_sync_MUTEX_BACKEND = "$dir_pw_sync_baremetal:mutex"
+ pw_sys_io_BACKEND = dir_pw_sys_io_pico
+
+ # pw_rpc_system_server_BACKEND =
+ # "$dir_pigweed/targets/pico:system_rpc_server"
+ # pw_pico_build_INIT_BACKEND = "//targets/pico:pre_init"
+
+ pw_build_LINK_DEPS += [
+ "$dir_pw_assert:impl",
+ "$dir_pw_log:impl",
+ ]
+
+ current_cpu = "arm"
+ current_os = ""
+}
+
+target_toolchain_pico = {
+ _excluded_members = [
+ "defaults",
+ "name",
+ ]
+
+ pico_debug = {
+ name = "pico_debug"
+ _toolchain_base = pw_toolchain_arm_gcc.cortex_m0plus_size_optimized
+ forward_variables_from(_toolchain_base, "*", _excluded_members)
+ final_binary_extension = ".elf"
+ defaults = {
+ forward_variables_from(_toolchain_base.defaults, "*")
+ forward_variables_from(_target_config, "*")
+
+ # Configure backend for pw_board_led
+ pw_board_led_BACKEND = "$dir_pw_board_led_pico"
+
+ # Configure backend for pw_spin_delay
+ pw_spin_delay_BACKEND = "$dir_pw_spin_delay_pico"
+ }
+ }
+
+ # # Toolchain for tests only.
+ # pico_debug_tests = {
+ # name = "pico_debug_tests"
+ # _toolchain_base = pw_target_toolchain_pico.debug
+ # forward_variables_from(_toolchain_base, "*", _excluded_members)
+ # defaults = {
+ # forward_variables_from(_toolchain_base.defaults, "*")
+ # forward_variables_from(toolchain_overrides, "*")
+
+ # # Force tests to use basic log backend to avoid generating and loading its
+ # # own tokenized database.
+ # pw_log_BACKEND = dir_pw_log_basic
+ # }
+ # }
+}
+
+toolchains_list = [
+ target_toolchain_pico.pico_debug,
+ # target_toolchain_pico.pico_debug_tests,
+]
diff --git a/targets/pico_base/BUILD.gn b/targets/pico_base/BUILD.gn
new file mode 100644
index 0000000..200c021
--- /dev/null
+++ b/targets/pico_base/BUILD.gn
@@ -0,0 +1,22 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_toolchain/generate_toolchain.gni")
+import("target_toolchains.gni")
+
+generate_toolchains("toolchains") {
+ toolchains = toolchains_list
+}
diff --git a/targets/pico_base/target_toolchains.gni b/targets/pico_base/target_toolchains.gni
new file mode 100644
index 0000000..be33e06
--- /dev/null
+++ b/targets/pico_base/target_toolchains.gni
@@ -0,0 +1,62 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+# import("//targets/common_backends.gni")
+
+import("$dir_pw_toolchain/arm_gcc/toolchains.gni")
+
+target_toolchain_pico_base = {
+ _excluded_members = [
+ "defaults",
+ "name",
+ ]
+
+ pico_base_debug = {
+ name = "pico_base_debug"
+ _toolchain_base = pw_toolchain_arm_gcc.cortex_m0plus_size_optimized
+ forward_variables_from(_toolchain_base, "*", _excluded_members)
+ final_binary_extension = ".elf"
+ defaults = {
+ forward_variables_from(_toolchain_base.defaults, "*")
+
+ # # Configure backend for pw_board_led
+ # pw_board_led_BACKEND = "$dir_pw_board_led_pico"
+
+ # # Configure backend for pw_spin_delay
+ # pw_spin_delay_BACKEND = "$dir_pw_spin_delay_pico"
+ }
+ }
+
+ # # Toolchain for tests only.
+ # pico_base_debug_tests = {
+ # name = "pico_base_debug_tests"
+ # _toolchain_base = pw_target_toolchain_pico.debug
+ # forward_variables_from(_toolchain_base, "*", _excluded_members)
+ # defaults = {
+ # forward_variables_from(_toolchain_base.defaults, "*")
+ # forward_variables_from(toolchain_overrides, "*")
+
+ # # Force tests to use basic log backend to avoid generating and loading its
+ # # own tokenized database.
+ # pw_log_BACKEND = dir_pw_log_basic
+ # }
+ # }
+}
+
+toolchains_list = [
+ target_toolchain_pico_base.pico_base_debug,
+ # target_toolchain_pico.pico_base_debug_tests,
+]
diff --git a/third_party/elf2uf2/BUILD.gn b/third_party/elf2uf2/BUILD.gn
new file mode 100644
index 0000000..7c5de65
--- /dev/null
+++ b/third_party/elf2uf2/BUILD.gn
@@ -0,0 +1,30 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/target_types.gni")
+
+if (dir_third_party_pico_sdk != "") {
+ config("elf2uf2_configs") {
+ include_dirs = [ "$dir_third_party_pico_sdk/src/common/boot_uf2/include" ]
+ cflags_cc = [ "-std=gnu++14" ]
+ }
+
+ pw_executable("elf2uf2") {
+ configs = [ ":elf2uf2_configs" ]
+ sources = [ "$dir_third_party_pico_sdk/tools/elf2uf2/main.cpp" ]
+ remove_configs = [ "$dir_pw_build:strict_warnings" ]
+ }
+}
diff --git a/third_party/pico-extras b/third_party/pico-extras
new file mode 160000
index 0000000..77eae28
--- /dev/null
+++ b/third_party/pico-extras
@@ -0,0 +1 @@
+Subproject commit 77eae2836638baf2f61b321eb61125da99bb4445
diff --git a/third_party/pico-sdk b/third_party/pico-sdk
new file mode 160000
index 0000000..2062372
--- /dev/null
+++ b/third_party/pico-sdk
@@ -0,0 +1 @@
+Subproject commit 2062372d203b372849d573f252cf7c6dc2800c0a
diff --git a/third_party/pigweed b/third_party/pigweed
new file mode 160000
index 0000000..64a4b16
--- /dev/null
+++ b/third_party/pigweed
@@ -0,0 +1 @@
+Subproject commit 64a4b16be46435f6aacbf29f5fb70c355ff90216
diff --git a/tools/BUILD.gn b/tools/BUILD.gn
new file mode 100644
index 0000000..b93a53a
--- /dev/null
+++ b/tools/BUILD.gn
@@ -0,0 +1,30 @@
+# Copyright 2021 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.
+
+import("//build_overrides/pigweed.gni")
+
+import("$dir_pw_build/python.gni")
+
+pw_python_package("tools") {
+ setup = [ "setup.py" ]
+ sources = [
+ "pigweed_experimental_tools/__init__.py",
+ "pigweed_experimental_tools/presubmit_checks.py",
+ ]
+ python_deps = [
+ "$dir_pw_cli/py",
+ "$dir_pw_presubmit/py",
+ ]
+ pylintrc = "$dir_pigweed/.pylintrc"
+}
diff --git a/tools/pigweed_experimental_tools/__init__.py b/tools/pigweed_experimental_tools/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/pigweed_experimental_tools/__init__.py
diff --git a/tools/pigweed_experimental_tools/presubmit_checks.py b/tools/pigweed_experimental_tools/presubmit_checks.py
new file mode 100755
index 0000000..93c2f94
--- /dev/null
+++ b/tools/pigweed_experimental_tools/presubmit_checks.py
@@ -0,0 +1,161 @@
+#!/usr/bin/env python3
+# Copyright 2021 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.
+"""Example presubmit check script."""
+
+import argparse
+import logging
+import os
+from pathlib import Path
+import re
+import sys
+
+try:
+ import pw_cli.log
+except ImportError:
+ print('ERROR: Activate the environment before running presubmits!',
+ file=sys.stderr)
+ sys.exit(2)
+
+import pw_presubmit
+from pw_presubmit import (
+ build,
+ cli,
+ cpp_checks,
+ format_code,
+ git_repo,
+ inclusive_language,
+ install_hook,
+ python_checks,
+ PresubmitContext,
+)
+
+_LOG = logging.getLogger(__name__)
+
+# Set up variables for key project paths.
+try:
+ PROJECT_ROOT = Path(os.environ['PIGWEED_EXPERIMENTAL_ROOT'])
+except KeyError:
+ print(
+ 'ERROR: The presubmit checks must be run in the sample project\'s root'
+ ' directory',
+ file=sys.stderr)
+ sys.exit(2)
+
+PIGWEED_ROOT = PROJECT_ROOT / 'third_party' / 'pigweed'
+REPOS = (
+ PROJECT_ROOT,
+ PIGWEED_ROOT,
+ PROJECT_ROOT / 'third_party' / 'nanopb',
+)
+
+# Rerun the build if files with these extensions change.
+_BUILD_EXTENSIONS = frozenset(
+ ['.rst', '.gn', '.gni', *format_code.C_FORMAT.extensions])
+
+
+#
+# Presubmit checks
+#
+def default_build(ctx: PresubmitContext):
+ """Creates a default build."""
+ build.gn_gen(PROJECT_ROOT, ctx.output_dir)
+ build.ninja(ctx.output_dir)
+
+
+def check_for_git_changes(_: PresubmitContext):
+ """Checks that repositories have all changes commited."""
+ checked_repos = (PIGWEED_ROOT, *REPOS)
+ changes = [r for r in checked_repos if git_repo.has_uncommitted_changes(r)]
+ for repo in changes:
+ _LOG.error('There are uncommitted changes in the %s repo!', repo.name)
+ if changes:
+ _LOG.warning(
+ 'Commit or stash pending changes before running the presubmit.')
+ raise pw_presubmit.PresubmitFailure
+
+
+# Avoid running some checks on certain paths.
+PATH_EXCLUSIONS = (
+ re.compile(r'^external/'),
+ re.compile(r'^third_party/'),
+ re.compile(r'^vendor/'),
+)
+
+#
+# Presubmit check programs
+#
+OTHER_CHECKS = (
+ build.gn_gen_check,
+ inclusive_language.inclusive_language.with_filter(exclude=PATH_EXCLUSIONS),
+)
+
+QUICK = (
+ # List some presubmit checks to run
+ default_build,
+ # Use the upstream formatting checks, with custom path filters applied.
+ format_code.presubmit_checks(exclude=PATH_EXCLUSIONS),
+)
+
+LINTFORMAT = (
+ # Use the upstream formatting checks, with custom path filters applied.
+ format_code.presubmit_checks(exclude=PATH_EXCLUSIONS),
+ python_checks.gn_python_lint.with_filter(exclude=PATH_EXCLUSIONS),
+ cpp_checks.pragma_once.with_filter(endswith='.h', exclude=PATH_EXCLUSIONS),
+)
+
+FULL = (
+ cpp_checks.pragma_once.with_filter(endswith='.h', exclude=PATH_EXCLUSIONS),
+ QUICK, # Add all checks from the 'quick' program
+ # Use the upstream Python checks, with custom path filters applied.
+ python_checks.gn_python_check.with_filter(exclude=PATH_EXCLUSIONS),
+)
+
+PROGRAMS = pw_presubmit.Programs(
+ quick=QUICK,
+ full=FULL,
+ lintformat=LINTFORMAT,
+ other_checks=OTHER_CHECKS,
+)
+
+
+def run(install: bool, **presubmit_args) -> int:
+ """Process the --install argument then invoke pw_presubmit."""
+
+ # Install the presubmit Git pre-push hook, if requested.
+ if install:
+ install_hook.install_hook(__file__, 'pre-push', ['--base', 'HEAD~'],
+ git_repo.root())
+ return 0
+
+ return cli.run(root=PROJECT_ROOT, **presubmit_args)
+
+
+def main() -> int:
+ """Run the presubmit checks for this repository."""
+ parser = argparse.ArgumentParser(description=__doc__)
+ cli.add_arguments(parser, PROGRAMS, 'quick')
+
+ # Define an option for installing a Git pre-push hook for this script.
+ parser.add_argument(
+ '--install',
+ action='store_true',
+ help='Install the presubmit as a Git pre-push hook and exit.')
+
+ return run(**vars(parser.parse_args()))
+
+
+if __name__ == '__main__':
+ pw_cli.log.install(logging.INFO)
+ sys.exit(main())
diff --git a/tools/pigweed_experimental_tools/py.typed b/tools/pigweed_experimental_tools/py.typed
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tools/pigweed_experimental_tools/py.typed
diff --git a/tools/setup.py b/tools/setup.py
new file mode 100644
index 0000000..7f4c6ff
--- /dev/null
+++ b/tools/setup.py
@@ -0,0 +1,34 @@
+# Copyright 2021 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.
+"""Utilities for Sample Project development."""
+
+import setuptools # type: ignore
+
+setuptools.setup(
+ name='pigweed_experimental_tools',
+ version='0.0.1',
+ author='Pigweed Authors',
+ author_email='pigweed-developers@googlegroups.com',
+ description=__doc__,
+ packages=setuptools.find_packages(),
+ package_data={'pigweed_experimental_tools': ['py.typed']},
+ zip_safe=False,
+ entry_points={
+ 'console_scripts': [
+ 'find-files = pigweed_experimental_tools.find_files:main',
+ ]
+ },
+ install_requires=[
+ 'pw_cli',
+ ])