pw_package: Add FreeRTOS

Requires: pigweed-internal:18940
Change-Id: Ib65d262e5f4dbb2b68f92a33d4ae396896961f6d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/66748
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
diff --git a/pw_package/py/BUILD.gn b/pw_package/py/BUILD.gn
index 403acb8..3f86f87 100644
--- a/pw_package/py/BUILD.gn
+++ b/pw_package/py/BUILD.gn
@@ -31,6 +31,7 @@
     "pw_package/packages/boringssl.py",
     "pw_package/packages/chromium_verifier.py",
     "pw_package/packages/crlset.py",
+    "pw_package/packages/freertos.py",
     "pw_package/packages/mbedtls.py",
     "pw_package/packages/micro_ecc.py",
     "pw_package/packages/nanopb.py",
diff --git a/pw_package/py/pw_package/packages/freertos.py b/pw_package/py/pw_package/packages/freertos.py
new file mode 100644
index 0000000..1ab1270
--- /dev/null
+++ b/pw_package/py/pw_package/packages/freertos.py
@@ -0,0 +1,40 @@
+# 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.
+"""Install and check status of FreeRTOS."""
+
+import pathlib
+from typing import Sequence
+
+import pw_package.git_repo
+import pw_package.package_manager
+
+
+class FreeRtos(pw_package.git_repo.GitRepo):
+    """Install and check status of FreeRTOS."""
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args,
+                         name='freertos',
+                         url='https://github.com/FreeRTOS/FreeRTOS-Kernel',
+                         commit='fa0f5c436ccd920be313313b7e08ba6a5513f93a',
+                         **kwargs)
+
+    def info(self, path: pathlib.Path) -> Sequence[str]:
+        return (
+            f'{self.name} installed in: {path}',
+            "Enable by running 'gn args out' and adding this line:",
+            f'  dir_pw_third_party_freertos = "{path}"',
+        )
+
+
+pw_package.package_manager.register(FreeRtos)
diff --git a/pw_package/py/pw_package/pigweed_packages.py b/pw_package/py/pw_package/pigweed_packages.py
index c1c7067..de4a9e0 100644
--- a/pw_package/py/pw_package/pigweed_packages.py
+++ b/pw_package/py/pw_package/pigweed_packages.py
@@ -16,15 +16,16 @@
 import sys
 
 from pw_package import package_manager
-from pw_package.packages import nanopb
 from pw_package.packages import arduino_core  # pylint: disable=unused-import
-from pw_package.packages import stm32cube  # pylint: disable=unused-import
 from pw_package.packages import boringssl  # pylint: disable=unused-import
 from pw_package.packages import chromium_verifier  # pylint: disable=unused-import
+from pw_package.packages import crlset  # pylint: disable=unused-import
+from pw_package.packages import freertos  # pylint: disable=unused-import
 from pw_package.packages import mbedtls  # pylint: disable=unused-import
 from pw_package.packages import micro_ecc  # pylint: disable=unused-import
-from pw_package.packages import crlset  # pylint: disable=unused-import
+from pw_package.packages import nanopb
 from pw_package.packages import protobuf  # pylint: disable=unused-import
+from pw_package.packages import stm32cube  # pylint: disable=unused-import
 
 
 def initialize():
diff --git a/third_party/freertos/BUILD.gn b/third_party/freertos/BUILD.gn
index c967c58..045d1bb 100644
--- a/third_party/freertos/BUILD.gn
+++ b/third_party/freertos/BUILD.gn
@@ -32,7 +32,7 @@
   }
 
   config("public_includes") {
-    include_dirs = [ "$dir_pw_third_party_freertos/Source/include" ]
+    include_dirs = [ "$dir_pw_third_party_freertos/include" ]
     visibility = [ ":*" ]
   }
 
@@ -47,32 +47,32 @@
       pw_third_party_freertos_PORT,
     ]
     public = [
-      "$dir_pw_third_party_freertos/Source/include/FreeRTOS.h",
-      "$dir_pw_third_party_freertos/Source/include/StackMacros.h",
-      "$dir_pw_third_party_freertos/Source/include/croutine.h",
-      "$dir_pw_third_party_freertos/Source/include/deprecated_definitions.h",
-      "$dir_pw_third_party_freertos/Source/include/event_groups.h",
-      "$dir_pw_third_party_freertos/Source/include/list.h",
-      "$dir_pw_third_party_freertos/Source/include/message_buffer.h",
-      "$dir_pw_third_party_freertos/Source/include/mpu_prototypes.h",
-      "$dir_pw_third_party_freertos/Source/include/mpu_wrappers.h",
-      "$dir_pw_third_party_freertos/Source/include/portable.h",
-      "$dir_pw_third_party_freertos/Source/include/projdefs.h",
-      "$dir_pw_third_party_freertos/Source/include/queue.h",
-      "$dir_pw_third_party_freertos/Source/include/semphr.h",
-      "$dir_pw_third_party_freertos/Source/include/stack_macros.h",
-      "$dir_pw_third_party_freertos/Source/include/stream_buffer.h",
-      "$dir_pw_third_party_freertos/Source/include/task.h",
-      "$dir_pw_third_party_freertos/Source/include/timers.h",
+      "$dir_pw_third_party_freertos/include/FreeRTOS.h",
+      "$dir_pw_third_party_freertos/include/StackMacros.h",
+      "$dir_pw_third_party_freertos/include/croutine.h",
+      "$dir_pw_third_party_freertos/include/deprecated_definitions.h",
+      "$dir_pw_third_party_freertos/include/event_groups.h",
+      "$dir_pw_third_party_freertos/include/list.h",
+      "$dir_pw_third_party_freertos/include/message_buffer.h",
+      "$dir_pw_third_party_freertos/include/mpu_prototypes.h",
+      "$dir_pw_third_party_freertos/include/mpu_wrappers.h",
+      "$dir_pw_third_party_freertos/include/portable.h",
+      "$dir_pw_third_party_freertos/include/projdefs.h",
+      "$dir_pw_third_party_freertos/include/queue.h",
+      "$dir_pw_third_party_freertos/include/semphr.h",
+      "$dir_pw_third_party_freertos/include/stack_macros.h",
+      "$dir_pw_third_party_freertos/include/stream_buffer.h",
+      "$dir_pw_third_party_freertos/include/task.h",
+      "$dir_pw_third_party_freertos/include/timers.h",
     ]
     configs = [ ":disable_warnings" ]
     sources = [
-      "$dir_pw_third_party_freertos/Source/croutine.c",
-      "$dir_pw_third_party_freertos/Source/event_groups.c",
-      "$dir_pw_third_party_freertos/Source/list.c",
-      "$dir_pw_third_party_freertos/Source/queue.c",
-      "$dir_pw_third_party_freertos/Source/stream_buffer.c",
-      "$dir_pw_third_party_freertos/Source/timers.c",
+      "$dir_pw_third_party_freertos/croutine.c",
+      "$dir_pw_third_party_freertos/event_groups.c",
+      "$dir_pw_third_party_freertos/list.c",
+      "$dir_pw_third_party_freertos/queue.c",
+      "$dir_pw_third_party_freertos/stream_buffer.c",
+      "$dir_pw_third_party_freertos/timers.c",
     ]
     deps = [ ":freertos_tasks" ]
   }
@@ -94,7 +94,7 @@
     if (pw_third_party_freertos_DISABLE_TASKS_STATICS) {
       configs += [ ":disable_statics" ]
     }
-    sources = [ "$dir_pw_third_party_freertos/Source/tasks.c" ]
+    sources = [ "$dir_pw_third_party_freertos/tasks.c" ]
     deps = [
       pw_third_party_freertos_CONFIG,
       pw_third_party_freertos_PORT,